C40 Code Memory Allocation – Hard Fault When Changing Sector

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

C40 Code Memory Allocation – Hard Fault When Changing Sector

169 Views
GaneshBhagwat
Contributor IV

Hi

I’m working with the C40 flash memory driver and used the following configuration, which works fine with the default project settings:

#define EXAMPLE_MASTER_ID         (0U)
#define EXAMPLE_SECTOR_START_ADDR (0x00600000U)
#define EXAMPLE_SECTOR_TEST       (C40_CODE_ARRAY_0_BLOCK_1_S256)
#define EXAMPLE_BUFFER_SIZE       (64U) // or 128U

However, when I change the settings to:

#define EXAMPLE_MASTER_ID         (0U)
#define EXAMPLE_SECTOR_START_ADDR (0x00500000U)
#define EXAMPLE_SECTOR_TEST       (C40_CODE_ARRAY_0_BLOCK_0_S128)
#define EXAMPLE_BUFFER_SIZE       (64U) // or 128U

the program hits a hard fault.

Could anyone clarify what might cause this issue?
From my understanding, possible causes could be:

  • The selected start address overlaps with a protected or reserved flash region.

  • The sector/block size definition (C40_CODE_ARRAY_0_BLOCK_0_S128) doesn’t match the actual memory map for the device.

  • Attempting to write or erase from a block where the code is currently executing.

  • Misalignment with the flash controller’s sector boundaries.

I’ve attached an image showing the issue in more detail.

Thanks and Regards,

Ganesh Bhagwat

 

0 Kudos
Reply
1 Reply

150 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@GaneshBhagwat

This should be an Read-While-Write Event Error(RWE), you need to put flash operation into SRAM to avoid RWE.

Please refer to this post:

https://community.nxp.com/t5/S32K-Knowledge-Base/S32K312-C40-Ip-SRAM-RTD-500-DS35/ta-p/2074245

 

0 Kudos
Reply