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?
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
I hope this helps,
Erich
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