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

cancel
Showing results for 
Search instead for 
Did you mean: 

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

360 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
3 Replies

346 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

323 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

290 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