JTAG Programming With Pi!

The Raspberry Pi has so many uses it’s getting ridiculous. Add another one to that list — OpenOCD supports JTAG programming and debugging using Pi GPIO! While you can wire things up manually, having this nicely laid out JTAG hat makes things easier. You can directly plug in a 6-pin header, or connect jumpers directly to the labelled pins. You can also change the voltage level to 3.3V or 5V easily. The board uses voltage buffer transistors to safely interface with devices that have I/O voltages from 1.65V up to 5.5V.

JTAG is a great way to program and debug FPGAs, CPLDs, and many microcontroller families including all ARM Cortex devices. OpenOCD, xc3sprog and UrJTAG are all supported. Once connected, typically you use something like arm-none-eabi-gdb to interface to the target processor. GDB allows extremely fine control over the processor. You can easily examine any part of memory, program the flash, change registers, single-step the processor, use breakpoints and watch variables, and much more. GDB is a fantastic tool, but it does take a bit of practice to use effectively. Many IDEs have built-in support for GDB and can make using it a bit easier.

The mounting hardware isn’t included, but because this board uses the standard HAT layout, all you need are a few M2.5 screws and 11mm spacers. The HAT is compatible with all 40-pin Raspberry Pi devices, but technically I think it would also work on the older 26-pin devices without any issues (though the 40-pin header might get in the way). I still use and treasure my original Model B so I like to see if modern boards still work with the old hardware!

If you’re into embedded development, grab one of these boards as a backup to or instead of your typical JTAG probes like the Segger J-LINK. Use what you already have for a whole new purpose! Now that’s the hacker mindset.

Source