cancel
Showing results for 
Search instead for 
Did you mean: 

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

harrison
Associate II
Posted on May 23, 2016 at 10:28

Circuit Diagram

http://i.stack.imgur.com/0cqvh.png

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 have Boot0 set to 1 and Boot1 set to 0, which should start the System Memory which contains the bootloader (AN4488), but I don't think it matters what is selected for SWD to work.

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

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 causing the problem?  
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

#swd #stm32f411rc #st-link #stm32
5 REPLIES 5
mark239955_stm1
Associate II
Posted on May 23, 2016 at 10:46

Leaving aside SWD connectivity in the first instance, and leaving the STlink disconnected, does the MCU boot up successfully in DFU mode and enumerate as a DFU device?

[edit] Looking at your circuit diagram, it is possible that you haven't actually connected the USB D+/- pins or Vusb or an XTAL, but all of that should be correctable?

harrison
Associate II
Posted on May 23, 2016 at 11:11

Hi.

I was following the reference design on (

http://www.st.com/content/ccc/resource/technical/document/application_note/76/f9/c8/10/8a/33/4b/f0/DM00115714.pdf/files/DM00115714.pdf/jcr:content/translations/en.DM00115714.pdf

) which went straight to SWD first.

It's all wired up on a wire-wrap board,

http://imgur.com/a/IYyV8

, so I can indeed easily change anything.

It seems like DFU mode needs a HSE connected first (

http://www.st.com/content/ccc/resource/technical/document/application_note/b9/9b/16/3a/12/1e/40/0c/CD00167594.pdf/files/CD00167594.pdf/jcr:content/translations/en.CD00167594.pdf

), I can have a go at wiring up the HSE and USB D+/D- if you think DFU might work. Though I thought getting SWD working first using the HSI would allow me to verify the board is working before trying to wire up the HSE.

Thanks.

Posted on May 23, 2016 at 17:44

Not sure how the 20-pin JTAG is manifested on your board, but the schematic version looks mirrored. ie Pin 1 should be physically top left looking from above.

http://www.keil.com/support/man/docs/mcbtmpm330/mcbtmpm330_to_jtag.htm

The System Loader via USART1 PA9/PA10 is an alternate signs-of-life indicator

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
harrison
Associate II
Posted on May 24, 2016 at 01:17

Hi.

The ST-Link/V2 output is indeed like you have sown (confirmed on

http://www.st.com/content/ccc/resource/technical/document/user_manual/65/e0/44/72/9e/34/41/8d/DM00026748.pdf/files/DM00026748.pdf/jcr:content/translations/en.DM00026748.pdf

). Though I believe the connectors end up mirrored on ribbon cables, e.g: 

https://i.ytimg.com/vi/_ggJXbe885U/maxresdefault.jpg

, you can follow the red stripe to find pin 1.

I might have a go using my own wire from the ST-Link/V2 to the board, and leave out the ribbon cable and see if that helps.

Ok. I'll order a USB UART adaptor and see how that goes when it arrives.

Thanks.

harrison
Associate II
Posted on May 24, 2016 at 10:00

Hi.

I got a FT232 USB to Serial today.

I am able to successfully connect to the chip. At least I think successfully as the STM Flash Loader Demonstrator only succeeds (shows ''Target is readable.'') when I have the boot pins set to System Memory.

However when I click next the only targets in the dropdown list are ''STM32F4_11_512K'' however my chip is 256K, so I don't expect flashing the chip with a bin/hex will work because the memory map is different, right? 

http://i.imgur.com/Zu2c57K.png

I tried SWD after connecting with UART, however SWD still does not detect.