AnsweredAssumed Answered

EEPROM emulation using FlexRAM and FlexNVM

Question asked by Ashish Dargad on Oct 10, 2019
Latest reply on Oct 16, 2019 by Ashish Dargad



I am using MKW36A512 micro. 256KB Program flash is being used for code storage. Also I need to utilize 224KB of Flex NVM for Code storage and 32KB of Flex NVM for EEPROM Backup Since the application SW size is somewhat more.

I need 512 bytes of EEPROM data storage out of FlexRAM. So I have written the code to make the program partition with below configuration.



When I try to run the SW on Mass erased Micro for first time, I see that SW tries to do program partition and then it resets by calling NVIC_SystemReset().

But after this reset my debugger (Segger J Link) loses the control.

Then I try to reconnect the debugger, then I see that code runs correctly.

So to see what happens after reset which is done just after program partition, I did some investigation.

After Mass erase of chip, when I flashed for first time, I take the dump of entire chip using Segger J-Flash V6.50b, I see the dump matches with the srec generated by Mcuexpresso.

Then I let the SW run for some time, SW does the program partition (since EEPROM size was zero after mass erase), and then it resets. Then SW becomes unresponsive. The I try to read the dump using Segger J-Flash V6.50b again, But at this time I see that Flex NVM address range (0x10000000 - 0x10020000) is not containing any code. It is blank.

So my question is whether Program flash partition command erases complete Flex NVM (along with code stored in it.)?

If it erases the EEPROM backup area of FlexNVM, it is fine.But I doubt it is erasing the Data flash partition as well. Please confirm.


User manual mentions below

"After clearing CCIF to launch the Program Partition command, the FTFE first verifies
that the EEPROM Data Set Size Code and FlexNVM Partition Code in the data flash IFR
are erased. If erased, the Program Partition command erases the contents of the FlexNVM
memory. If the FlexNVM is to be partitioned for EEPROM backup, the allocated
EEPROM backup sectors are formatted for EEPROM use. Finally, the partition codes are
programmed into the data flash IFR using the values provided. The Program Partition
command also verifies that the partition codes read back correctly after programming.
The CCIF flag is set after the Program Partition operation completes."