We are trying to store some data in DFlash Memory of S32k146 microcontroller using traditional RAM . Initially flash memory is partitioned and than data is stored in DFlash as mentioned in the Reference manual. However, ACCERR bit sets. We are using the Example Code mentioned in the SDK named flash_partitioning_s32k146 for EEPROM Please find the code snippet below for Partitioning the Flash Memory :
ret = FLASH_DRV_DEFlashPartition(&flashSSDConfig, 0x0Fu, 0x03u, 0x0u, false, false);
DEV_ASSERT(STATUS_SUCCESS == ret);
/* Re-initialize the driver to update the new EEPROM configuration */
ret = FLASH_DRV_Init(&Flash_InitConfig0, &flashSSDConfig);
DEV_ASSERT(STATUS_SUCCESS == ret);
/* Make FlexRAM available for EEPROM, make sure that FlexNVM and FlexRAM
* are already partitioned successfully before */
ret = FLASH_DRV_SetFlexRamFunction(&flashSSDConfig, EEE_DISABLE, 0x00u, NULL);
DEV_ASSERT(STATUS_SUCCESS == ret);
Please let me know if something is missing in the above code for partitioning of flash memory for DFlash .
Hi@Neelesh_Pandey
You need to determine whether the current MCU has performed a partition operation, if the current MCU has been partitioned, you can first use the debugger to mass erase the MCU first.
"ret = FLASH_DRV_DEFlashPartition(&flashSSDConfig, 0x0Fu, 0x03u, 0x0u, false, false);"
You set the EEPROM size to 0, but the EEPROM backup area is set to 32kbyte, which should be unreasonable.
This should be more reasonable
"ret = FLASH_DRV_DEFlashPartition(&flashSSDConfig, 0x0Fu, 0x0u, 0x0u, false, false);"
Secondly, please note that the FTFC operation should be placed in RAM to avoid EWW errors, and also pay attention to turning off interrupts when erasing.