How to program a STM32 Nucleo board without using the on-board ST-LINK

st-linkstm32

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.

Best Answer

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.

Related Topic