Embedded Systems
Products & Resources

Home Products Shipping Resources About Contact


Other Products for
Atmel AVR MCUs

Other Product Groups

All material on
this Web site is
protected under
United States
and International
copyright law.

Liability for your
use of information
on this Web site is
strictly limited.

Trademarks used
on this Web site
are the property of
their respective

Atmel and AVR
are registered
trademarks of
Atmel Corporation.

AVR ICE-Cube (and JTAG ICE) Troubleshooting

Not connected / Detecting on 'COMn'...FAILED!

To bring up the JTAG ICE dialog in AVR Studio, you can click STK500/AVRISP/JTAG ICE on the STK500 toolbar or on the Tools menu you can select STK500/AVRISP/JTAG ICE and then STK500/AVRISP/JTAG ICE....  If AVR Studio finds it cannot connect to the JTAG interface, the dialog will appear but the title will be Not connected (instead of JTAG ICE) and the scrolling pane at the very bottom will show the text "Detecting on 'COMn'...FAILED!" (where 'COMn' is your selected serial port or 'Auto').  There are many causes of this problem that you will probably already have checked.  For example, the JTAG interface power could be off (green LED not on on the AVR ICE-Cube), the serial cable could not be plugged in or the connection could be faulty or you could have misinformed AVR Studio about which COM port you are using.  There are also a couple of non-obvious causes, and this is what we are here to discuss.

Only one program can access a COM port at any one time.  The operating system blocks access from the second program to start and it appears to that program as if the COM port does not exist.  If you are sure that you have told AVR Studio to use the right port and you are properly plugged in, you should make sure that no other program is using that COM port.  Do you, for example, have Hyper Terminal open?  Defects in programs can cause them not to release a COM port even after you have shut them down.  A reboot may be necessary to fully eliminate this possible cause of no connection.

Closely related to the above cause is the possibility that AVR Studio itself may already be using the JTAG interface when you try to bring up the JTAG ICE dialog.  Check that you are not currently debugging.  If the Stop Debugging button (a small square) is active, click it to stop.  It will gray out and the Start Debugging button (a small triangle) will become active instead.  Now you will probably be able to bring up the JTAG ICE dialog.  Something that might get you into this situation when you don't expect it is having 'Auto open last project' checked in AVR Studio Options.  When you start AVR Studio, it will open any project that was open when you previously quit and may put you into debugging mode.  Check the state of the Stop Debugging button and click it if necessary.

... target device did not return a valid JTAG ID

If AVR Studio can communicate with the JTAG interface but the JTAG interface cannot communicate with the target microcontroller, a pop-up will appear with text beginning "The OCD JTAG adapter was detected, but the target device did not return a valid JTAG ID".  There are some useful, if a bit obvious, suggestions in this pop-up for figuring out what is wrong.  This section expands on some and adds others.


To use a JTAG interface, the JTAGEN fuse of the target microcontroller must be programmed.  Atmel ship the devices in this state, so this is rarely a problem.  However, if you have changed the fuse settings make sure JTAGEN is still programmed.  Using ISP, on the Fuses tab of the STK500 dialog, the line "JTAG Interface Enabled; (JTAGEN=0)" is near the top.  The checkbox to the left of this line must have a check mark in it.  The text in this dialog does not change as you change fuse settings so you have to resist the temptation to read it and assume it is telling you something.  The text only applies if the checkbox is checked.  Otherwise, the text is false.

It is not necessary to program the OCDEN fuse.  AVR Studio and the JTAG interface will take care of this for you.

Using the JTAG Pins as GPIO

The JTAG interface uses four of the microcontroller GPIO pins.  On the ATmega16 and ATmega32, it uses PC2 to PC5.  Check the data sheet of your target microcontroller.  You cannot use these pins for other purposes while you are using the JTAG interface.  If you are having problems with the JTAG interface, check that no other circuitry is interfering with the signals on these pins.

ATmega162 in the STK500

The ATmega162 has its JTAG interface on PC4 to PC7.  The original ECROS Technology STK500 JTAG Adapter was designed for the ATmega16 and ATmega32 and does not work with the ATmega162.  A different adapter is required, which is now available.

Target Voltage detected was 0.0 Volts

AVR Studio may pop up a message box with the following complaint: "The JTAG device was detected, but the target voltage was too low.  Target Voltage detected was 0.0 Volts."  If you are using an AVR ICE-Cube, which takes its power from the target system, the situation obviously cannot be as stated.  The most likely cause is that the target system does not present its supply voltage on pin 4 of the JTAG header.  Target-powered JTAG interfaces should take their power from pin 7.  However, the target supply voltage is sensed at pin 4.  This enables target systems unable to power the interface (such as the AVR Butterfly with its small battery) to operate with self-powered JTAG interfaces and have their voltage properly sensed and checked.  (More information.)


The two LEDs on the ECROS Technology AVR ICE-Cube can give you valuable information if you are experiencing problems.  When things are going well, they are not very interesting.

The Green (or Yellow) LED - Power On

If the ICE-Cube is receiving power, the green LED (LED 2) will come ON.  If it is not ON, there is some problem in the connection to the target or target power is not on.  If you are using the STK500 adapter, the green LED coming ON is a strong indicator that you have the adapter in the right place in the EXPAND0 connector.

The Red LED - Activity

The red LED (LED 1) is controlled by the software in the ICE-Cube.  When you apply power to the ICE-Cube, its state will be as follows:

If it is ON, when you open the JTAG ICE dialog or start a debugging session, it will go OFF and then flash to indicate activity.  It will not come back ON if you close the dialog, end debugging or even close AVR Studio.

If it is OFF, when you start AVR Prog it will come ON.  It will flash as you program the Atmel software into the ICE-Cube.

If you apply power to an ICE-Cube for the first time and the red LED comes on, this means that the software used to test your ICE-Cube was mistakenly not erased before it was shipped to you.  Use the manual procedure to start the flash loader.

If you are using the manual procedure to start the flash loader and the red LED comes on, you did not make a short circuit at the boot pad.  Try again; it can be a bit tricky to get a good short, particulary if you are using the first metal object that came to hand, such as a crowbar.

Click this button to go back to the AVR ICE-Cube introduction.