When I do Program Flash Sector Erase, bit1 (Lockup) in the RCM bloc is set. This means that the ARM core stops executing instructions.
First I initialize the flash bloc by calling FTFL_Initialization(); as defined defined in flash_kinetis.c.
Then I send one or more:
FTFL_EraseSector(0x0000A000); // 0x0000A0000 can be different adresses of course...
The Lockup Reset happens sometimes after sending the 1st FTFL_EraseSector command, but mostly it happens after the 2nd. It seems to happen less if I wait very long after each erase cmd (>5s) (while debugging, single step), but that is not usable of course.
The flash sector is erased apparently before the lockup, but the processor hangs.
I use CW V10.2 + JLINK with a K20DX128.
Any idea?
I had spurious flashing errors which went away when I moved the flash cache reset (a write to FMC_PFB01CR) to the helper function which always runs from RAM.
Related to your problem?