# STM32 prototype unable to connect to PC using ST-Link/V2 SWD

Circuit Diagram

Background & What I have tried.

• I have wired wrapped this setup myself using a fresh STM32F411RC MCU from digikey (on a proto-advantage LQFP-64 to DIP-64 breakout board).
• I've wired up the SWCLK, SWDIO, NRST, GND, MCU_VDD, as outlined in the ST-LINK/V2 User Manual (UM1075).
• I power my prototype using the USB, a multimeter confirms 3.3V is getting to each of the VSS/VDD pairs & VBAT pin.
• I've tried the various frequencies for SWD as well as the various Reset Modes and Modes in the windows GUI.
• My wiring is as minimal as this guy using the STM32F030, so i'm not sure what the problem is: https://www.newbiehack.com/categories/newbiehack-tutorial-ARM-Video6-GPIOCreatingTheCircuit-nomenu
• I am able to connect using UART however it seems like the STM Flash Loader program only provides the capability to load to the 512K version, but I have the 256K version.

Error message

arch:~\$ st-util -v99
2016-05-18T12:50:58 DEBUG src/stlink-common.c: st vid         = 0x0483 (expect 0x0483)
2016-05-18T12:50:58 DEBUG src/stlink-common.c: jtag version   = 0x19
2016-05-18T12:50:58 DEBUG src/stlink-common.c: swim version   = 0x4
2016-05-18T12:50:58 DEBUG src/stlink-common.c: core_id = 0x00000000
2016-05-18T12:50:58 WARN src/stlink-common.c: unknown chip id! 0


Under linux ST-LINK/V2 is detected however the MCU is not.

Windows STM ST-LINK Utility trace.log:
Error (0x16) after target cmd F2 36 04 20 04 E0 00 00 00 00
W at 0xe0042004: 0x00000000
Error (0x12) after target cmd F2 35 04 20 04 E0 00 00 00 00
W at 0xe000edf0: 0xa05f0000
Error (0x12) after target cmd F2 35 F0 ED 00 E0 00 00 5F A0
cErrLog::SetLogTraceOn
Target voltage detected: 3.222947
Driving NRST low
Error getting target IDCODE: if SWD, check SWD connection
Error (4) while initializing ST-Link in SWD mode
Target voltage detected: 3.221382
Driving NRST low
Error getting target IDCODE: if SWD, check SWD connection
Error (4) while initializing ST-Link in SWD mode
Target voltage detected: 3.221382
Driving NRST low
Error getting target IDCODE: if SWD, check SWD connection
Error (4) while initializing ST-Link in SWD mode


The windows GUI shows "Detection Failed" for "Target" & "Target Voltage", and provides the error message "Can not connect to target.".

Questions

1. Any ideas on what I should try next, or what might be preventing SWD from operating?
2. I am able to connect using UART however the STM Flash Loader program detects the chip model however slightly incorrect, I only has the 512K version in the dropdown http://i.imgur.com/Zu2c57K.png yet my chip is the 256K version, so it seems like I can't use the Flash Loader to load on a program. Are there any other tools that know the memory map of the 256K chip and are able to flash a binary?

What I have yet to try

1. Put a 22ohm resistor on the NRST line between the ST-LINK/V2 and the board. (AN4488 pg42)
2. Fully wire up and ground all the other ST-LINK/V2 header pins like shown in AN4488 pg42, even though I don't think it's necessary.

Datasheets

• Make sure you're in SWD mode and not JTAG mode? Basically the processor just isn't responding. You could probably get the same message if your debugger were disconnected from the target! – Daniel May 18 '16 at 5:14
• Hi. The linux utility does not seem to allow selection between JTAG and SWD, but as you can see from the output it might be trying both? I tried the windows utility again and made sure the Port was set to SWD mode, I also tried the various frequencies. I've added the windows utility trace.log if that helps diagnose the isue. – user3011601 May 18 '16 at 5:44
• Do you have UART wired? You can try with serial bootloader GUI demo from ST. – Marko Buršič May 18 '16 at 9:00
• Try reducing the SWD frequency. It looks like its not making any connection with the target hardware - IDCODE is the first thing that needs to be read to establish the connection, everything before that shows that the probe hardware seems to be talking fine. Check you get clock and data activity on the SWD lines too. Data is bi-directional, but always starts with some bits sent from the probe. – Sean Houlihane May 18 '16 at 13:39
• Have a look in the datasheet, the swd pins need a pull-up or pull-down resistor. – rfkortekaas May 19 '16 at 17:28