AnsweredAssumed Answered

mk22fn1m0vlh12 erase fails at 0x000e200 even though all bytes read as 0xFF

Question asked by Albert Doe on Mar 29, 2019
Latest reply on Apr 1, 2019 by Kerry Zhou

Address should have been 0x000e2000 (typing missed the final zero)


Using MCUXpresso IDE v10.2.0 (build 759) with SDK v2.3.1.


Tracing the code shows the problem in fsl_flash.c function flash_command_sequence() . After the line callFlashRunCommand() attempting to erase flash sector 0x000e2000 fails with the failure indicated by FSTAT register bit MGSTAT0 being set after callFlashRunCommand().


Reading the sector after the erase indicates all bytes are 0xFF. Writing the sector anyway always works.


Multiple erase then write cycles always shows erase fails at 0x000e2000, but write always succeeds.


No other sectors seem to have a problem.


Similar characteristics using Segger's J-FLASH utility or JLink utility.