AnsweredAssumed Answered

KL27Z FLASH_Erase() causing reset

Question asked by Robert Poor on Mar 8, 2017
Latest reply on Mar 15, 2017 by Robert Poor

Short form:

When I run my code, I'm getting system resets somewhere inside:

flash_command_sequence.6917() at fsl_flash.c:2,554 0x4388 
FLASH_Erase() at fsl_flash.c:731 0x4880


I'm running code which is closely modeled after the Flash programming example in:


However, when I call FLASH_Erase(), the system resets.  (And since my call to FLASH_Erase() is in the initialization code, it resets repeatedly.)  Unfortunately, when I single step into FLASH_Erase(), the call to FLASH_Erase() completes normally which makes it difficult to pinpoint the problem.  [UPDATE: at least I thought it did.  Now it seems to reset repeatedly when I try to step into callFlashRunCommand(), aka flash_command_sequence.] 


The system is powered off USB and a SEGGER JLink, so I think it has sufficient power.


I notice the call flash_command_sequence() has comments about executing position-independent code in memory -- is it possible that the code isn't properly loaded into memory?


Any idea what might be causing this, and what I can do to work around it?