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) |
10 | 0.05 |
10Kb | 26 |
120Kb | 320 |
Can you help us analyze why the microcontroller is taking so much time to erase the Flash Memory.
Edit: Added the attachment
Sorry for the Delayed response Daniel,
We placed only the launch and wait command in RAM. This works fine.. Thanks !
Hi,
The code you attached is full of macros and functions without definition. I’m not able to understand what it does.
Is the whole function in ram? The only code that needs to be in ram is
FSTAT_CCIF = 1; // launch command
while(FSTAT_CCIF == 0); // wait for done
Please try the example.
Regards,
Daniel