STM32F4 Discovery and ULINK2

Last time I was connecting STM32L discovery to the ULINK2. Now it’s time to connect new “beast”.

This very low cost board: ~12€ at farnell_logo.jpg (67×24)Detailed information is available via ST web page. On-board is a STM32F407VGT6 microcontroller. On Board is an ST-LINK/V2 embedded debug tool, two ST MEMS, digital accelerometer and digital microphone, one audio DAC with integrated class D speaker driver, LEDs and push buttons and an USB OTG micro-AB connector. By removing two jumpers ST-LINK could be used to program external microcontroller.

ST-Link V2 is intended for debuging the on-board microcontroller or as debug interface for any external ST cortex MCU. I have ULINK2 Debug Adapter. and I wanted to connect discovery board to ST32F4 MCU.  Unfortunately there’s no direct debug connection to DISCOVERY board, which could allow using external debugging interfaces. Here’s how it can be done:

Take STM32F4-DISCOVERY board and turn it upside down. There are several jumpers (solder bridges) marked with SBxxx. Remove SB5 and SB9. This will disconnect ST/LINK output signals from main MCU avoiding colision with ULINK2 signals:


Complete pdf_icon.gif (16×16) STM32F4_discovery_schematic

Next, solder tiny wires to open solder bridges. Each solder bridge has arrow shape. Connect wires at proper side of the jumpers and to pads, as indicated in this diagram:


Next, solder breadboard with 20 pin header to discovery board and connect wires to proper pins as indicated above. Take care about IDC pin numbering (zig-zag)!

Connect ULINK-2, run uVision, open your favorite STM32F400 project and check the debug window:


