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
Hello @rexoplans,
BFAR is valid only if CSFR[BFARVALID] = 1.
Can you share the value in CSFR?
Refer to these documents:
https://community.nxp.com/t5/S32K-Knowledge-Base/Fault-handling-on-S32K14x/ta-p/1114447
Regards,
Daniel
@danielmartynek My CFSR value is 8200, I'll review the documents. By the way, I'm also using FreeRTOS
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.
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