This article provides information about JTAG interface and describes how to create simple working device. This interface is original design of Aquaticus ROV team. Since 2006 it became quite popular among hobbyists thanks to its simplicity and usability.
The interface is compatible with every software that supports JTAG ICE, it works perfectly with AVR Studio and Linux tools. You can program the AVR chip using JTAG interface, but you can not consider this interface as replacement for AVR ISP or any other AVR programmer.
Any new Atmel firmware can be upgraded directly form AVR Studio.
List of supported Atmel micro controllers:
Info The above list is the same for all JTAG ICE clones.
Once Atmel published schematics of their JTAG interface for AVR processors (JTAG ICE), you just had to develop PCB board and program it, but… original Atmel AVR JTAG interface is quite complicated – contains antistatic protection, support for wide range of voltages on target device, contains advanced power supply, etc. For amateur purposes it can be simplified which allows it to fit on a quite small PCB board.
At the end you can find all files needed to create your own PCB.
What’s JTAG and how it works?
Simply, JTAG interface allows you to look inside a processor and see what’s going on there - read registers, alter memory, etc. You can read more about on Wikipedia JTAG article. Atmel AVR JTAG contains some extensions to original JTAG which allows it to program internal memories (FLASH, EEPROM).
Communication between PC computer and AVR JTAG (also called JTAG ICE) is realized using RS232. Communication between AVR JTAG and target device uses 10 wire cable (there are less than 10 active signals).
Below figure explains it:
Everything is taken care by ATMega16; originally, in Atmel’s application note, there was a different processor, which is actually discontinued, ATMega16 is a 100% replacement for it. You can see also MAX232, which converts voltage levels from TTL to RS232 (PC) standard. Mind that you can use MAX3232, that way your interface will work with lower voltages - 3.3V - additionally some capacitors would have to be exchanged to other values (C3, C4, C5, C6) and C5 connected to ground (not VCC). Mind that there are few versions of MAX3232, capacitor values and connections may differ across different producers (consult datasheet). If you do a 3.3V version don’t forget about proper ATMega16 version (see ATMega16 documentation). The rest consist of resistors, capacitors and 2 LEDs. There’s one jumper; normally pins 2 and 3 should be short circuited, position 1 and 2 is used to update internal firmware of JTAG (this process will be described later).
The interface can be powered from external 5V supply or from AVR JTAG connector - internal switch inside power connector is used to do this.
Please note that you can not replace ATmega16 with ATmega32 chip. Original Atmel firmware have to be modified (interrupt table) to work with ATmega32. This task can be automatized using special bootloader. You can read JTAG ICE Clone for ATMEGA32 thread on AVRFreaks for more info. As ATmega32 is electrically compatible with ATmega16, you can use PCB with ATmeg32 without any modifications, but you must download modified software for ATmega32.
Below AVR JTAG connector pinout - it connects AVR JTAG interface and the target device (2×5 pins, IDC10, 10 wires).
|1||TCK||Output||Test Clock, clock signal from JTAG ICE to target device|
|3||TDO||Input||Test Data Output, data signal from target device to JTAG ICE|
|4||VTREF||Input||Voltage level of target device|
|5||TMS||Output||Test Mode Select, mode select signal from JTAG ICE to target device|
|6||NSRST||Input/Output||Open collector output from JTAG ICE to target device, it is also used as input to detect resets on target device|
|7||VSUPP||Input||Power supply for JTAG ICE. This line is cut off when external power supply is attached (see schematics)|
|8||NTRST||Input/NC||Not connected, reserved for other JTAG devices (JTAG interface reset)|
|9||TDI||Output||Test Data Input, data signal from JTAG ICE to target device|