12
\$\begingroup\$

If so, could one direct me to a site that tells how to do this? I believe I may have found a way, but I am unsure as to whether or not it would work yet (need to find something to test it on).

This question is related to a previous question of mine located here.

In case more background information is needed.

\$\endgroup\$
  • \$\begingroup\$ JBailey I just came across your Question about using arduino to make a JTAG-USB converter and i was wondering how did you make out?\ \$\endgroup\$ – user6626 Nov 18 '11 at 18:11
13
\$\begingroup\$

Yes, it is possible to turn an Arduino into an ARM JTAG adapter.

There are three problems, voltage, speed and drivers.

The Arduino natively runs at 5V. Most ARM microcontrollers are not 5V tolerant on their JTAG pins and require 3.3V. The easiest solution is to run your Arduino at 3.3V, failing that you will need some sort of level conversion (see I2C 3.3 to 5.0 V conversion for ideas).

The Arduino is connected to a PC via a serial link. I doubt it can feasibly go faster than 115200bps, which will make interactive activities like stepping through code in a debugger very slow. But, you'll be able to upload code and reflash devices.

JTAG is a high level protocol, specific to each processor family, which uses a SPI like interface to exchange data. Most JTAG dongles just provide a SPI interface over USB then leave the rest of the work to a PC application. OpenOCD and URJTag are popular choices. You will need a driver in one of these for your Arduino JTAG protocol.

The Bus Pirate is very similar to the Arduino (low speed microcontroller + FTDI chip). It supports JTAG with OpenOCD, so it's certainly possible.

If you use a Teensy/Opendous or other AVR-USB board, you could use eStick-JTAG.

But, for lost cost JTAG, I'd recommend one of the FTDI2232 based dongles. They're cheap and well supported by OpenOCD.

\$\endgroup\$
5
\$\begingroup\$

It's possible but very difficult. I don't like the FTDI based JTAGs, because the FTDI chips are ready made black boxes and one doesn't really learning by using them.

If I wanted to build an USB-JTAG with AVR I'd get one with at least usb full speed support in the chip. Then get the AVR usb stack (c source codes) and look at an usb-to serial example. Since bitbanging over usb is a bad idea (high latency), it needs to be converted to higher level commands that will instruct the MCU to do the bitbanging itself (or use SPI if possible) & return the high level result over usb (complete bytes). But then comes the need of writing drivers for the IDE to support the new JTAG device to debug over it. OpenOCD and URJTag have source code of drivers for many jtag devices, so you`ll need to get and rework one for your newly invented device. See how some people have done similar work: http://code.google.com/p/estick-jtag/

\$\endgroup\$
1
\$\begingroup\$

Look at openocd. The backends are mostly based around the parallel port bit bang approach, I think it goes so far as to change only one bit at a time. It is fairly simple to take what I think they call the dummy backend which is an example. Send whatever write bit command to the arduino, and have it set or clear that bit. When asked to read the input bit then send a command to the arduino to perform that task and return the results.

I have done exactly this with success, but not with an arduino, I had openocd talk from a host into a simulated arm core running in a hdl simulator.

Note that some jtag specs are closed, the cortex-m3 for example is some sort of serialized reduced number of pins jtag which last time I looked was not available without an NDA. that may not matter because openocd takes care of all that for you so long as you are using a jtag interface that openocd supports, the bit banged back end is where your arduino and whatever interface you use to get to/from it come in to play.

As noted already by Joby, you need to be careful with voltages (not all arduino flavors are 5V and not all arm controllers are 3.3 volt) and signal conditioning and grounding and all that stuff. If your target board is powered by a supply that is at a different level compared to what you power your arduino with you could melt something down when you connect the two.

\$\endgroup\$
  • \$\begingroup\$ Note that using a serial (or worse, USB with its packetized transport) interface to proxy bit-banging can be extremely slow. It's much more efficient to have the microcontroller perform complete operations and communicate with it at a higher level, ie, tell it to read this register, write that one, or even program this block of data. \$\endgroup\$ – Chris Stratton Nov 19 '11 at 6:39
1
\$\begingroup\$

It is possible, and I actually implemented it and explained all here.

There is a library on github here that consists of two parts: the program that runs on arduino and a python script that sends XSVF files to the arduino.

You will most likely need a few resistors to convert 5 V to 3.3 V, as most FPGAs and CPLDs use this voltage level.

I also did some experiences writing an assembler/disassembler for XSVF files, the code is in the same github library and is explained in this post here.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.