HardFault int

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

HardFault int

805 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kemes on Sun Apr 21 22:41:37 MST 2013
Hi to all
I have a circuit in which, after some time that may be an hour or 5 hours, I have an hardwareFault (I turn on a red led in the routine).  There is a way in order to display the sequence call that generated it ?  I can leave the device in simulation, but when there is the hardwareFault event I have a breakpoint in the routine.  How can I detect the sequence call that generated it ?
Thanks
0 Kudos
Reply
2 Replies

798 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by frame on Mon Apr 22 03:29:22 MST 2013
A hardfault after a hour or more really points to some "not so obvious" cause.
Lacking further knowledge of your application, I assume it is triggered by an
asynchronuous event, most probably in the course of an interrupt.

One possibility is a stack overflow. You might run on the limit of stack usage.
If probability hits and two rare interrupts nest, you have a stack overflow with
erratic behavior, most probably ending in a hardfault.
Backtracking this kind of error using the stackframe could prove unrewarding,
because of the asynchronuous nature of causing events.
The issue might go away with increased stacksize, but this would be a hint, and not
a prove of the cause.

Another possibility is an actual implementation error, which manifests only on certain
conditions.This might be triggered by some values/data received during an interrupt.
To state an example - I had an application that accessed a lookup table from within
an interrupt routine. This application crashed after a few minutes.
As it turned out, I exceeded the array bound under certain occasions.

To investigate this problem, you could include debug output in your application,
and log it. You might need more several runs to narrow down on the cause.
Wether you use semihosting or UART/USB output depends on your application
and available tools.
0 Kudos
Reply

798 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by serge on Sun Apr 21 23:04:30 MST 2013
Have you seen this FAQ about debuging a hard fault?
0 Kudos
Reply