FLASH_Program returns error after reboot

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

FLASH_Program returns error after reboot

732件の閲覧回数
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 返答(返信)

589件の閲覧回数
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 件の賞賛
返信

589件の閲覧回数
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 件の賞賛
返信