AnsweredAssumed Answered

Issue with EEPROM Emulation for S32K144

Question asked by Dharmendra G on May 23, 2018
Latest reply on May 28, 2018 by Daniel Martynek

We want to do use the EEPROM Emulation feature of S32K144 to save data in Non Volatile Memory in our application.
I have read the EEPROM emulation application notes  and as per this application notes I have wrote few command to check the EEPROM functionality.

I have wrote 3  string in flexNVM(at address 0x14000000). I have done power cycle to check the content but its not showing any data in memory. After Reset I have kept the break point before the Partition command executes again to avoid the data loss.Also I have used the below Memory Preservation options.

 

 

please find the below code. I have wrote below routines.Is there any command has to execute after every Software Reset ? or Memory controller will dump the backup data to FlexRAM Automatically.

 

Or Can I get example or sample code for EEPROM Emulation ?

 

void EEPROM_Emulation(void)
{
/*********SET UP THE FLASH CLOCK REGISTER********/

//EEE_Test_code();

/* FTFC clock has to enabled in SW */
PCC->PCCn[PCC_FTFC_INDEX] |= PCC_PCCn_CGC_MASK;

while ((FTFC->FSTAT & FTFC_FSTAT_CCIF_MASK) == 0x00); /* Bit Polling for Command Completion Check */

if(((FTFC->FSTAT & FTFC_FSTAT_ACCERR_MASK) == 0x20) || ((FTFC->FSTAT & FTFC_FSTAT_FPVIOL_MASK) == 0x10))
{
FTFC->FSTAT = Clear_old_errors; /* Clear the old errors */
}
/* Program partition command */
FTFC-> FCCOB [3] = 0x80; /* FCCOB0: Selects the PGMPART command */
FTFC-> FCCOB [2] = 0x00; /* FCCOB1: No CSEc operation */
FTFC-> FCCOB [1] = 0x00; /* FCCOB2: No CSEc operation */
FTFC-> FCCOB [0] = 0x00; /* FCCOB3: FlexRAM loaded with valid EEPROM during reset sequence */

 

FTFC-> FCCOB [7] = 0x02; /* FCCOB4: EEPROM data set size code: EEESIZE = 2 (4 kB) */
FTFC-> FCCOB [6] = 0x04; /* FCCOB5: FlexNVM Partition code: DEPART = 4 (Data flash: 0 kB, EEPROM
backup: 64 kB) */


FTFC->FSTAT = Flash_launch_command; /* flash launch Command */
while ((FTFC->FSTAT & FTFC_FSTAT_CCIF_MASK) == 0x00); /* Bit Polling for Command Completion Check */

if(((FTFC->FSTAT & FTFC_FSTAT_ACCERR_MASK) == 0x20) || ((FTFC->FSTAT & FTFC_FSTAT_FPVIOL_MASK) == 0x10))
{
FTFC->FSTAT = Clear_old_errors; /* Clear the old errors */
}

 

FTFC-> FCCOB [3] = 0x81; /* FCCOB0: Selects the SETRAM command */
FTFC-> FCCOB [2] = 0x00; /* FCCOB1: Make FlexRAM available for emulated EEPROM */

 

FTFC->FSTAT = Flash_launch_command; /* flash launch Command */
while ((FTFC->FSTAT & FTFC_FSTAT_CCIF_MASK) == 0x00); /* Bit Polling for Command Completion Check */

EEE_Test_code();    /* Writes 3 strings at Flex RAM adddress 0x14000000*/

}

Outcomes