JTAG Hat for Raspberry Pi eases debugging with OpenOCD

Low-level debugging can be performed with a JTAG debugger and OpenOCD open-source software, but since not everybody may have a JTAG debugger at home, some have reverted to using the Raspberry Pi as a JTAG debugger, and you’ll find instructions for cabling and installing the software on the Internet.

Matt Mets of BlinkinLabs have been using the Raspberry Pi SBC and OpenOCD to debug Arm-based microcontroller boards for a while, but found it to be a pain to find jumper wires and look up the pin-outs manually each time. So he designed a JTAG Hat with properly labeled 20-pin .1″ and 1.27mm Cortex debug connectors to speed up the process.

JTAG Hat for Raspberry Pi

The expansion board also adds level-shifting buffers to interface with targets running at 1.8-5V, transistor-based power reset pins, a power switch for optionally supplying 3.3V to the target, a voltage/current sensor for measuring the target power consumption, and a buffered serial connection for communicating with the target using the Pi.

All that makes the JTAG Hat for Raspberry Pi suitable to support debugging devices with either a JTAG (TCK/TMS/TDI/TDO) or SWD (SWDIO/SWDCLK) programming interface which includes most of STM32, ESP32, ESP8266, etc.. boards. You’ll find the instructions to get started with the JTAG Hat and OpenOCD on Github, where you’ll also download the (PNG) schematics and Altium design files.

JTAG Hat Raspberry Pi Arm Cortex JTAG Connector
JTAG Hat with Raspberry Pi and Arm Cortex debug cable

JTAG Hat is sold fully assembled and tested for 22 Euros on BlinkinLabs store together with Nylon standoffs and screws to attach the hat to a Rasbperrry Pi.

Share this:
FacebookTwitterHacker NewsSlashdotRedditLinkedInPinterestFlipboardMeWeLineEmailShare

Support CNX Software! Donate via cryptocurrencies or become a Patron on Patreon

ROCK Pi 4C Plus

7 Replies to “JTAG Hat for Raspberry Pi eases debugging with OpenOCD”

  1. I used to use a Beaglebone Black as an OpenOCD machine, which I found pretty convenient and fast (and much better in every aspect than the old dirty solutions like hacking a parallel port). I agree that having a board featuring the various connectors with the proper pinouts is even better!

    1. It’s roughly similar to a bus blaster, except that OpenOCD is running entirely on the Pi, so you can connect over a network, or embed it into a test rig fairly easily. The Bus Blaster uses an FTDI chip to do the JTAG signalling, where this one uses the Rasberry Pi GPIO; in practice there’s probably not much difference, and they should both support the same targets through OpenOCD. This one does include some extra features that the Bus Blaster doesn’t seem to have (target current measurement, 1.27mm connector for ARM Cortex devices, buffered UART connection).

      The J-Link is a fairly different tool, supports a different set of targets, and my understanding is it’s closed source so you can’t modify it to work with different targets (which is both good and bad). A big difference is that the edu version is not supposed to be used for commercial work, and the non-edu version is a bit more expensive 🙂

      1. The 1.27mm connector isn’t a massive issue. You can get little adapter.

        I’m not sure if measuring the current when powering the target is that useful as we’re talking a few hundred mA that can be source right? If this was combined with a 0-8v configurable power supply that could supply a few amps (enough for most hobby projects) that would be really nice. You could really go to town and have scripts that simulate brown outs and use the JTAG part to work out what would happen.

        Jlink isn’t that different really. It’s a microcontroller and some level shifters. Unless things have changed really recently the jlink driver for OpenOCD still works so you get the same OpenOCD experience. Then if you don’t mind installing closed source stuff you get the jlink software too that can IIRC debug some weird stuff like Renesas RX micros.

  2. There is some support for libgpiod GPIOs in its release candidate version.

    So no more Rpi specific code to tranform your Linux SBC into a JTAG adaptor.

Leave a Reply

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

Khadas VIM4 SBC
Khadas VIM4 SBC