Using a JTAG ICE with the STK500
Many people start out with AVR microcontrollers by buying the Atmel STK500. It is not too costly and comes with many essential features (an in-system programmer) and accessories (cables, etc.). It supports a large number of AVR chips, including the ATmega16, ATmega32 and ATmega162, which have JTAG On-Chip Debug (OCD) capability.
However, the STK500 does not incorporate a JTAG connector.
This is not a serious problem for anyone with some 0.1 inch pitch headers, hookup wire, a soldering iron, the STK500 User Guide and a couple of quiet hours for some work requiring concentration. It is even less of a problem for anyone with the ECROS Technology STK500 JTAG Adapter. For a modest cost, you get a neat little printed circuit board and a couple of headers. When assembled, the adapter plugs into the EXPAND0 socket of the STK500 and presents a header ready to connect your JTAG ICE.
The photograph at left shows the adapter in use on the STK500 with the ECROS Technology AVR ICE-Cube, but it can be used with other JTAG ICE interfaces too, including the Atmel one. Click on the photograph for a larger version.
You can see that the target microcontroller in the photograph is the ATmega16. The ATmega16 and ATmega32 have their JTAG interface on ports PC2 to PC5 and the same adapter works with both. A different adapter is required for the ATmega162 because it has its JTAG interface on PC4 to PC7. Be sure to order the right adapter for your intended microcontroller, or order both to be sure.
The ECROS Technology JTAG adapters plug into the EXPAND0 socket of the STK500. Obviously it is important to plug the adapter into the socket in the right place. For the ATmega16/32 adapter, there should be seven pairs of holes on the side towards the power switch (the top of the photograph above) and six pairs on the side towards the LED and pushbutton switch banks (the bottom in the photograph). To help you remember this, the adapter silk screen is marked with pin numbers 15 and 27 that apply to the STK500's EXPAND0 socket. Pins 1 to 14 come before pin 15, so count seven pairs of holes from the pin 1 end to find the hole pin 15 of the adapter goes into. There is also a small white rectangle on the adapter that lines up with a capacitor on the STK500, but please check this before relying on it as Atmel may have made changes to the board layout between revisions. The ATmega162 adapter is shorter by one pair of pins so there are seven pairs of holes on each side. Pin 15 is marked and the instructions above apply but there was no room to mark pin 25 at the other end.
If you have both adapters and get them mixed up, just count the number of pins on the larger header. The ATmega16/32 adapter has 14 and the ATmega162 adapter only 12.
Both the ATmega16 and ATmega32 microcontrollers must be inserted into socket SCKT3100A3 of the STK500 (color RED, number 3). Please also refer to the STK500 User Guide.
The ATmega162 must be inserted into socket SCKT3000D3 of the STK500 (also color RED, number 3). Again, please refer to the STK500 User Guide.
The JTAG Adapter connects power from the STK500 to pin 7 of the 10-pin JTAG header. If you do not want power to be supplied to your JTAG ICE interface, remove pin 7 of the JTAG header before assembling the adapter or cut it off if the adapter is assembled.