Skip to main content
ian239955
Associate III
July 15, 2013
Question

f4 discovery, SWD / ST-Link

  • July 15, 2013
  • 9 replies
  • 2064 views
Posted on July 15, 2013 at 12:25

Hi, the f4 discovery works great with on-board st-link, but for my target I would like to use the 6 pin SWD interface, not the 20 pin interface, and external st-link. By reference to information I have found so far I have made a 20 to 6 pin adapter like this:

20 pin  6 pin

3          5 (TRST)

6          3 (GND)

7          4 (SWDIO)

9          2 (SWCLK)

13        6 (SWO)

So I removed the 2 links on CN3 and plugged the external st-link to the f4 discovery through this adapter but it does not work (cpu not found). Can anyone tell me where I went wrong or where I can find full information on this?

Thanks.

    This topic has been closed for replies.

    9 replies

    Tesla DeLorean
    Guru
    July 15, 2013
    Posted on July 15, 2013 at 14:57

    Check the target is powered, and the ST-Link is configured to use SWD

    Check the solder bridges related to the RESET and SWO

    Check the target is running, can use USART1/3 or USB with BOOT0=High
    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    ian239955
    ian239955Author
    Associate III
    July 15, 2013
    Posted on July 15, 2013 at 15:57

    Thanks for that, target is powered, external st-link is set to run SWD - (in fact, I'm using exactly all the same settings as I use for on board st-link which works fine)

    SB11 (SWO) and SB12 (NRST) are linked

    Target is running, the project uses USART 2, 3 and USB but not USART1. 

    I was thinking that everything should work with very little change, all I'm effectively doing is using standalone st-link over SWD instead of the SWD on the f4 discovery.

    Does my adapter wiring look right? Surely there must be an app note on using SWD from an ST-LINK? Haven't been able to find anything.

    Thanks

    Tesla DeLorean
    Guru
    July 15, 2013
    Posted on July 15, 2013 at 16:58

    I'd be connecting the Target Reset on pin 15

    http://support.code-red-tech.com/CodeRedWiki/HardwareDebugConnections

    There is still a bunch of opportunity to screw up the connector by wiring it mirrored/backward, or by using linear pin numbering instead of interleaved.

    With USB you should be able to show signs-of-life via a DFU device being found.  USB will require an external crystal. Easier perhaps is using the Flash Demonstrator via USART1 or 3, sending an 0x7F character at 9600 8E1 should echo back 0x79 using a terminal application.

    If the target device is not running/powered correctly the JTAG/SWD are not going to be functional. I'd start by confirming the target is functional when BOOT0=High

    SB11 and SB12 should be OFF, you don't want/need these to connected to the on board target, but rather allow them to be connected to your external target.

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    Tesla DeLorean
    Guru
    July 15, 2013
    Posted on July 15, 2013 at 17:14

    Surely there must be an app note on using SWD from an ST-LINK? Haven't been able to find anything.

    Perhaps, I'd have to dig, most of us doing this professional have a couple of JTAG/SWD pods, and don't have to hack things together with wire and string. I build/design boards with standard connectors (20-pin JTAG, or 10-pin SWD) so I don't have to futz with this stuff. Others, like ST, seem to focus on using the minimum number of the pins on the header, and roll their own.

    ARM had a bunch of documentation of the connectors and protocols. These are common across a whole slew of parts.

    ST has documentation for the STM32F4-Discovery, which does go over some of the connector details, and solder bridges.
    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    ian239955
    ian239955Author
    Associate III
    July 16, 2013
    Posted on July 16, 2013 at 11:46

    I might have made a small step forwards. I believe that the SWD connector on the f4 discovery board is an OUTPUT, not an input, i,e. it is intended to use the discovery board as an ST-link for an external f4, not to use an external st-link to program the f4 on the discovery board!

    But I want to be confident that I can program the chip before I design my pcb. So I tried putting the CN3 links on (which connects the on board f4 PA13 and PA14 pins to the onboard st-link and swd connector) and I linked SB10, which I believe should keep the on board st-link reset and it's pins tristated.

    But I still get cpu not found. Has anyone successfully validated programming the f4 on the discovery board through external st-link?

    Thanks

     

    ian239955
    ian239955Author
    Associate III
    July 16, 2013
    Posted on July 16, 2013 at 13:28

    Got it working! Had to also connect the pin 1 of SWD to VDD and connect the pin 1's together, so the st-link sees the target vdd. Of course, as the SWD connector is an output, it only senses VDD, it does not source it.

    Tesla DeLorean
    Guru
    July 16, 2013
    Posted on July 16, 2013 at 14:11

    To get to the F4 on the discovery board you'd want to inject SWDIO/SWCLK via pins on CN3 which would otherwise link to the F1 implementing the ST-LINK

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    Rogers.Gary
    Senior II
    September 10, 2014
    Posted on September 10, 2014 at 04:28

    Clive,

    I have an STM32F4 Discovery board.

    I also have the ST-Link POD with the 20 pin JTAG header.

    I am looking for any information as to how I can connect the ST-Link pod to the Discovery board so I can program and debug that way, not by the USB connection directly to the Discovery PCB. I cannot find anything in an internet search. Or is it that simple that I'm missing something?

    Is it done by connecting:

    Pod JTAG pin 9 to PA14 (JTCK/SWCLK)

    Pod JTAG pin 7 to PA13 (JTMS/SWDIO)

    Pod JTAG pin 1 to Discovery 3V

    Pod JTAG pin 6 to Dicovery GND

    Remove SB11, SB12

    Remove CN3 jumpers

    Rogers.Gary
    Senior II
    September 10, 2014
    Posted on September 10, 2014 at 04:47

    Clive,

    It is now connecting via ST-Link.

    I have a 6 pin connector going to CN2 fom the 20 pin connector.

    I connected it as I described, however, I was missing 2 things:

    1 - Missing 3V to pin 1 of CN2, added that.

    2 - CN3 jumpers must be on.

    However, when using the straight USB mode of ST-Link to the Discovery board, I was able to get printf statements in the Terminal I/O window of IAR EWARM debugger. 

    Now, after connecting and running the application, there is no output. Any idea of why that might be?

    Thanks,

    Gary