cancel
Showing results for 
Search instead for 
Did you mean: 

What exactly does STLink/v2 do on connection to an MCU?

CLomb
Associate

I am currently porting klipper (https://github.com/KevinOConnor/klipper) to stm32f070. It's not a terribly heavy lift considering stm32f042 is currently supported. It currently works great, but only with the stlink connected. If I unplug the STLink, it stops working, reattach, and it starts working again.

Specifically, it's only UART communication that fails. I have set up some debug LED to check that all the proper places in the code are being reached without the stlink attached, and they are.

Is there any documentation on what the STLink adapter does when it connects to the MCU? Does it set the clocks? Disable faults? Turn off the watchdog? Configure anything? I only have a four pin connection (GND, 3v3, SWDIO, SWCLK) from the stlink to the mcu, so I'm not using any extra features, just the basic connection.

I haven't ever encountered a situation before where merely attaching a debug device remedies my problem, it makes for a real head-scratcher.

Thanks!

2 REPLIES 2
CLomb
Associate

Turns out it was a bad ground from the TTL to the board. Plugging in the stlink provided a better ground which caused the TTL to start working again.

S.Ma
Principal

Aside this, I would advise people using a STLink RX/TX signals (as IDF14 of STLinkV3) to keep in mind to RX pin should be configured with intenal pull up in case debugger is unplugged. Otherwise, anomany such as RX pin floating could generate high frequency USART interrupt disrupting some interrupt timings and behaviour.