Hi Shang jason,
Could you tell me what the IDE you are using, do you just put the FLASH_LaunchCMD to RAM or the whole project to RAM.
Take IAR project as an example, you can use this code:
#if (defined(IAR))
__ramfunc void FLASH_LaunchCMD(uint8_t bWaitComplete)
#else
void FLASH_LaunchCMD(uint8_t bWaitComplete)
#endif
{
#if defined(FLASH_ENABLE_STALLING_FLASH_CONTROLLER)
MCM->PLACR |= MCM_PLACR_ESFC_MASK; /* enable stalling flash controller when flash is busy */
#endif
FTMRH->FSTAT = 0x80;
if(bWaitComplete)
{
// Wait till command is completed
while (!(FTMRH->FSTAT & FTMRH_FSTAT_CCIF_MASK));
}
}
Please also don't do the project optimization, then test it again.
Any updated information, please kindly let me know!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------