S32K312 Hardfault

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

S32K312 Hardfault

824 Views
rexoplans
Contributor III

Hello, I'm encountering a hardfault on the NXP s32k312 microcontroller. According to the HFSR register, it appears to be FORCED, and I see an address in the BFAR register. However, I can't figure out what this address points to. (It doesn't seem to point to any location in RAM or Program Flash.) Below are the values generated during the error. I would appreciate your assistance.

 

--Stack Frame--
R0:2
R1:20416140
R2:20416330
R3:0
R12:40
LR:41e1d9
PC:41e1d8
PSR:61000000
--Fault Register--
CFSR:8200
HFSR:40000000
DFSR:0
BFAR:f05c2078

Tags (2)
0 Kudos
Reply
6 Replies

795 Views
rexoplans
Contributor III

@danielmartynek  My CFSR value is 8200, I'll review the documents. By the way, I'm also using FreeRTOS

0 Kudos
Reply

786 Views
danielmartynek
NXP TechSupport
NXP TechSupport

The program must have run away, becasue the core accesses an unimplemented memory location.

You should be able to find the PC address of this precise bus fault instruction on the stack.

 

0 Kudos
Reply

764 Views
rexoplans
Contributor III
But I cant, PC value is invalid. My PC value is 41e1d8 but MCU end addres is 0x40403c( HSE host end addr on flash).
0 Kudos
Reply

732 Views
danielmartynek
NXP TechSupport
NXP TechSupport

If you halt the core in the HardFault_Handler(), find the SP value in the core registers.

Then, open the memory view at this SP address and read the stacked context.

You should find the PC address of the fault instruction there

It is explained in the documents I linked.

 

Regards,

Daniel

0 Kudos
Reply

730 Views
rexoplans
Contributor III
Thank you for the information, but I am aware of this. I suspected a stack overflow and I found it. While searching for it, I utilized a feature of gdb. Thank you for your help
0 Kudos
Reply