FLASH_Program returns error after reboot

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

FLASH_Program returns error after reboot

672 次查看
tmiller
Contributor I

I have a (modified) freedom_bootloader that works, as expected on the K66F.  I have a guest application that can be loaded from the bootloader.  There is an area of FLASH memory that I've designated for shared use between the guest application and the bootloader.  The guest application writes to the shared space using FLASH_Program from fsl_flash.h, and uses NVIC_SystemReset() to reboot the device.  The bootloader reads the shared space, and based on the contents of that space modifies the startup process accordingly.  This all works as I would expect.  I can reprogram the same flash location on the K66F any number of times, and after each time NVIC_SystemReset is called.

The program runs into trouble after I physically power cycle the K66F.  After that, when the guest application tries to use FLASH_Program, it gets a return code of kStatus_FLASH_CommandFailure, which, to my understanding, indicates an unspecified run-time error.  Can anyone help me resolve this issue?  My attempts at diagnosing have been unsuccessful so far.

Edit: additional infromation.

标签 (1)
0 项奖励
2 回复数

529 次查看
mjbcswitzerland
Specialist V

Hi

Is it possible that High Speed RUN mode is used, but only in certain cases? In HSRUN mode Flash programming is not possible.

Regards

Mark

0 项奖励

529 次查看
tmiller
Contributor I

Hi Mark, thanks for the response.  I've checked both the bootloader and the guest application, and HSRUN mode is not enabled by either.  Is there a way to check at runtime if HSRUN mode is currently enabled?  A register to check or something like that?

I'm currently reading the value of SMC_GetPowerModeState, and it's returning kSMC_PowerStateRun.

Thanks,

Tim

0 项奖励