Hello,
I am trying to access the flash of target "Kinetis KEAZN64" in terms of erasing sectors, flashing words, .. etc.
I found out that launching command (FTMRH_FSTAT = 0x80;) after configuring command by "Erase command", CPU stalls for 20ms.
I.e. In code, at line [ FTMRH_FSTAT = 0x80; ], this operation takes 20ms to move to the next line of code.
I do not know why CPU is halted in that way while the flash controller should run in parallel to the CPU.
Any solutions please ?
Thank you in advance.
Hello Mohammed Aboelnasr,
The 20ms time is expected for a Erase Flash Sector command according to the datasheet. The flash memory technology has the limitation of not allowing read operations at the same time as an erase or program operation is occurring within the same block. Refer to the application note AN4695 for more information on this.
In your case, I believe that the bit MCM_PLACR[ESFC] is set and is enabling the stalling of the flash controller when busy to avoid a read collision.
Let me know if you have any question.
Regards,
Gerardo