Hi everyone!
How can I know what code triggered the following Hardfault?
I have this hardfault:
As far as I know when when you're in a hardfault some core registers are stored in memory stack
I've checked the following registers:
Then it tells me this is a bus fault and BFAR register holds the address of the fault but I don´t now exactly if this address I should to put in memory browser or dissasembly window and this gives me the offending code or what other thing I should do to get the offending code that triggered hardfault.
What I have to do next?
Thanks in advance.
Hello,
I am also facing same Hardfault with CAN MCAL example in S32K144W code? Example code used flexcan0, but for that clocks are configured correctly.
What could cause this fault with example code?
Hello @R2_D2,
It is all explained here:
https://community.nxp.com/t5/S32K-Knowledge-Base/Fault-handling-on-S32K14x/ta-p/1114447
If you have any specific questions, please let me know,
Thanks,
BR, Daniel
Thank you so much daniel for your support I read the post you suggested me
but I cannot identify what is the offending code I just find this value in BFARVALID register:0x40024000 then I put this value into dissasembly window and only shows me the following instruction:
I almost forget to mention this project I am using Freertos and when I exit from one task to another I had noticed this busfault happens
I almost forget to mention I am using Freertos I´ve noticed when I exit from one task to enter to another one this busfault happens. This is the first task running as you can see I update a global variable
what else can I do to find the cause?
Hello @R2_D2,
The BFAR address simply tells you where the bus fault is detected on the bus, this is not the PC address of the instruction that triggers the exception.
You can get the PC address from the stack as expalained in the document and shown in the example.
0x40024000 is an address of the FlexCAN0 module, register MCR
Probably because the bus clock for FLexCAN0 module is not enabled.
Please try enabling the PCC_FlexCAN0[CGC] clock:
Do you use FlexCAN0 in your application?
Regards,
Daniel