S32K322 MPU MemManage handler Exception Not Reaching

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

S32K322 MPU MemManage handler Exception Not Reaching

576 Views
Thiru2483
Contributor II

Hi Team,

I have configured the MPU memory partition.

I created a stub function to intentionally violate the SRAM address region.

Thiru2483_0-1777026529330.png

Initially, I configured both read and write access to the SRAM region. After changing the region permissions to read-only and attempting to write to the TEST_SRAM_ADDRESS, a MemFault is triggered, and the location is updated as expected. However, it is entering the HardFault handler instead of the MemManage handler. I have attached the image below for your reference withe register details.

Thiru2483_1-1777026796118.png

Thiru2483_0-1777027817170.png

 

I have added the MCAL MPU option enabled similar is done for core 1.

Kindly let me know why this is happening and whether I am missing any configuration. Please provide your support on this.

S32K3

 

0 Kudos
Reply
1 Reply

463 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @Thiru2483,

The root cause could be that another fault occurs during exception entry or stack usage. Even with MEMFAULTENA enabled, if the MPU violation happens while the core is stacking/unstacking registers (for example, when the stack pointer lies in or grows into a restricted SRAM MPU region), the Cortex‑M7 will force escalation directly to HardFault. In that case, MemManage_Handler is never entered. Is the stack located in the same SRAM region that you are restricting with the MPU?

 

Regards,

Daniel

 
0 Kudos
Reply