AVR ICE-Cube - Connecting to a Target System
This page discusses connecting your AVR ICE-Cube JTAG interface to a target system. In addition to some general information, five particular target systems that you might own are presented:
- the Atmel STK500 (with the ATmega16, ATmega162 or ATmega32 MCU)
- the Atmel STK501 (with the ATmega64, ATmega128, AT90CAN128, etc., MCU)
- the ECROS Technology Butterfly Carrier (with the ATmega169 MCU)
- the BDMICRO MAVRIC IIB (with the ATmega128 or AT90CAN128 MCU)
- the Progressive Resources Mega128
Adding a JTAG connector to your own target system during design is discussed on a separate page.small current needed by the ICE-Cube for operation. It may work at lower voltages, for example 2.7 volts, but no guarantee is made of this.
The small size and light weight of the AVR ICE-Cube allow it to perch on the JTAG header, taking up no additional bench space. If for any reason you would prefer to rest the ICE-Cube on the bench and connect to your target system with a cable, you can use the cable adapter (shown at right), which is available as an accessory to the ICE-Cube. For a picture of the cable adapter in use with the STK501, see below.
To assemble the cable adapter, insert the two ten-pin headers into the PCB in the positions marked on the silk-screen. Turn it all over on a surface that will not be damaged by heat or the pointed ends of the header. A scrap of cardboard would be fine. From the back of the PCB (the side opposite to the silk-screen) which is now uppermost, solder the headers in place. Only moderate soldering skill is required. You may want to solder one pin, pick up the adapter and inspect the headers for correct alignment, reheat the pin and adjust if necessary and only then solder the remaining nine pins of each header. If you don't need the cable adapter, the headers might come in useful for something else.
Important - the cable adapter connects all like-numbered pins on the two 10-pin headers, but it also connects pins 2 and 10 together and to a ground plane. For this reason, when you're using the cable adapter, you do need to make sure that all connections are the right way round, with pin 1 to pin 1 on both the ICE-Cube and the cable side.
To use the cable adapter, hold it with the pins facing you and pin 1 (marked on the silk-screen) at the top. First, plug the ribbon cable onto the right-hand header with pin one at the top (if there is a stripe on the cable, it will be on the uppermost edge). Next, plug the ICE-Cube onto the left-hand header. Now you can connect the other end of the ribbon cable to the target system and the DB9 of the ICE-Cube to the host system serial port. This should be quite clear if you take a look at the bigger picture of the cable adapter in use with the STK501.
Although the Atmel STK500 supports the ATmega16, ATmega32 and ATmega162 microcontrollers that include JTAG programming and On-Chip Debug (OCD), it does not have a JTAG header. To work with the AVR ICE-Cube on this target system, you can use an ECROS Technology STK500 JTAG Adapter as shown in the picture at right. Click the picture to go to a page giving a complete description of the STK500 JTAG Adapter, including pricing. You can also use any adapter with similar function or make up your own using information in the STK500 User Guide. Use the cable adapter if you prefer to rest the ICE-Cube on the bench rather than have it perch on the adapter header as shown.
Important - There are two STK500 JTAG Adapters, one for the ATmega16/32 and one for the ATmega162. This is because the ATmega162 pins out the JTAG interface on different port bits from the ATmega16 and ATmega32. Make sure you pick the right one!
The Atmel STK501 is an add-on board for the STK500 supporting 68-pin microcontrollers such as the ATmega64 and ATmega128. These devices include support for JTAG programming and On-Chip Debug. The STK501 incorporates a JTAG header. It is clearly marked "JTAG" on the silkscreen. Refer also to the Atmel STK501 User Guide.
To connect the ICE-Cube to the STK501, simply plug it onto the JTAG header, making sure to line up pin 1. The ICE-Cube will sit over the top of the STK501 in an area that is empty and uninteresting (as the board is delivered by Atmel). Headers on the STK500 underneath are not obstructed. If you have added components to the STK501 and need access to them, you can use the cable adapter and the one of the ribbon cables supplied with the STK500 to move the ICE-Cube to one side. This is shown in the picture at right (click the picture to pop up a much larger version).
The Atmel AVR Butterfly is an inexpensive demonstration platform for the ATmega169 microcontroller with built-in LCD driver. The ATmega169 includes support for JTAG programming and On-Chip Debug and the AVR Butterfly has a place to add a JTAG header. However, this is awkwardly placed underneath the unit and because the AVR Butterfly battery has almost no current available for external circuits, you need a separate power supply.
The ECROS Technology Butterfly Carrier provides a power supply for both the AVR Butterfly and a JTAG interface device and relocates the JTAG header conveniently to the rear of the assembly. To connect the AVR ICE-Cube to the Butterfly Carrier, simply plug it onto the 10-pin header above the AVR Butterfly. The header is marked "J3" on the PCB silkscreen (or click here to pop up the board layout). The ICE-Cube will hang over the edge of the board. It is unlikely that you will get the ICE-Cube the wrong way round, but pin 1 is marked on both parts with the number "1" on the silkscreen and a square pad. If you use the cable adapter, it will be necessary to pay more attention to the location of pin 1.
The BDMICRO MAVRIC-IIB is a general-purpose ATmega128-based microcontroller board and is used in a wide variety of controller applications.
The MAVRIC-IIB includes the standard JTAG header pinout used by the ICE-Cube, which makes connecting the ICE-Cube easy. This header is located just to the right of the communications screw terminal connector. It is labeled "JTAG" and also "JP3" on the silkscreen. Pin 1 is oriented toward the bottom of the board, closest to the DIP switch, and is labeled with a "1" nearby. To connect the ICE-Cube to the MAVRIC-IIB, align pin 1 of the ICE-Cube with pin 1 of the MAVRIC-IIB JTAG header and plug in. The ICE-Cube will be oriented over the center of the MAVRIC-IIB board as shown in the photo at right (click on the photo for a larger version). Apply power to the MAVRIC-IIB using a 5.5 to 24V DC source on the "V+In" connection of the 4 position screw terminal power connector. This is on the right side of the board and is labeled JP1. The MAVRIC-IIB's on-board regulator will supply the ICE-Cube with 5V power through the JTAG connector.
The MAVRIC-IIB is just one of the AVR-based general-purpose controller boards from BDMICRO that is compatible with the ECROS Technology ICE-Cube. For more information, visit BDMICRO on the Web at http://www.bdmicro.com.
The AVR ICE-Cube operates correctly with the Progressive Resources Mega128 board, however a small modification to the board is necessary and you must work around the built-in Flash loader.
The Mega128, as delivered, does not accommodate target-powered JTAG interfaces. When you plug in the AVR ICE-Cube, the green LED will not light, indicating no power. To correct this problem, you will need to add a wire link from pin 7 of the JTAG header to a source of power. Progressive Resources technical support have stated that pin 4 of the JTAG header is connected directly to system power (the JTAG interface senses the target voltage at this pin, but does not draw power from it). The recommended placement of the link is therefore between pins 4 and 7 of the JTAG header. It should be possible to add this link tidily to the back of the board with moderate soldering skill.
Recent versions of the Mega128 are delivered with a Flash loader pre-loaded into the ATmega128 MCU (Progressive Resources call this a "bootloader"). The Boot Reset vector Enabled fuse is also programmed, so that execution begins in the Flash loader, not where your own programs would typically begin (at address zero). The Flash loader sets the JTD bit, disabling the JTAG interface. This is all done for the convenience of users without JTAG interfaces. However, it gets in the way of using the Mega128 with JTAG. Documentation for the Mega128 describes connecting via JTAG by checking "Connect on Reset" when prompted and this has been verified to work. Control is seized before the JTD instruction is executed. At this point, you can erase the MCU if you do not want to use the Flash loader. This may be an irreversible move, so check whether Progressive Resources provide a means to put it back if you think you might need it later. You can also clear the Boot Reset vector Enabled fuse so that execution will begin at address zero, the Flash loader will not run and the JTD bit will not be set. Note that any erasure of the MCU, for example to remove your own program from Flash, will also erase the Flash loader. It seems difficult to retain the Flash loader while using JTAG (or ISP, for that matter) to program and debug the MCU. Erasing it may be your only sensible option. ECROS Technology provides the foregoing as advise only and takes no responsibility for the consequences.