# Problems connecting ST-Link V2 and STM32F4 discovery board

I'm unable to connect to my STM32F4Discovery board using an ST-Link/v2.

I've removed jumpers from CN3, connected the cables correctly but the utility tool won't detect anything...

PIN1  (VAPP)      -> VDD
PIN7  (TMS_SWDIO) -> PA13
PIN9  (TCK_SWCLK) -> PA14
PIN20 (GND)       -> GND


Here is the physical connection:

And software settings:

This is the error message that I get when trying to connect:

Here is the log message that I get in trace:

ST-Link/V2 device detected
Target voltage detected: 0.601975
Driving NRST low
Error getting target IDCODE: if SWD, check SWD connection
Error (4) while initializing ST-Link in SWD mode


• Do you know that the Discovery has an on-board ST-Link? Apr 23 '16 at 9:40
• Yes, but I soldered another SMT32F chip on an adapter board and tried to access it. I couldn't and then fallen back to a device I know it should work (discovery board) and now having the same issues. So I need to make it work on a professional made board and only then I can move with 100% certainty to my own board. Apr 23 '16 at 9:57
• I see, then never mind my comment. Apr 23 '16 at 10:28
• Although this post was useful to me, I'd like to add that the picture is wrong. You correctly said that: PIN1 -> VDD PIN7 -> PA13 PIN9 -> PA14 PIN20 -> GND But on the picture you have: PIN1 -> VDD PIN9 -> PA13 PIN11 -> PA14 PIN20 -> GND The problem is with google image search engine, lazy people would make wrong connections (as myself on my first attempt hehe). P.D. This should be a comment, but my reputation doesn't allow me yet ;) Dec 13 '16 at 16:51
• -1 for posting a picture which shows incorrect SWD connections differing from the text as the middle two pins are incorrectly connected off-by-1 at pins 9 and 11 of the STLINK instead of pins 7 and 9 where they belong. Dec 5 '18 at 21:13

Target voltage detected: 0.601975

You need to power your target. The debug adapter does not provide power, it uses the Vtarget pin to determine the output voltage levels.

• Thanks for quick reply! Now that I have connected 3.3V input it starts to blink and all that demo stuff but I have a new error now: ST-Link/V2 device detected Target voltage detected: 3.242133 Error getting target IDCODE: if SWD, check SWD connection Error (4) while initializing ST-Link in SWD mode Apr 23 '16 at 9:46
• "Hardware reset" requires the reset line to be connected. This is apparently not the case. Apr 23 '16 at 9:52
• I connected it now, and it pulls the NRST pin down and it blinks for a moment when I press the connect button and then just throws an error above. And I've tried using Normal mode but it's giving me the same error. Apr 23 '16 at 9:58
• So, the problem was when I connected discovery board using USB, even though the CN3 jumpers were not connected it still recognized onboard ST-Link v2 and tried to use that one... After painful realization switching it to a external one it worked just fine! Thanks to everybody involved! Apr 25 '16 at 8:58

Presumably you use the GPIOA port in your source code. If so, first download program to discovery; your code conflicts with swd pins. When you power your board, your source code changes the pa13 and pa14 pins roles. You must connect swd to your board immediately after reset (and do so after power) before loading your code to the CPU.

What should you do? You should erase the flash memory.

First open the STM32 ST-LINK Utility.

1. push and hold discover black button (nrst button),
2. click target -> setting,
3. select "connect under reset” option; at the same time click refresh and release discovery board black button,