0
\$\begingroup\$

I would like to write some code for the STM32 Blue Pill to use the USB as a serial link. Because I use an ST-Link debugger to program the board, I will need to connect the following:

  • Programming: laptop - ST-Link - STM32
  • Testing: laptop - USB - STM32

I can connect them one at a time, but it would really hamper the test process, going back and forward repeatedly. It would be nice if I could have them connected at the same time.

I read the following at https://stm32-base.org/boards/STM32F103C8T6-Blue-Pill.html:

Warning: The +5V pins on this board are directly connected to the +5V pin of the USB connector. There is no protection in place. Do not power this board through USB and an external power supply at the same time.

I'm not sure what this means. Will I damage anything by having both of the above mentioned connections at the same time?

\$\endgroup\$
2
  • \$\begingroup\$ When connecting the ST-link do not connect the 5V/3.3V pin, then attaching both stlink and usb at the same time is okay \$\endgroup\$
    – Adi
    Jan 5, 2021 at 19:01
  • \$\begingroup\$ @AdityaChavan Thanks. To confirm, only attach GND, SWCLK and SWDIO from the STLink, and the USB connection is fine? \$\endgroup\$
    – Roxy
    Jan 5, 2021 at 19:06

1 Answer 1

1
\$\begingroup\$

When connecting the ST-link do not connect the 5V/3.3V pin, then attaching both st-link and usb at the same time is okay.

The warning is that if you plan to power the board through the 5V pin, you cannot also power it through the USB, as that would short-circuit the two 5V sources.

When using the ST-link, it provides a 3.3V output, which our usb already provides. So to electrically connect the 2, you just short grounds and leave the 3.3V pin on the STM32 Bluepill floating.

\$\endgroup\$
7
  • \$\begingroup\$ Not really. An ST-Link does not provide power. Rather, it monitors the target power to know what voltage level to drive the SWD signals to. Some other SWD adapters may provide power, some little dongles of a sort never offered by ST may even falsely market themselves as ST-Links when in fact they are 3rd party products. In practice, disconnection may work; if the target voltage detect proves needed one could use a resistor of a few hundred ohms. \$\endgroup\$ Jan 5, 2021 at 19:25
  • \$\begingroup\$ So in that case it is safe to have both connected at the same time correct? It will still work in practice if its floating as 3.3V is the default signaling voltage? \$\endgroup\$
    – Adi
    Jan 5, 2021 at 19:29
  • \$\begingroup\$ First figure out if your SWD adapter is actually an ST-Link or if it is a fake. If it's a fake, don't connect the 3v3 line. If it's an ST-Link, try it with no connection and if that doesn't work and you're sure it's a real ST-Link which detects rather than powers, you could connect it. \$\endgroup\$ Jan 5, 2021 at 19:31
  • \$\begingroup\$ @ChrisStratton ST-Links have enough power to provide 10's mA enough to power a stm32f and flash it. Not a good idea to use it with other sources. \$\endgroup\$
    – Voltage Spike
    Jan 5, 2021 at 20:32
  • \$\begingroup\$ @VoltageSpike no, the actual ST-Link's target voltage pin is in input not an output. Apparently there's another pin with an output, but it's not officially documented and not the one someone would be using. As I mentioned way back at the beginning there are 3rd party products in a dongle form factor which are not actually ST-Links but falsely sold as such, and the situation with those is indeed different. \$\endgroup\$ Jan 5, 2021 at 20:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.