KL27Z FLASH_Erase() causing reset

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

KL27Z FLASH_Erase() causing reset

跳至解决方案
782 次查看
robertpoor
Senior Contributor I

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 

Details:

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?

标签 (1)
标记 (3)
0 项奖励
1 解答
516 次查看
mjbcswitzerland
Specialist V

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

在原帖中查看解决方案

2 回复数
517 次查看
mjbcswitzerland
Specialist V

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

516 次查看
robertpoor
Senior Contributor I

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!

0 项奖励