Read and write operations on emulated EEPROM cause hard fault error

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

Read and write operations on emulated EEPROM cause hard fault error

705 Views
TomLightning
Contributor III

Hi,

I got a problem with the emulated EEPROM functionality on the S32K142. I have activated the emulated EEPROM with the following FTFC command (64kB EEPROM Backup Size & 4kB EEPROM RAM Size):

 

FCCOB0 = 0x80
FCCOB1 = 0x00
FCCOB2 = 0x00
FCCOB3 = 0x00
FCCOB4 = 0x02
FCCOB5 = 0x04

 

 I also have a configuration struct that is placed at the following FlexRAM location:

 

user_config_t* const UserConfig = (user_config_t*) 0x14000000;

 

When I apply multiple read and write actions on that struct it ends in a hard fault error. Before I read or write to any member of the struct laying in the FlexRAM EEPROM, I am checking whether there is an ongoing flash operation:

 

while((FTFC->FSTAT & 0x80U) != 0x80U)
{
    //Wait until previous flash operation has finished!
}

 

When I go through the programm step by step in debug mode, no hard fault error occure. Because of that I think that this is a problem of timing.

Do you got any hints for me?

Best regards

Tom

0 Kudos
2 Replies

692 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

Hi, in the S32 Design Studio for ARM Version 2.2 there is an example code for that called flash_partitioning_s32k142. Have you checked this?

0 Kudos

674 Views
TomLightning
Contributor III

Hi David,

thanks for your reply. I checked the example and I have seen that it uses the flash driver from NXP. I thought I could write to the struct in the FlexRAM as it is a normal variable in RAM. I also thought, that the EEPROM State Machine than manages that the changes to the FlexRAM are overtaken into the E-Flash.

Best regrads,

Tom

0 Kudos