HOW TO DEBUG A HARDFAULT FOR S32K144-EVQ IN S32DS IDE

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

HOW TO DEBUG A HARDFAULT FOR S32K144-EVQ IN S32DS IDE

3,118 Views
R2_D2
Contributor II

Hi everyone! 

How can I know what code triggered the following Hardfault?

I have this hardfault:

imagen3.jpg

 

 

 

 

 

 

 

 

 

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:

imagen 4.jpg

 

 

 

 

 

 

 

 

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.

0 Kudos
Reply
4 Replies

1,017 Views
nirmal_masilamani
Contributor I

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?

0 Kudos
Reply

3,104 Views
danielmartynek
NXP TechSupport
NXP TechSupport

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

0 Kudos
Reply

3,081 Views
R2_D2
Contributor II

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:

R2_D2_1-1642794778526.png

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

R2_D2_0-1642794144453.png

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 

R2_D2_0-1642796684082.png

what else can I do to find the cause?

0 Kudos
Reply

3,048 Views
danielmartynek
NXP TechSupport
NXP TechSupport

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

danielmartynek_0-1643116329787.png

Probably because the bus clock for FLexCAN0 module is not enabled.

Please try enabling the PCC_FlexCAN0[CGC] clock:

danielmartynek_1-1643116448377.png

 

Do you use FlexCAN0 in your application?

 

Regards,

Daniel

 

 

0 Kudos
Reply