AnsweredAssumed Answered

Why does KM14 reset when erasing flash?

Question asked by Charles Palmer on Oct 20, 2016
Latest reply on Nov 13, 2016 by Martin Mienkina

I am trying to use flash memory in a KM14 processor but the processor resets when I attempt to erase a sector. I have used the FTFA driver from the MKM Bare Metal Software Drivers, and I have the same problem when I port the Processor Expert FLASH_LDD component. As far as I have been able to work out, the crash occurs when the code executes the FTFA_ExecCmd() code (Bare Metal version) or SafeRoutine() code (PE version). AFAIK these routines execute from RAM. As far as I have been able to  work out the processor enters the hardfault_ISR code (though after the reset the RCM_SRS1 register shows ARM Core LOCKUP as the reset reason - possibly because subsequent errors happen while in the hardfault_ISR loop).    

 

Interestingly:

 

1 Sometimes the sector is erased and sometimes it is not erased.
2 The write (4 bytes) to flash operations work correctly, without the reset, even though these use the same FTFA_ExecCmd() or SafeRoutine() code.

 

AFAIK memory protection is off, in both the MPU_CESR and FPROT registers. The watchdog timer is off. I am using FreeRTOS with taskENTER_CRITICAL() and taskEXIT_CRITICAL() around the FTFA_ExecCmd() or SafeRoutine() code. Using taskDISABLE_INTERRUPTS() and taskENABLE_INTERRUPTS() makes no difference.

 

I have used the same Processor Expert FLASH_LDD component without problems KL05 and KL15 processors.

 

What is causing the reset and how do I fix it?

Outcomes