I am trying to write K60 flash (program flash only, two 512KB blocks, no FlexNVM) using "Standard Software Flash Driver For FTFx" driver by Freescale. Flash clock is 25MHz. The executed program code is in the lower flash block (0-512KB) while my erase and write test are targeting the upper half. I have understood this is a valid situation.
Erase works, and write function does not report errors. But after phrase write commands, for example 256 bytes, when I am reading data back with memcpy, some phrases read back correctly but some seem to be still in erased condition showing 0xff. Reading memory using JTAG shows usually pretty much same result (seems like states of some phrases may be different). However, when I reset Kinetis and my IDE re-reads flash content of Kinetis, written data reads back correct!
Somehow it seems like FlashProgramPhrase (FlashCommandSequence) continues before the write operation is completely ready. I have not modified code related to CCIF handling.
I suspected the IDE on PC could try doing interfering flash reads through JTAG when the memory view is open, but closing it doesn't help. (I'd expect seeing some kind of error from the driver in this situation.) Just to exclude some things I also tried to turn FMC cache off ( FMC_PFB23CR = FMC_PFB23CR & FMC_PFB23CR_B23RWSC_MASK; ) but it did not make any difference.
Any ideas what I could be doing wrong, or what would be worth trying? Thanks!