Andrew Watson
Andrew Watson

Reputation: 53

STM32 debugger continues to run after hitting a breakpoint

I'm running a STM32L151 microcontroller with Atollic Truestudio 7.0.1 (Eclipse-based). Connecting to the MCU with the ST-Link/V2 debugger through GDB.

Recently, I've noticed a problem with the debugger although I haven't changed anything in the project configuration. When execution pauses at a breakpoint, I can inspect variables, but the target is clearly still running even though the IDE indicates the debugger is "Suspended". This makes step debugging impossible since the program counter just jumps to wherever it is at the moment instead of the next line of code.

It looks like the target might actually be resetting a few seconds after the breakpoint is hit.

Any ideas as to what can cause this and how I might go about fixing it?

Upvotes: 2

Views: 2195

Answers (1)

It looks like the target might actually be resetting a few seconds after the breakpoint is hit.

Then it's probably one of the watchdogs still running when the core is stopped. You can make them stop whenever the core is halted by the debugger with

DBGMCU->APB1FZ |= DBGMCU_APB1_FZ_DBG_WWDG_STOP

or

DBGMCU->APB1FZ |= DBGMCU_APB1_FZ_DBG_IWDG_STOP

whichever is appropriate.

Upvotes: 8

Related Questions