Creating an SWD Adapter for STM32 Development Boards (Part 1)

Nearly every development board comes with a built-in programing tool. Depending on the vendor, it may be PE Micro, SEGGER J-Link OB or even the vendor’s own tool such as an ST-Link. In most cases, the on-board programmer is rather limited in its capabilities and it makes a lot of sense to use an external programmer. Connecting a programmer often requires using jumper wires from the programmer to the development board which can lead to wrong wiring, wires falling off or even a rats nest of wires as you can see in the image below:

One day while I was talking with Aaron Bauch, the U.S. East Coast FAE for IAR, he mentioned how he created a board to adapt his I-Jet programmers JTAG/SWD connection to the 6-pin, single row connection that ST Microelectronics puts on most of their boards. I thought this was a great idea but unfortunately Aaron was not able to share his board or design. So in this post, I will walk you through how you can create your own adapter.

The first step in the process was to pick a development board that has the 6-pin connector on it. I happen to be using a STM32F429I-Disco board in several of my courses so this board was a prime candidate. Since this adapter board is very simple and nothing more than routing tracing from one set of pins to the next, I decided to fire up Altium and create a SWDAdapter project with a single schematic sheet.

It’s necessary to always start somewhere and I felt that looking at the 6-pin SWD connector on the development board was a good place to start. Just from looking at the connector, I could tell that it was a 1×6, .100 break-a-way header. A standard connector that I’ve seen a million times. I dropped one from my part library onto the schematic. At this time I also opened up the user manual for the STM32F429I-Disco board and searched through the document for the page that described the SWD header. I found the following table that describes what each pin does:

From a quick look through this table do you notice any problems? I’ll give you a hint, look at pin 1 …. it’s VDD_Target, that is the VDD from the application. This pin is NOT providing the target power for a programmer to detect but instead acting as the sense line for the built-in ST-Link! This means that these pins were actually designed to program parts not on the development board!

If we are going to create an external programmer adapter, the adapter is also going to need a way to sense the microcontroller voltage. Since VCC isn’t on the 6-pin connector, I decided I would add another two-pin connector to the adapter. This would provide me with an unused pin and then also a way to jumper the MCU VCC to the external programmer. Not an ideal solution but far cleaner than jumping 6 wires. In order to make sure that I did not forget the pin-outs or that pin 1 would be unused, I copied the pin-out table and pasted it onto my schematic sheet.

At this point, the only investigation left was to figure out the pin-outs on my J-Trace Pro for ARM Cortex-M processors. I found the datasheet for the programmer and then added a 2×5 standard .100 connector to my schematic and again pasted a copy of the pin-outs. You may be wondering why I would use a 10-pin header instead of the 20-pin that is in the first image. The reason I did this is that I have a 20-pin to 10-pin adapter and using this smaller size would allow me to keep my PCB small.

With all the connectors now on-board, I took a few minutes to wire all the connections. When putting together schematics, there are several recommendations that I always like to follow. These include:

  • Leaving lots of comments so that I can remember why I did things
  • Labeling each net with a signal description that is easily recognized
  • Auto designate the parts
  • Mark any unused pins with the No ERC symbol

The result was the following schematic:

The result, as you can see, is nice and straight forward and easy to read. The next step is to develop the PCB and then do a little analysis on what it will cost to build these simple adapter boards. (Something that should have been done first, rather than later). Since that will take some time, we will save that for Part 2 at a later date.

Share >

4 thoughts on “Creating an SWD Adapter for STM32 Development Boards (Part 1)

    • You’re welcome! I’m planning a Part 3 once all the parts come in and I verify that it actually works. At that time I’ll also post the gerbers and files for anyone that wants to have at it!

  1. Thanks Jacob for mentioning IAR’s adapter board. It is available from IAR to enable use of the rich debug signals on the SWO line for ST’s discovery and Nucleo boards, with IAR’s C-Spy Debugger and the Timeline feature.

    Contact your local IAR salesperson, the part number is ADA-MIPI20-STSWD6.

    • Thanks for letting us know! When we talked last I didn’t realize that it was something I could purchase from IAR otherwise I would have done so!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.