1

Circuit Diagram

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: stlink current mode: debug (jtag or swd)
2016-05-18T12:50:58 DEBUG src/stlink-common.c: stlink current mode: debug (jtag or swd)
2016-05-18T12:50:58 DEBUG src/stlink-common.c: *** looking up stlink version
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: stlink pid     = 0x3748
2016-05-18T12:50:58 DEBUG src/stlink-common.c: stlink version = 0x2
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 INFO src/stlink-common.c: Loading device parameters....
2016-05-18T12:50:58 DEBUG src/stlink-common.c: *** stlink_core_id ***
2016-05-18T12:50:58 DEBUG src/stlink-common.c: core_id = 0x00000000
2016-05-18T12:50:58 DEBUG src/stlink-common.c: *** stlink_read_debug32 0 is 0xe0042000
2016-05-18T12:50:58 DEBUG src/stlink-common.c: *** stlink_read_debug32 0 is 0x40015800
2016-05-18T12:50:58 WARN src/stlink-common.c: unknown chip id! 0
2016-05-18T12:50:58 DEBUG src/stlink-common.c: *** stlink_close ***

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
STLinkUSBDriver.dll loaded
ST-Link/V2 device detected
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
ST-Link/V2 device detected
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
ST-Link/V2 device detected
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 https://i.stack.imgur.com/CiwdH.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

user3011601
  • 23
  • 1
  • 6
  • 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 05: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 05:44
  • Do you have UART wired? You can try with serial bootloader GUI demo from ST. – Marko Buršič May 18 '16 at 09: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
  • Thanks for the idea Sean, I tried all the other frequencies and they don't help make a connection, what hardware would I need to test if data is being sent on the lines?. Thanks for the idea rfkortekaas however the SWD pins are internally pulled down/up as required, I wonder if leaving all the other pins as floating could be causing an issue though? Thanks for the idea Marko, i'll have a go at wiring up UART and seeing how that goes. – user3011601 May 20 '16 at 03:37
  • Is your device powered. I see that you used the shield and not pin 5 of the USB in the schematic, is that correct? – rfkortekaas May 24 '16 at 15:53
  • Yes it is. I used the ground symbol to reference everything going to ground, and on the USB pin 5 i put "GND_OUT" label. I have a LED after my voltage regulator to tell if the power gets through, and I have measured the pins on the MCU with a multimeter and they are indeed powered. Thanks. – user3011601 May 24 '16 at 23:05
  • Try a pull-up resistor on the NRST line, along with a 100nF capacitor to ground to avoid noisy signals resetting the chip. – Pål-Kristian Engstad May 25 '16 at 05:09
  • Also, connect a 100M resistor and 1uF capacitor between shield and USB pin 5. Usually, shield is floating and the pin is ground. Many devices let the shield completely afloat. – Pål-Kristian Engstad May 25 '16 at 05:13
  • Have you tried looking at RM0383 Reference manual? Section 23.3.1 It says that you have to start with Jtag, then move into SWD. Could you try that and get back with whether that works? – Dave Apr 03 '17 at 10:29
  • @Dave - that is a misreading. There is no need to "start with JTAG", *only* the SWD signals and a ground reference are required. Likely the first sequence sent makes the method used clear to the state machine. – Chris Stratton Oct 23 '17 at 00:20
  • I actually had an issue with the ST Link and an STM32F4 just this past week. Very intermittent connections which turned out to be a ground loop with my serial to USB connection. If you have the UART and the SWD both connected to your computer, try removing the UART lines. – scld Oct 23 '17 at 00:43

1 Answers1

-3

You must separate pin VDDA (analog) from pins VDD (digital). You need to use L (inductor or SMD ferrite bead) and C (capacitor) between VDDA and VDD pins. Capacitor must be as close as possible to pin VDDA. Or use second LDO for only VDDA and VSSA pins.

Milos
  • 1
  • 5
    **This is false and misleading**. Such separation is required *only* if one wants low noise on the analog parts. It has nothing to do with the SWD interface not working. – Chris Stratton Oct 23 '17 at 00:10