JTAG over USB

14 Aug 2011

Hi,

We're great fans of the mbed platform at our university and have successfully used it in a 40 student graduate course. As we plan for the next offering this Fall, there is but one feature of the mbed that makes it sub-par compared to other platforms we've used before - JTAG. Yes, we do have LEDs and yes, we do have a great printf interface for debugging, but one of things we would like to teach is run-time debugging. Unfortunately, we have to reach for other platforms at the moment and we'd love to keep things consistently on the mbed.

One of these platforms is the Robovero from Gumstix (which happens to use an LPC1769). The designers have used the FT2232 chip to provide JTAG access over USB. One would use a tool such as OpenOCD to set breakpoints and watches through a gdb or similar interface.

I wonder whether a similar interface can be provided out through the magic chip. I would think that along with the MSC and the CDC profiles, the magic chip could also expose a custom HID endpoint similar to the use provided by FT2232. If there is a clean way to do this from the magic chip, we can volunteer to write the OpenOCD side with your protocol.

Please let us know if this is something doable or whether there is a fundamental technical constraint that would prevent it ?

Thanks,

Zainul Charbiwala

Graduate Student Researcher, Networked and Embedded Systems Lab, UCLA

11 Aug 2011

Hi Zainul,

Great question. The main reasons we've focused on other things is really wanting to see how we can reduce the need to debug (e.g. resue of libraries/abstractions), the lack of wiggler standards (what exactly to implement?!) and the sledgehammer to nut approach of classical debugging (it feels like there could be a better way to make people more productive).

It is a really interesting area, and while we do have some "magic interface" ideas I think actually some of the features of the M3 like monitor debug mode could mean a more hosted debug solution could be more attractive to get the same result. Of course, the upside of that is anyone could implement it on mbed (never quite got around to it myself - perhaps someone wants to have a look :).

Simon

13 Aug 2011

I'm curious how the FT2232 is interfaced to provide JTAG, do you have a schematic?

13 Aug 2011

Figure 1.2 in Dominic Rath's OpenOCD thesis shows a sample schematic of how to use the FT2232 to interface with JTAG devices.

It is not directly applicable to the mbed as it doesn't have the JTAG pins exposed and you would need to disconnect the interface chip from the LPC1768 to gain control of the JTAG bus.

14 Aug 2011

Hi,

I mentioned the FT2232 to point out another device which does the same over a USB end point. I believe the mbed is perfectly suited because the magic chip controls (at least, it seems to) the LPC1768 over JTAG anyway. A little bit of software on that chip would enable the LPC to be controlled from a host when needed, keeping the LPC unencumbered.

While I liked Simon's suggestion of using the monitor debug mode and have spent the last couple of days trying to figure out "software based debugging", I still think the right model for mbed is for an external chip like the magic chip to handle it. Its already present and does a fair bit already to provide a seamless interface to the LPC target, while imposing no software dependencies. This last part is, by far, my most loved mbed feature.

Simon's concern about there not being a wiggler standard is a quite valid. However, de facto implementations like the OpenOCD driver for the FT2232 make me believe that even a proprietary protocol is fine. Adding another protocol to OpenOCD or a similar open tool is not terribly hard, and I'd gladly do it.

Zainul.

14 Aug 2011

I created a Notebook page on how to add a hardware JTAG port here http://mbed.org/users/iva2k/notebook/jtag/. It is probably not accessible to everyone at home (need a microscope to solder to those tiny pins of LPC1768). But it proves that JTAG port can be added.

14 Aug 2011

Amazing work Ilya. Thanks for sharing it.

Zainul.

15 Aug 2011

How is it possible to debug, using the online compiler?

15 Aug 2011

Xtian Xultz wrote:

How is it possible to debug, using the online compiler?

Use offline toolset.

15 Aug 2011

The tools don't *have* to be offline, but that's a thread for later.

Zainul.