And finally, snapshot with webcam (I was holding my DELL above the desk):


  1. cristiano tognetti says:

    I would like to connect my uLink2 to the stm32f4 discovery board, but the picture with the pin numbering is cut there are the arrow, but not the pin number): is it possible to get the full image with the complete numbering?
    Thanks a lot,

  2. Mare says:

    Picture is taken from F4 discovery PDF documentation. Just follow the red numbers. They are ULINK IDC20 connector pin numbers. Connect ULINK IDC pins 1, 4, 7, 9, 13, 15 to the discovery as shown in picture:

    Hope this helps.


  3. cristiano says:

    clear! Thanks a lot!

  4. Piter says:

    the line SWO is needed?
    Thanks a lot,

    • Mare says:

      Not neccessary, only SWDIO and SWCLK are needed, and ofcourse reset. SWO is needed only for the Serial Wire Viewer (SWV), which provides real-time data trace information from the Cortex-M3 device.


  5. Vishal K M says:

    Hello, i program the STM32F4 Discovery using STlink SWD, i am not using Debuging. Is there any problem if i remove SB21–> of SWO ? I need only to program the board and to verify the program, thats all. I dont need debugging.

  6. currystomper says:

    If you cut the links and remove the jumpers on CN3 aren’t the signals you need then available on CN2 and CN3??

    …just a thought


  7. Brian L says:

    An alternative method:-

    Move the soldered links on SB3 and SB7 to SB2 an SB6.

    Then all the debugger signals are available on the headers CN2 and CN3

    CN3 1,2,3,4 = VCC, SWCLK, GND, SWO and CN2 5,6 = RESET and SWO.

    • Mare says:

      Thank you. That’s also good way.

      • Stefan Arnold says:

        Can you attach a picture?
        Is it that way
        SB3#-#——-# # SB2
        SB5#-#——-# # SB4
        SB7#-#——-# # SB6
        SB9#-#——-# # SB8

        SB3#-#——-#-# SB2
        SB5#-#——-# # SB4
        SB7#-#——-#-# SB6
        SB9#-#——-# # SB8

  8. Tilen says:


    Gledam tutorial, za JTAG.
    Ampak po sliki, kjer je Keil konfiguracija, je izbran “SW” pod “Port”.

    Je res potrebno vse to spajkanje za ULINK2 SW? Pri svoji F4-Discovery platki samo odklopim ST-LINK/Discovery 2 jumperja, in zadeva že deluje v SW načinu, če signal pripeljem na SWD 6-pin header.

    • Mare says:

      Gledal sem shemo in šel po shemi. Res pa da nisem poskusil na opisan način. Bom preveril. Hvala za info.

  9. Paul says:

    Hi all, I cannot understand by the picture if the bridge con connectors CN£ are kept connected or not…

  10. Paul says:

    I’m sorry…connector CN3

  11. Mare says:

    In case you would like to use CN3 to connect the Ulink, move the soldered links on SB3 and SB7 to SB2 an SB6. Then you can use CN3 instead of direct contact to pads indicated above.


  12. Paul says:

    In this way I can use SVW too?

  13. DD4DA says:

    Well,i had testet the Discovery board F4 in combination with ULINK2 and Segger J-LINK V8; both in SWD mode and can state following. The Advantage of using an external Programmer/Debugger could just be the upload Speed from the IDE into the MCU. The speed advantage is less as would be expect. To better compare -the original on-board st-link Debugger needs 8 sek for 130Kbyte code,80Kb data and the Debugging symboles before the Debug mode is ready to trace. The J-link and ULINK2 Need just aroung 6 sek for the similar file. This is reasoned by the lower SWD Clock rate of the Build-in ST-Link. I had testet an externel ST-link that supports different SWD-Lock and there Speed in debug upload is similar in this competition. The time Advantage raises if 1Mbyte Code and 128Kbyte Data will be uploaded up to 4 sek.
    There are no other Advantages left, using external Debugging Tools – we would expect the “trace wire” supported Tools.
    If you use external Debugg Tools – beware, there are more Limits available as with using the on-board st-link and all of them are “License” reasoned. The ULINK2 can’t just upload or download a binary/Hex to or from an MPU. No other IDE’s supported as Keil’s IDE. Similar situation if you use Segger’s J-LINK V8 – this supports many other IDE’s but without a “license” for some models (EDU, BASIC), flash-Upload is not supported. If you develop a Software, the IDE supports this via the debug Interface like GDB. If a binary or hex files will be shared and just uploaded, all of external Tools lacks. ULINK2 does’nt supports up/download of shared files generaly. J-LINK Support everything what ever you can do with a MCU, but requires an extra license (FlashDL,JFlash) The EDU variant includes just “FlashBP” and “GDB”.
    Both supports many different brand of MCU.

    The on-board ST-Link supports download, upload, memory manipulation at runtime, swd, sw-trace and Debugging of ST’s MCU’s for no extra payment. In Addition, you can do them on external Hardware using just some wires for the interconnect. If you want to get the flexibility of usage and the UP/DOwnload Speed, a good choice are the native ST-LINK.
    The winner of the compared prices of them are the ST-Link too. Actually you Need to pay around €22.- for an genuine ST-Device. The J-Link “EDU” needs around €50, ULINK2 near €350.
    Well, I guess that ST put’s many Money into the Marketing of there ARM Cortex MCU brand and Releases very potent developing boards like the discovery or Cube board series. A Cortex M4F 200Mhz, SDRAM and embedded TFT-Controller that drives an on-board TFT, debug Interface and something more for just €27.- !!!This is very spectacular and not comparable to others this time in Price and functionality.
    You are just limited to use ST-Controllers – well, does’nt matters. They offers a couple of modern Controllers for less Price than other – don’t Need others. Commercial Projects Needs a Commercial Budget and they uses “Lauterbach” Tools or such things with a very Commercial Price for licenses and Hardware – they can pay the fee for licenses and Hardware to save time and get more Speed and flexibility in usage.
    I am a Radio Amateur that just wanna develop my own small additional circuits as a part of my Hobby.
    All of this experiences where won as i had rescue two f4 Disco boards where the on-board JTAG MPU where unfortunatly died and replaced by empty new MCU’s. The upload of the bin-Firmware was successfully done by using an other STM32F4Disco’s externl SWD-Interface. All other external Adapters where available lacks.
    Now you can decide where the (dis)advantages are by using an external programmer with a Disco board.

    conclusion : I can’t recomment using it.

  14. Thomas says:

    I do not understand for what is the SWD Connector on the Discovery Boards? Why its not possible to connect a SWD debugger like Ulink2 direct to this port??