I have a STM32F4 Discovery board and a ST-Link/V2 programmer.

I want to use my own ST-Link (not the embedded one) for programming and debugging the board.

How should I connect the external ST-Link to the board ?

  • 1
    \$\begingroup\$ What does the documentation say? \$\endgroup\$ – Leon Heller Aug 1 '15 at 11:15
  • \$\begingroup\$ To use the embedded ST-Link. However, I prefer to use a standalone programmer (a little bit like what the author of this article did with their uLink2) \$\endgroup\$ – maddouri Aug 1 '15 at 11:23
  • 1
    \$\begingroup\$ @865719 That article explains exactly what you need. What is your question? \$\endgroup\$ – Passerby Aug 7 '15 at 7:45
  • \$\begingroup\$ Related: electronics.stackexchange.com/questions/230036/… \$\endgroup\$ – phoenix Dec 5 '18 at 19:04

You'll need to isolate the microcontroller from the st-link portion of the board. To do this just remove the jumpers on the CN3 pins.

CN3 location 'CN3'

Then, to use your external st-link, make the following connections to the microconroller pin headers:

  • SWDIO -> PA13
  • SWCLK -> PA14
  • GND -> GND
  • VAPP -> 3V/VDD

  • Do not connect the USB cable

Program it in SW mode.

Not sure why you'd want to do this, unless you wanted to use JTAG to program it instead. If that's the case let me know and I'll update the answer.

| improve this answer | |
  • \$\begingroup\$ You also need to still power the board externally, as the programmer does not provide power. You could do this by connecting the USB cable to a USB wall charger. \$\endgroup\$ – phoenix Dec 5 '18 at 19:40

Instructions for STM32F407G-DISC1 (updated STM32F4DISCOVERY)

Update ST-Link/v2 Firmware

As explained in this answer, some recent versions of the STM32F407G-DISC1 contain firmware in their onboard ST-Link/v2 that pull the F4 into reset unless they are connected to a USB device.

  1. Download and install ST-LINK Utility onto a Windows PC.

  2. Select ST-LINK | Firmware Update | Device Connect | Yes >>>>

Version V2.J32.M22 is known to work.

Supply External Power

Next, power the board from an external power source (such as an AC to USB power adapter). The external ST-Link/v2 does not supply power. Don't plug it into the PC you are programming from or you might accidentally try to use the onboard version to program from.

Remove CN3 Jumpers

As shown in @Sensor's answer, remove the two CN3 jumpers to isolate the F4 chip from the onboard ST-Link/v2.

Connect External ST-Link/v2

Wire the following connections between the external ST-Link/v2 and the DISCOVERY board according to the ST-Link/v2 manual.

PIN1  (VAPP)      -> VDD
PIN15 (NRST)      -> NRST
PIN20 (GND)       -> GND

PIN15 isn't strictly needed when programming from Windows, but it was required when programming from openocd using the default stm32f4discovery.cfg configuration.


The following command can be used to program using the latest master branch of openocd installed with brew install --HEAD openocd on macOS.

$ openocd -f board/stm32f4discovery.cfg -c "program app.elf" -c reset -c shutdown
| improve this answer | |
  • \$\begingroup\$ If you'd like to program the pyboard in this way, see this page. \$\endgroup\$ – phoenix Mar 5 '19 at 16:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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