Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
Hello,

I'm trying to debug issues with using the retention memory. I am getting Hard Faults, I believe. I have enabled Hard Fault debugging using CPU_CTRL_XMC4 App, but the debugger never breaks, it just keeps running and when I manually break, the program counter is in the VADC0_G3_3_IRQHandler Default Handler.

1) What does this actually mean? I'm pretty sure there's no reason for VADC0_G3_3_IRQHandler to actually be called, it must be masking a different (default) handler.

2) If this is actually the result of a hard fault, what could be the reasons the debug support isn't working? Are there any compiler options needed to make it work?
0 Likes
3 Replies
User8819
Level 4
Level 4
Hi,

you have several options to examine what is happening

1. if you have hard fault check registers CFSR, SHCSR, BFAR, MMFAR and from those try to understand what is happening, you can examine also registers that are pushed on stack

2. enable also other fault handlers, this makes easier to detect the cause

3. read following document http://www.keil.com/appnotes/files/apnt209.pdf on how to work with handlers, there are several similar you can find on internet

rum
0 Likes
Not applicable
Hi lerlacher,

Fault handling and debugging is one of the harder things out there and it might take a while to pinpoint the reason.

Firstly, VADC0_G3_3_IRQHandler is what shows up if a fault has occurred but you haven't defined the appropriate handler. Not sure how it works with APPS, but whenever I write code in the editor and a fault occurs, it also goes into the VADC0_..._IRQHandler if the proper handler is undefined.

Also, consider this: there are multiple faults, such as Bus Fault, or MemManage Fault that can occur. If you've enabled Hard Fault "catching" but haven't enabled Bus Fault "catching" or the other, the default handler (VADC0_...) will be called.

Bottom line is, I would suggest doing some research and reading the link posted by rum - it's very good and helped me understand a few things in the past. Debugging faults is a very tricky business but it gets better as you get better.

Hope that helps!

Best regards,
Andrey
0 Likes
Not applicable
I don't know what was wrong but ultimately disabling all the options in the CPU_CTRL_XMC4 App and then reenabling them made it work. It must have been a weird failure of the compiler or linker not registering the handler functions correctly.
0 Likes