Facing issue on erasing sector in the Flash memory in S32K144

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Facing issue on erasing sector in the Flash memory in S32K144

847 Views
Vinod_Chinthoti
Contributor II

hi all,

i am using S32K144 for development, i want to store some data in internal flash. so i go through flash partition example from S32DS for simple read and write. when i am trying to erase the P-flash location(0x7f000) controller reset happing. here i am attaching my code.

/* Always initialize the driver before calling other functions */

ret = FLASH_DRV_Init(&Flash1_InitConfig0, &flashSSDConfig);

DEV_ASSERT(STATUS_SUCCESS == ret); /* Erase the last PFlash sector */

address = FEATURE_FLS_PF_BLOCK_SIZE - FEATURE_FLS_PF_BLOCK_SECTOR_SIZE;

size = FEATURE_FLS_PF_BLOCK_SECTOR_SIZE;

ret = FLASH_DRV_EraseSector(&flashSSDConfig, address, size); //facing issue here

DEV_ASSERT(STATUS_SUCCESS == ret); /* Verify the erase operation at margin level value of 1, user read */

ret = FLASH_DRV_VerifySection(&flashSSDConfig, address, size / FTFx_DPHRASE_SIZE, 1u); DEV_ASSERT(STATUS_SUCCESS == ret); /* Write some data to the erased PFlash sector */

size = BUFFER_SIZE; ret = FLASH_DRV_Program(&flashSSDConfig, address, size, sourceBuffer); DEV_ASSERT(STATUS_SUCCESS == ret);

/* Verify the program operation at margin level value of 1, user margin */

ret = FLASH_DRV_ProgramCheck(&flashSSDConfig, address, size, sourceBuffer, &failAddr, 1u); DEV_ASSERT(STATUS_SUCCESS == ret);

address = 0x7f004; readflash_data[0] = *((uint32_t *)address);

0 Kudos
1 Reply

827 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @Vinod_Chinthoti,

Since the S32K144 part has only one PFlash block, the command must not be launched from PFlash.

The function FLASH_DRV_EraseSector() calls FLASH_DRV_CommandSequence() that launches the command.

Please make sure the function is either in SRAM or DFlash.

Also, do you see any FSTAT error?

 

BR, Daniel

0 Kudos