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:
boards/frdmkl27z/driver_examples/flash/pflash/pflash.c
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?
Solved! Go to Solution.
Hi
Make sure that you run the code from SRAM and with interrupts disabled.
Regards
Mark
Professional support for Kinetis: http://www.utasker.com/index.html
Remote desktop one-on-one coaching: http://www.utasker.com/services.html
Getting started to expert videos: https://www.youtube.com/results?search_query=utasker+shorts
Hi
Make sure that you run the code from SRAM and with interrupts disabled.
Regards
Mark
Professional support for Kinetis: http://www.utasker.com/index.html
Remote desktop one-on-one coaching: http://www.utasker.com/services.html
Getting started to expert videos: https://www.youtube.com/results?search_query=utasker+shorts
I independently discovered that interrupts were indeed the problem: I had implemented a regular timer interrupt. Turning that off during the time I was writing to flash fixed the problem.
Thanks!