cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to replicate hang when debugging with ST-LINK

toddberk
Associate II
Posted on October 26, 2014 at 04:44

Our STM32F103 application hangs consistently within minutes under normal operation without the debugger, but when trying to debug running with ST-LINK SWD it doesn't hang (not using breakpoints).

What is different when running under debug mode that can make the system operate differently?

More application info:

Keil IDE

ST-LINK V2

FreeRTOS

GPS via USART2

Accelerometer on I2C1

1gbit NAND Flash 

Thanks,

Todd

#stm32-st-link-swd-hang-debug
1 REPLY 1
Posted on October 26, 2014 at 14:59

Debuggers are generally invasive, they are going to configure the system so they can access the resources they need. This will mean enabling clocks, pins, internal states, dbgmcu, etc. It was also modify the states of peripheral registers by reading them. Think USART->DR and USART->SR

When monitoring realtime systems, where the debugger will either jam things up, or destroy external equipment, you'd want to output telemetry and debug information via a serial port, or GPIO/LED, so you understand what your code is doing, and where it is when it fails.

Watch out for while() loops without timeout/exit conditions. Have your HardFault routine actually output useful diagnostics.
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..