This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to trace back hard fault handler

What's the proper way to debug what's causing my eval board to reset? I'm assuming I need to put a breakpoint in the hard fault handle, but how do I trace that back to the source of the error? Or should I modify the handler?

I also noticed that the breakpoint in the hardfault handler isn't triggered unless I step through the code line-by-line. Is this expected?

image description

Parents
  • I don't know if this is proper method, but my method of checking what causes hardfault is just by setting breakpoint on hardfault handler. When it triggers, I just check call stack to check which function caused it... Can you find exact line of code that causes hardfault? Or is it in SD?

    Edit. Try turning optimization off and debug again. Or maybe it's some time-related problem... Can You check call stack when you get in hardfault handler?

Reply
  • I don't know if this is proper method, but my method of checking what causes hardfault is just by setting breakpoint on hardfault handler. When it triggers, I just check call stack to check which function caused it... Can you find exact line of code that causes hardfault? Or is it in SD?

    Edit. Try turning optimization off and debug again. Or maybe it's some time-related problem... Can You check call stack when you get in hardfault handler?

Children
No Data
Related