k22 FlashErase/program not working in HS Run mode

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

k22 FlashErase/program not working in HS Run mode

801 Views
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 Kudos
Reply
2 Replies

787 Views
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

796 Views
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