We are using a Freescale microcontroller for a project and have a few queries about the time required to erase the flash memory. We are currently using the Freescale MC9S12ZVC-64 Pin (ECC: 192 Kbyte) package option, Compiler as Freescale CodeWarrior v10.6.4 .
We have created a Flash library, which is executing from the RAM for the erase and program functionalities. Please find the attachment of the code for Erase functionality. This function updates the necessary registers such as the FCLKDIV,FSTAT and the FCCOB register. And monitor the FSTAT register to ensure that the erase is complete.
Similarly the same is done for the Program function. We have observed that both the Erase and Program operations work as expected to. But the Erase operation takes a very long time to erase the Flash area.
These are the timings observed during our internal testing.
Size ( in bytes)
Time ( in Seconds)
Can you help us analyze why the microcontroller is taking so much time to erase the Flash Memory.
Edit: Added the attachment