Stuck in "Hard fault Debug event" after debug session

Hello,

I encountered a strange behaviour on a nrf52832 : 
- I flash a a debug firmware (with debug optim in build config) : I can run debugger and add breakpoints
- I stop debugger, switch to normal build (without debug optim) and flash
- When program reach an old breakpoint (set in debug mode), I got a "hard fault debug event"

Here is a log I got :

[00:00:00.067,291] <err> os: ***** HARD FAULT *****
[00:00:00.067,321] <err> os:   Debug event
[00:00:00.067,321] <err> os: r0/a1:  0x2000351c  r1/a2:  0x00000000  r2/a3:  0x00000000
[00:00:00.067,321] <err> os: r3/a4:  0x00000040 r12/ip:  0x0001863d r14/lr:  0x00034c49
[00:00:00.067,321] <err> os:  xpsr:  0x01000029
[00:00:00.067,352] <err> os: Faulting instruction address (r15/pc): 0x00043dd0
[00:00:00.067,382] <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
[00:00:00.067,382] <err> os: Fault during interrupt handling

[00:00:00.067,413] <err> os: Current thread: 0x20001fd0 (unknown)
[00:00:00.164,978] <err> os: Halting system

I tried to get ride of this, but I was not successful : 
- Erase target
- Do a pristine build an a full reflash after erase in normal mode
- Flash a debug firmware without debugger connected
- Erase all breakpoints in debugger part of vscode

It seems like breakpoints where still existing it nrf52832 flash. This is really strange and ennoying.
To get reide of it, I must restart the debugger, at least clear all breakpoints and reflash with a normal build. Sometimes I got it working, sometimes not. What I miss to get it working back normally ?

Thanks by advance.

Parents
  • I'm also having ghost debug events but can't power cycle as the battery is soldered on the DUT. Solution appears to be to enter debug mode and run the code, at which point it'll stop on one of your debug lines - but you won't see the breakpoint as active. Enable the breakpoint on the line, run code again, observe it stops on the same line. Delete breakpoint. Observe it doesn't stop on that line - it might stop on another, which means you have multiple ghost breakpoints. Continue until the code runs without breakpoints. Then exit debug gracefully and reflash.

  • If you can't remove battery, maybe you can erase or recover the DUT before trying to debug again ?

    You should consider further upgrading your DUT with a removable or at least disconnectable power source to be able to power cycle it.

Reply Children
No Data
Related