k22 FlashErase/program not working in HS Run mode

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

k22 FlashErase/program not working in HS Run mode

1,422 次查看
jaswanth
Contributor I

Hi All,

I am using TWR-k22f120M-eval kit. My application need the core clock to run at 120Mhz. So I configured it to run in HS run mode. but FLASH_Erase API is returning error (kStatus_FTFx_AccessError (errorcode 103)). but same FLASH_Erase API is returning SUCCESS if core clock is running at 80Mhz.

here is the non working code(HSRUN mode):

To simulate error scenario replace BOARD_BootClockRUN() with mcgConfig_BOARD_BootClockHSRUN() in flah example extracted from SDK.

is there any way to use flash API successfully in HS run mode?

0 项奖励
回复
2 回复数

1,408 次查看
ErichStyger
Specialist I

Hi @jaswanth ,

you cannot program the flash in HSRUN mode. if using HSRUN you need to change the mode during flash programming and then go back to HSRUN. How I am doing this with the SDK you can see in

https://github.com/ErichStyger/MetaClockClock/blob/main/Firmware/ClockCommon/nvmc.c

ErichS_0-1619846596037.png

 

I hope this helps,

Erich

1,417 次查看
mjbcswitzerland
Specialist V

Hi

It is not possible to program flash in HSRUN mode on your device.
You need to reduce the speed to <= 80Mz and switch to normal RUN mode, do the programming , and then move back to HSRUN mode.

There are a number of restrictions in HSRUN mode that are all defined in the user's manual.

Regards

Mark