AnsweredAssumed Answered

Problems using internal flash in MK22F

Question asked by Olav Birkeland on Apr 25, 2017
Latest reply on Apr 27, 2017 by Olav Birkeland



I do not get the "pflash_frdmk22f" example code from SDK 2.1 to work.


The code fails in main() after calling (line 180) :

result = FLASH_Erase(&s_flashDriver, destAdrss, pflashSectorSize, kFLASH_ApiEraseKey);


result is set to 103 meaning:


"Command is not available under current mode/security."


However I cant understand why. The flash is not in secure mode and no flash blocks are protected. I am running on my own HW and had to modify the "BOARD_BootClockRUN()"  function to clock the MCU from internal instead of external clock source, other than that the code example is unchanged.



Any suggestions to what can be wrong?