Using the AVR ICE-Cube
Using the ECROS Technology AVR ICE-Cube is just like using the Atmel JTAG ICE. This page supplements Atmel's documentation and does not cover every feature available from the ICE-Cube when using AVR Studio. However, it does describe using the ICE-Cube, or any JTAG ICE interface for that matter, with non-Atmel tools as well.
A device programmer is a tool that allows you to load program code and data into the internal memories of a microcontroller. After detaching the programmer, the microcontroller will execute this code and use this data to function according to your design. The device programmer also allows you to change certain settings within the device by programming and clearing fuses, which are separate from the memories. You can also erase the memories and fuses and, unless disallowed by fuse settings, dump the contents of the internal memories to a data file.
Although not the simplest nor cheapest tool to program an AVR microcontroller, the AVR ICE-Cube is fully functional as an AVR device programmer. You will not need any other programmer if you have an ICE-Cube and are using a device with a JTAG interface.
The JTAG interface does in fact have one distinct advantage over the In-System Programming (ISP) interface. If you program the clock fuses of the microcontroller in such a way that the oscillator stops, you will no longer be able to use the ISP interface until you get the oscillator going again. This can be difficult if the device is soldered to a board or if you lose track of the clock mode you programmed. With a JTAG programmer, the device clock is not needed and you can see what you've done and correct your error immediately.
Atmel's AVR Studio includes a generic interface to programmers such as the STK500, AVRISP and JTAG ICE. To launch it, click the STK500/AVRISP/JTAG ICE button on the STK500 toolbar or select Tools -> STK500/AVRISP/JTAG ICE -> STK500/AVRISP/JTAG ICE... from the menu. The type of programmer is automatically detected and the same dialog box appears in each case. Certain features may not be available and will be greyed out.
Atmel's AVR Studio includes a command line utility for programming devices with a JTAG interface. Look in the JTAGICE sub-folder of the folder in which you installed AVR Studio. The name of the tool is jtagice.exe. For help, type jtagice -h.
The open source community makes available a command line utility for programming AVR devices with a JTAG interface. You can obtain it on its own or as part of the WinAVR package. Follow the published instructions to install it and then type avarice --help for help. Under the Winidows operating system, specify the COM port to which the JTAG interface is connected using /dev/com1 or /dev/com2 etc.
Atmel microcontrollers with JTAG interfaces include on-chip debug (OCD) circuitry. Host software and the OCD circuitry interact through this interface to load and control the execution of programs on the microcontroller.
Help is available within AVR Studio by selecting Help -> AVR Studio User Guide on the menu. Select the Contents tab in the pane on the left of the HTML Help window. Double-click the little purple book icons to see the next level down in the contents tree. Topics appear as pages with blue question marks in them. Click on the page or the name of the topic to read the topic in the right-hand pane.
For help on creating an AVR Studio project, see topic AVR Studio -> Project Management -> Create new project. If you know you are going to use the AVR ICE-Cube with this project, you might as well click the Next >> button and complete the platform and device selection. Select the JTAG ICE debug platform. For help on platform and device selection, see topic AVR Studio -> Debugging -> Device selection. If you click Finish before performing this step or if you want to make a new selection, use Debug -> Select Platform and Device... on the menu to bring back the dialog. Treat the AVR ICE-Cube exactly as you would the Atmel JTAG ICE.
For help on the JTAG ICE, select Help -> AVR Tools User Guide on the menu and open the JTAG ICE User's Guide. Almost everything here applies to the AVR ICE-Cube. It is worth reading through the topic JTAGICE Frontend Software. On the Connection tab of the JTAG ICE Properties dialog, set the Baud rate: in the COM Port area to 115200 if this is reliably supported by your PC. This will speed up your debugging. All testing of the AVR ICE-Cube is performed at this setting and no problems have been observed. However, if you experience problems with your PC and operating system, try the slower default rate of 19,200 bit/s. On the Status tab of the JTAG ICE Properties dialog, the Hardware version: of the AVR ICE-Cube will read as 0xC1. The Software version: will be that of the loaded Atmel software, which is 0x7E with Avr Studio 4.10 and 4.11. Note that in the Device section, the Target voltage: is read by the ICE-Cube to an accuracy of 5%. Low voltages read a little high and high voltages a little low. If it is important for you to know the target voltage accurately, you should measure it with a voltmeter.
For help on AVaRICE, open a command prompt window and type avarice --help. To run AVaRICE as a server for GDB, type something like avarice --jtag /dev/com1 :4242.
For help on Insight, select Help -> Help Topics on the menu. To connect to a target system using an AVR ICE-Cube, run AVaRICE as above and select Run -> Connect to target on the menu. In the Target Selection dialog, select GDBserver/TCP from the Target: pick list and specify the same Port: number (e.g. 4242) as you did for AVaRICE. Set any other options and click OK.