HI
I have a project running FreeRTOS, UART, SPI, I2C ... and using S32DS. All of this is running ok. Now I need to store some data to EEPROM.
I used flash_partitioning example to get to know the driver to write to EEPROM.
First I initialise the driver
/* Always initialize the driver before calling other functions */
ret = FLASH_DRV_Init(&Flash_InitConfig0, &flashSSDConfig );
/* Config FlexRAM as EEPROM if it is currently used as traditional RAM */
if (flashSSDConfig.EEESize == 0u)
{
/* Configure FlexRAM as EEPROM and FlexNVM as EEPROM backup region,
* DEFlashPartition will be failed if the IFR region isn't blank.
* Refer to the device document for valid EEPROM Data Size Code
* and FlexNVM Partition Code. For example on S32K116:
* - EEEDataSizeCode = 0x03u: EEPROM size = 2 Kbytes
* - DEPartitionCode = 0x03u: EEPROM backup size = 32 Kbytes */
ret = FLASH_DRV_DEFlashPartition(&flashSSDConfig, 0x03u, 0x03u, 0x0u, false, true);
/* Re-initialize the driver to update the new EEPROM configuration */
ret = FLASH_DRV_Init(&Flash_InitConfig0, &flashSSDConfig);
/* Make FlexRAM available for EEPROM */
ret = FLASH_DRV_SetFlexRamFunction(&flashSSDConfig, EEE_ENABLE, 0x00u, NULL);
}
Than I write to eeprom
if (flashSSDConfig.EEESize != 0u)
{
address = flashSSDConfig.EERAMBase;
FLASH_DRV_EEEWrite( &flashSSDConfig, address, 4, write_E_data );
if (*((uint32_t *)write_E_data) != *((uint32_t *)address))
{
/* Failed to write data to EEPROM */
// exit_code = 1u;
return 1;
}
What happens is:
1. if I RUN this code .. the applicaton hit the HardFault_Handler() ..always.. and this is happening in the FLASH_DRV_EEEWrite() function
2. if i SINGLE step the FLASH_DRV_EEEWrite() function the application works OK .. it is NOT hitting the HardFault_Handler()
3. I can see the data stored in the EEPROM
Does anybody have any idea why this is happening? I am using J-link if this plays any role in the equation.
Br zorz