S32K144

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
651 Views
zq1
Contributor III

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? 

zq1_0-1697698965413.png

 

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

0 Kudos
1 Solution
599 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport
0 Kudos
3 Replies
633 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @zq1 

it looks like Read-While-Write error. Important point is that you can't touch the flash when executing this command:

lukaszadrapa_0-1697793381281.png

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

0 Kudos
604 Views
zq1
Contributor III

thank you very much, can you share me with the file shown as the picture you pasted

0 Kudos
600 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport
0 Kudos