when i first debug power on .the program will into HardFault, but after the flash init finished, it will not into into HardFault, i want to know why?
status_t flash_init(void)
{
status_t ret = STATUS_ERROR;
ret = FLASH_DRV_Init(&Flash1_InitConfig0,&Flash_SSD_InitConfig);
if (ret != STATUS_SUCCESS)
{
return ret;
}
if(Flash_SSD_InitConfig.EEESize == 0)
{
//FLASH_DRV_DEFlashPartition(&Flash_SSD_InitConfig,0x02,0x04,0,false,true);
/* 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 S32K144:
- EEEDataSizeCode = 0x02u: EEPROM size = 4 Kbytes
- DEPartitionCode = 0x03u: EEPROM backup size = 32 Kbytes
EEE_FLASH 0x10008000 ~ 0x1000FFFF
D_FALSH 0x10000000~0x10007FFF*/
INT_SYS_DisableIRQGlobal();
ret = FLASH_DRV_DEFlashPartition(&Flash_SSD_InitConfig,0x02,0x03,0,false,true);
if (ret != STATUS_SUCCESS)
{
return ret;
}
else
{
ret = FLASH_DRV_Init(&Flash1_InitConfig0,&Flash_SSD_InitConfig);
if (ret != STATUS_SUCCESS)
{
return ret;
}
}
}
else
{
ret = FLASH_DRV_SetFlexRamFunction(&Flash_SSD_InitConfig,EEE_ENABLE,0,NULL);
if (ret != STATUS_SUCCESS)
{
return ret;
}
}
INT_SYS_EnableIRQGlobal();
return STATUS_SUCCESS;
}
hope your reply
Solved! Go to Solution.
It's from the reference manual:
Hi @zq1
it looks like Read-While-Write error. Important point is that you can't touch the flash when executing this command:
When using SDK drivers, the code runs from RAM (code which launches the command and which waits for done).
Two common issues I would check:
- callback function in flash is used
- there's an interrupt which touches the flash
Regards,
Lukas
thank you very much, can you share me with the file shown as the picture you pasted