De Wikidroids

Return to Aversive/Devguide



The JTAG interface exists on the big AVR micros, and can do quite more than just programming the memory. With JTAG, you can debug the program in real time, set breakpoints, and so on.

Usable HW

You need a JTAG or ISP interface, some examples:

- atmel provides a very nice tool called the AVR dragon, the price is low, and it can do almost everything, with every AVR.

We recommend you to combine it with our new Dragonsive interface board, to connect all the debug and monitoring with only one connector!

- a ATMEL JTAGICE mk I or mk II: a mkII currently costs ~300$ mkII supports the DebugWire interface, for small micros.

- a mkI clone from Olimex: (40$, 50$ for the USB version which is not a mkII)

- a built-yourself mkI clone: This one is with a m163 (hard to find now), but the same HW can work with a m16 (just one jumper more is needed), see here, and here is my tof programmer which is compliant with my i2c robotic standard and is used on Maggie!

Be careful to avoid JTAG MK1 or clones. They do not support any more the new micros.

How to proceed

You need access to the JTAG port of your micro. The pins TCK, TMS, TDI, and TDO need to be free. They can not be used for another purpose. Simply connect these ports to the same named pins of your programming device.

You can then use two softwares : either AVR studio or Winavr under Windows, or avarice under linux.

For interfacing with your programming HW, use avarice (under windows, COM1 is referred as /dev/ttyS0, COM2 as /dev/ttyS1 etc...).

For using the gnu debugger (and the nice GUI, named Insight), you must configure avarice as a server on a free port and tell gdb to connect to this port. This can be done with the Aversive framework (in make config, or make menuconfig):


Then you can start debugging by typing:

make debug

JTAG Daisy Chain programming

Until recently, there was no possibility of using a JTAG chain with the mkI, but Atmel has updated his software now !

For using a daisy chain, you need the latest firmware of your mkI/mkII/clone programmer. Download the latest AVRstudio, and update your programmer.

Then you must know how much devices are before and after your target, and the total number of instruction bits before and after.

A Xilinx 95xx for example, has 8 instruction bits.

For Avarice, you need Avarice v2.5 or higher.

For the eirbot prop V1 or prop V2 card, I use following parameters:

avarice --jtag /dev/ttyS0 -c0,1,0,8

This means "nothing before", and "1 device with 8 instruc bits after".

to easily find the instruction length for a specific device, the easiest way is to find the BSDL file. a BSDL file is a device description issued by the chip manufacturer. this is often neede, so see that you download the description files for your used devices. Example on xc9572.bsd line 209:

attribute INSTRUCTION_LENGTH of XC9572 : entity is 8;

JTAG Daisy Chain : programming the other devices

For programming the xilinx (for example), you will need to feed the xilinx programmer with the AVR BSDL file

Boîte à outils