I don't have any prehistoric mini-USB cable and nor can I find one in nearby stores. The board doesn't come with one either. Can I still use my Nucleo board? How?

I should add that I have a STLink V2 programmer. Can I use that to directly program the Nucleo board?

Edit: It worked using the answer below. I'm adding this in case anyone else tries to do this: it works for me ONLY when I connect BOTH the 3.3V and 5V properly. Otherwise, the GPIO logic levels are messed up and no peripherals work. Sometimes the board itself refuses to be programmed as well.

  • 1
    \$\begingroup\$ There might be a better way using the Nucleo development tools, but this video shows how to upload a hex file to a generic STM32 mcu using SWD and a STLink programmer: youtube.com/watch?v=KgR3uM21y7o \$\endgroup\$
    – ErikR
    May 23, 2021 at 8:48
  • 1
    \$\begingroup\$ cut a usb cable and solder the wires. surely a mini-usb is not that hard to come by? \$\endgroup\$
    – Kartman
    May 23, 2021 at 10:28
  • \$\begingroup\$ @Kartman it is here. I used to have those Chinese handheld mp3/ mp4 players back in 2010-2013 and they had mini USB. But here they have been COMPLETELY phased out for the more available micro USB. Unfortunately, I can't find any of the old ones I had, probably thrown them out. I have like 15-20 micro USBs though. \$\endgroup\$ May 23, 2021 at 10:37

2 Answers 2


Yes you can use an external programmer. First, remove both of the ST-Link jumpers from your Nucleo board to cut the on-board ST-Link from the main microcontroller.

You need these connections for SWD interface:

  1. Power: You need to power the Nucleo board somehow. One can use 5V or 3V3 pins to provide external power. I'm not sure if your ST-Link can provide power. Chinese clones can do that, but the original one may not. The original ST-Link may also require a 3V3 connection to detect the presence of power at target, even though it doesn't use that pin to provide power to the target.
  2. GND
  3. SWDIO: Probably needs to be connected to PA13. Check the datasheet or CubeMX
  4. SWCLK: Probably needs to be connected to PA14. Check the datasheet or CubeMX
  5. nRST: This is optional and depends on tool settings.

But I would prefer obtaining a proper USB A - Mini B cable.

  • \$\begingroup\$ Do I use the SWD pins on the programmer part of the nucleo board? \$\endgroup\$ May 23, 2021 at 9:00
  • \$\begingroup\$ No, they are connected to the on-board ST-Link. You need them when you use the on-board ST-Link to program some other external uC. As you don't have access to the on-board ST-Link, they have no use in your situation. \$\endgroup\$
    – Tagli
    May 23, 2021 at 9:24
  • 1
    \$\begingroup\$ Ok. I'll try to find them on the board. I still don't understand why they use mini usb, and then not provide one as they are pretty outdated. \$\endgroup\$ May 23, 2021 at 9:30
  • \$\begingroup\$ I can confirm it is working with PA_13 and PA_14 as labelled in os.mbed.com/media/uploads/adustm/… as SWDIO and SWCLK respectively. And @Tagli, thanks much for helping me out. \$\endgroup\$ May 23, 2021 at 11:26

With the standard STLink probe, use this: enter image description here


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.