I am trying to implement EEPROM functionality on s32k148 controller but code is getting hang after clearing CCIF bit and as well collision error detection bit (RDCOLERR) is getting set I checked in code watchdog interrupt bit CS[INT] is disable and as well interrupt for CCIF bit (CCIE) is disable
and if i restart the target without terminating or re - launching i don't face this issue
Please find the attached code
after further digging into this problem i got to know that The Program Partition command must not be launched from flash memory,since flash memory resources are not accessible during Program Partition command execution.
Do we need to execute this function from RAM ? and How to do it ?
i tried this doing by adding Macro START_FUNCTION_DEFINITION_RAMSECTION , but not working
static uint8_t NVMT_CommandSequence(void)
uint8_t ret = TRUE;
/* Clear CCIF to launch command */
FTFC->FSTAT |= FTFC_FSTAT_CCIF_MASK;
/* Wait till CCIF bit is set*/
while(0U == (FTFC->FSTAT & FTFC_FSTAT_CCIF_MASK))
/*Check if any Error is occurred*/
if((FTFC->FSTAT & (FTFC_FSTAT_MGSTAT0_MASK | FTFC_FSTAT_FPVIOL_MASK | FTFC_FSTAT_ACCERR_MASK | FTFC_FSTAT_RDCOLERR_MASK )) != 0U)
ret = FALSE;
in RM it was also mention that Changes related to execution of the Program Partition command take effect after the next
Do we need to do self reset after partitioning done ?
Please see the .map file in the Debug_Flash folder.
The command sequence function is in PFlash.
You can place the function to SRAM using this attribute:
__attribute__ ((section(".code_ram"))) // place the function below into .code_ram section static uint8_t NVMT_CommandSequence(void);