The sdk example on mcuxpresso for k22 explain in how to write data to flash and erase and verify. I tryed to write on flash on the same locations but appear wrong data. Is it necessary to read all the datas to RAM, erase FLASH, change the datas and put again in FLASH writing again? Because don´t work write in flash and write in flash.
Hi Alexandre Voigt da Poian
You can check the Reference Manual, in the "Flash Memory Module (FTFA)" you can find a note:
A flash memory location must be in the erased state before
being programmed. Cumulative programming of bits (back-toback
program operations without an intervening erase) within a
flash memory location is not allowed. Re-programming of
existing 0s to 0 is not allowed as this overstresses the device.
It is not necessary to make all the process of the code example, but if you want to program a section, you first need to erase it. as you are trying to program the same section, then this operation is not allowed.
Hope this helps