JTAG Hat Turns Raspberry Pi Into A Networked Debugger

Over the last year or so we’ve noticed a definite uptick in the number of folks using OpenOCD on the Raspberry Pi. It’s a cheap and convenient solution for poking around with various microcontrollers and embedded devices, but not always the most elegant. Looking to improve on the situation somewhat, [Matthew Mets] has been working on a purpose-built JTAG Hat to clean things up a bit.

Onboard level shifters allow you connect to JTAG and SWD interfaces from 1.8 to 5 V, and if you power the target device from the Pi itself, there’s even support for measuring the voltage and current. To connect up to your target, the open hardware board features a “legacy” pin header perfect for jumper wires, as well as a dedicated 10-pin Cortex Debug Connector. Whether you spin up your own or buy one assembled, it certainly looks like a tool worth having around if you often find yourself working with the appropriate chips.

In addition to the design files for the hardware, [Matthew] has also provided some nice documentation on how to get the software side of things up and running. Starting with a blank SD card, it walks you through the initial setup of the Raspberry Pi all the way through the installation and configuration of a patched version of OpenOCD designed to support the JTAG Hat.

If you spend more time working with 8-bit AVR chips, don’t worry. Last year we covered a similar project to turn everyone’s favorite Linux SBC into an all-in-one microcontroller development powerhouse.

7 thoughts on “JTAG Hat Turns Raspberry Pi Into A Networked Debugger

  1. OpenOCD is versatile but is bloated by the TCL scripts architecture, different for every target families. Also the reset handling framework is unable to reliably work ultra deep sleep of some targets and maintainers are not constructive at solving that problem even when patches was designed openly with them and test setup access provided to them.

    So I give up and started to use Blackmagic instead https://github.com/blacksphere/blackmagic I hope that this project will continue to evolve with a sane architecture.

    1. I guess experiences will vary a lot by target. With STM32, I haven’t had trouble with openocd’s reset even with low power modes, it works fine with both NRST pin and with the DBGMCU disabling of sleeps while debugging. But on the other hand I’ve had trouble (years back) with blackmagic probe messing up flashing STM32F427, causing weird bugs when a single part of code was corrupted (and it didn’t seem to verify by default). For some other device it could be totally different.

    1. That only covers actually connecting and talking to the MCU; when you want to write to flash or deal with security settings the driver still needs custom code to do that. OpenOCD/Blackmagic/JLink et al have explicit support for a bunch of different chip familiies but it’s by no means complete.

  2. Nice .. I have been using a pi running openocd to various jlink/stm/jtag debuggers that I can then access via VPN to debug expensive targets remotely… There’s no way I could have brought the equipment home, their too big and expensive .. this allowed me to keep working through the lockdowns … This project looks like a nice clean way to deal with this 👍

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

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