[Surya Chilukuri] writes in to share JTAGprobe — a fork of the official Raspberry Pi debugprobe firmware that lets you use the low-cost microcontroller development board for JTAG and SWD debugging just by flashing the provided firmware image.
We’ve seen similar projects in the past, but they’ve required some additional code running on the computer to bridge the gap between the Pico and your debugging software of choice. But [Surya] says this project works out of the box with common tools such as OpenOCD and pyOCD.
As we’ve cautioned previously, remember that the Pi Pico is only a 3.3 V device. JTAG and SWD don’t have set voltages, so in the wild you could run into logic levels from 1.2 V all the way to 5.5 V. While being able to use a bare Pico as a debugger is a neat trick, adding in a level shifter would be a wise precaution.
Looking to get even more use out of those Pi Picos you’ve got in the parts bin? How about using it to sniff USB?
Very cool project, I’ll give this a go
I’ve been trying to interface a JLINK debugger with python for some automated flashing and testing (and probably remote access) but for whatever reason, I couldn’t get mine to work.
Its a chinese clone, I suspect that’s the reason
I don’t understand what so special about it. I use SWO with the RP2040 for 1-2years without a problem.
I use a J-Link. But it should not be to old because the older J-Link hardware did not work with dualcore MCUs
They are using an RP2040 instead of J-Link hardware to debug something else.
I would not look at anything with USB slower than 2.0 to implement a JTAG probe.
I’d basically agree although that’s probably a tool limitation. For arbitrary actions JTAG requires 3x bits per cycle (2 tx, one rx) and for a half duplex protocol like USB that means the best you could possibly do is a few Mbps.
But most of the time large transactions don’t need TMS and they aren’t actually bidirectional (e.g. downloads or readbacks) and so if the tools are smart you could push that higher.
It’s not like JTAG can reasonably get above tens of Mbps (bits not bytes) so you could have a reasonable probe at 12 Mbps, but no one’s going to optimize it for that.
“As we’ve cautioned previously, remember that the Pi Pico is only a 3.3 V device. JTAG and SWD don’t have set voltages, so in the wild you could run into logic levels from 1.2 V all the way to 5.5 V. While being able to use a bare Pico as a debugger is a neat trick, adding in a level shifter would be a wise precaution.”
Just add a level translator. Period. Use something like a ‘4T774. They’re like 50 cents. Do it. Don’t think about it. Even if it’s the same voltage.
The issue isn’t just voltage translation. When you’ve got a debugging tool, you frequently turn off the device you’re working with and leave the debugging tool plugged in or on. If you’re directly connecting the device, that attempts to back power the device through its JTAG pins.
This absolutely 100% can damage some devices. This isn’t “maybe it’s bad,” it definitely happens (and trust me it sucks when it’s a $5K+ device). If you put serial resistors inline it’ll help, but it’s just not worth thinking about it. Just use a ‘4T774. Buffers like the ‘4T774 isolate each side, so if one side is unpowered, the other side is high-impedance. They don’t just put those buffers there for voltage translation.
thanks! nice chip. this is why i read the comments before reading the post or watching the video.
also at least route the direction pins in such a way that you can cut their traces and reroute it for when you inevitably screw them up
ask me how I know
JTAG/SWD is nothing special, especially since ST-Link can essentially self-debug with another ST-Link chip even of the same kind. Most debuggers are cheap STM32.
Not to sound unnecessarily negative, but why not add SWIM? If that is even possible for the RP. SWIM is NOT SWD, SWIM is more complex.
There are guides online how to add SWIM pins on those Chinese copies of the USB dongles, but I have poor motor skills with age and I cannot solder directly to chip pins anymore.