Issue with EEPROM Emulation for S32K144

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Issue with EEPROM Emulation for S32K144

2,604 Views
dharmendrag
Contributor I

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.

pastedImage_1.png

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*/

}

Labels (1)
0 Kudos
Reply
1 Reply

1,427 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,
Since you set FCCOB3 = 0, FlexRAM is loaded with valid EEPROM during reset sequence.
Do you poll EEERDY bit after POR? If set, the data should be ready. AN11983, 3.4 S32K1xx EEE startup

How are you stopping the execution after POR. You can check FCFG1_DEPART bitfield to see if the MCU has been partitioned already.
See the EEE initialization flow chart, Figure 10, AN11983.

Regards,
Daniel

0 Kudos
Reply