Tuesday, November 26, 2024

JTAG to SWD Converter

Readers: If you'd like to build the project featured in today's post, please go to PCBWAY's Community pages--gerber file, KiCAD files and a B.O.M. are here.  

You can also help out this site immensely by checking out PCBWAY using the link here. Thanks!

===== 

Hello again:

Another simple one!  

I use GDB to debug C based embedded system projects--I am currently using a Segger J-Link EDU debugger with a JTAG interface:

Segger J-link EDU Mini

But! The development board I am currently debugging is a Raspberry Pi PICO that has an SWD interface:



JTAG is not difficult to turn into SWD, it's a "connect this pin to that pin" challenge.

However I got tired of fiddling with tiny fragile adapter cables so I whipped up a simple JTAG to SWD PCB, the focus of this post.

 


REQUIREMENTS

The J-Link EDU Mini's JTAG interface uses a 2x5 pin 50 mil pin header--1.27mm --extremely small--conforming to the "Coresight 10" JTAG pin specification



The Pico uses 3 x 100mil SWD pins for SWCLK, SWDIO (data), and ground:



The Segger J-Link EDU board also requires a 5V reference....there were may ways I could have gotten 5 volts to the adapter PCB, from a USB cable for instance? Or a battery? 

However I used wirepads and 22 gauge solid wire and connected a bench power supply for 5V; I may rethink this design choice down the road. 


DESIGN AND LAYOUT

Simplicity itself....took me maybe an hour to lay out the PCB in KICAD, very little thought went into design, perhaps it shows?


Did a very quick 3D check in KICAD....good enough? Sure. Off the gerbers went to PCBWAY.



BUILDING/TESTING:


PCB's are back! Happiness is new PCB's from this blog's sponsor. Please help this blog by checking them out.


Easy build. The SMD JTAG 2x5 connector was pretty small but I managed to solder it without needing my microscope.

For the Pico I used a 3 pin JST connector:

The more JST connectors I use the happier I get, they are inexpensive and extremely reliable. You can get them for next to nothing from Tayda.


To test I coded a simple C proof of concept program: "PrintRTT", which used the adapter board to bring printf() statements from the PICO to a Segger J-Link and then to my Linux system. 

Wired it up:
Pico needs power as well--use USB and/or 6V-9V and GND to pins 39 and 38. 



Worked--I dragged the UF2 file to my Pico and ran the Segger "JlinkRTTViewerExe" terminal app on my Linux virtual machine..

You can get the code from Github here

Instructions for using the Segger printf() overload and the Segger RTT app are covered in latter half of the post here and the Segger page here.

Adapter with a "stock" Pico....the red and black gator wires are 5V and GND from a bench power supply, needed to provide the JLINK with its 5V reference.

And to debug the rotary encoder experimenter's board....

The adapter board was a piece of cake and worked first time. Viola! No more fiddling with tiny fragile SWD cabling. 

I had a few ideas for improvements: clarifying the silkscreens and adding more diode protection.

But for now it's time to move on.  

I remain extremely happy with the Segger J-link Mini EDU. There are other PICO/RP2040 GDB debug options  (DIY "PicoProbe" and the offering here) but to me the Segger offers a good mix of simplicity, value, and useful software tools for a Linux-based toolchain.  

That said....I'm feeling a little tired of crafting embedded RP2040 projects and might fabricate a few analog EFM based circuits (will it work? it effectively frigging might?) in the next few weeks, a distraction.

And some analog design.  

Wait, analog? Math, breadboards, smoked parts. Sure, why not? Until then: don't breathe the fumes! 


 

No comments:

Post a Comment

JTAG to SWD Converter

Readers: If you'd like to build the project featured in today's post, please go to PCBWAY's Community pages--gerber file, KiCAD ...