cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H563 gets stuck, and unstuck when connecting the debugger

massimoperdigo
Associate III

Hello everyone,

I’ve encountered some strange behaviour with my PCB using an STM32H563VGI MCU.

The setup includes an array of 10 LEDs, where one additional LED turns on every 2 minutes. Initially, the system worked fine, but after about 10 minutes, I noticed the LED sequence stopped progressing, it got stuck at LED 2.

To investigate, I connected a SEGGER J-Link debugger. Surprisingly, as soon as it was connected, the system resumed normal operation: the MCU printed all messages correctly, and the LED array advanced to LED 5, which was the expected state at that moment. It’s as if simply connecting the debugger “unstuck” the MCU.

I’m using ThreadX as the RTOS.

Has anyone experienced similar behavior? Any ideas what could be causing this?

Thanks in advance for your help!

14 REPLIES 14
Andrew Neil
Super User

@massimoperdigo wrote:

To investigate, I connected a SEGGER J-Link debugger. Surprisingly, as soon as it was connected, the system resumed normal operation


What, exactly, do you mean by, "connected" here?

  • Just physically plugged-in?
  • With an active debug session?
  • other?
A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

I connected the SEGGER J-Link and opened the J-Link RTT Viewer, which doesn’t start a full debug session, it’s only used to read non-blocking messages printed via SEGGER_RTT_printf.

As soon as I connected to the MCU using the RTT Viewer, the system seemed to unblock and resumed normal operation. The internal timer appeared to have been working correctly the entire time, as 5 LEDs turned on immediately, indicating that 10 minutes had passed, which aligns with the expected behaviour.

massimoperdigo_0-1748599985845.png

This is the 3v3 to gnd power supply that feeds the MCU

So just plugging-in the connector makes no difference - it's not until you actually connect RTT that your target "unblocks" ?

Have you asked Segger about this? They may have insight into what happens during/after an RTT connection which might cause this...
https://forum.segger.com/index.php/Board/3-J-Link-Flasher-related/?s=35d02df31511720cdf7a9f94838ca4a097a95584

 


@massimoperdigo wrote:

opened the J-Link RTT Viewer, which doesn’t start a full debug session.


I'm not sure that it makes any difference as far as the core is concerned

As far as the Core is concerned, I think it's all just a DAP connection?

Again, Segger may be able to clarify that.

 

Does your code have anything which checks for a debugger connection; eg, to allow debug through sleep modes, prevent disabling debug pins, etc?

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

i will do that right now! thanks.

i will keep you updated.