AVR Dragon User Guide

Table of Contents

Preface
1. Introduction
2. Getting started
3. Connecting the AVR Dragon
4. On-Chip Debugging
5. Hardware description
6. Software Integration
7. Special Considerations
8. Troubleshooting
9. Firmware Upgrade
Index


Preface

What's New

Table 1. New in this release

Firmware versions | Master: 6.16; Slave: 6.16
Studio release | 4.19
New devices supported | ATmega3250PA; ATmega325PA; ATmega3290PA ATxmega64A3U; ATxmega128A3U; ATxmega192A3U; ATxmega256A3U; ATxmega32A4U; ATxmega16A4U ATxmega256A3BU


Firmware Release History

  • June 2010 - Sw: 0x060B 0x060B

    • Added PDI support for Xmega A4 and newer(devices).

    • Added full part support for ATmega169A, ATmega329A, ATmega649A, ATmega6490A, ATmega165A, ATmega325A, ATmega645A, ATmega6450A

  • December 15th, 2009 - Sw: 0x060B 0x060B

    • Added PDI support for Xmega A4 and newer(devices).

    • Added full part support for ATmega48A, ATmega88A, ATmega168A, ATmega329PA, ATmega16HVA2, AT32UC3L016, AT32UC3L032

  • October 15th, 2009 - Sw: 0x0604 0x0604

    • Removed 32kB programming limit

    • Added debug support for all AVR devices

    • Added full part support for ATmega169PA, ATmega649P, ATtiny461A, ATmega64HVE, AT32UC3L064, AT32UC3B0512revC, AT32UC3C0512, AT32UC3C0512, AT32UC3C2512

  • October 17th, 2008 - Sw: 0x0101 0x0200

    • Added full part support for ATmega32HVB

  • February 20th, 2008 - Sw: 0x0101 0x0200

    • Added full part support for ATmega16U4, ATtiny13A, ATmega8A, ATmega16A, ATmega32A

    • Added programming support for ATmega64A and ATmega128A

  • February 20th, 2008 - Sw: 0x0101 0x0200

    • Added full part support for ATtiny88, ATtiny167, ATmega32C1, ATmega32M1 and ATmega32U4

  • November 21st, 2007 - Sw: 0x0101 0x0200

    • Added programming support for support for ATmega1284P

    • Added full part support for ATtiny43U, ATtiny48 and ATmega32HVB

  • July 5th, 2007 - Sw: 0x0101 0x010A

    • Added part support for AT90USB82, AT90USB162,AT90PWM216, AT90PWM316 and ATmega16HVA

    • Fixed in FW troubles with enabling debugWIRE mode in debug-projects

  • February 26th, 2007 - Sw: 0x0101 0x0109

    • Added part support for ATmega88P and ATmega168P

  • January 4th, 2007 - Sw: 0x0101 0x0109

    • Added part support for all AVR devices. (no debugging on parts with 64kB or more Flash)

    • Fixed timing problems on High Voltage Interface

    • Made more robust ISP programming to handle skew on ISP lines

  • September 18th, 2006 - Sw: 0x0101 0x0103

    • Fixed problem with programming more than 10 bytes of data to EEPROM in debugWIRE mode

    • Fixed problems with reading and storing ISP programming frequency

    • Fixed that PP/HVSP is automatically selected as programming interface if it was used last time.

    • Fixed USB reenumeration issue, caused when disconnect/connecting the AVR Dragon

    • When target voltage is below 1.8V, the AVR Dragon now reports the actual voltage, not only "Could not find target voltage"

  • August 3rd, 2006 - Sw: 0x0100 0x0102

    • Full Support for: ATmega16, ATmega169, ATmega325P, ATmega3250P, ATmega329P and ATmega3290P

  • June 29, 2006 - Sw: 0x0100 0x0102

    • Fixed bug causing slow ISP programming

  • June 12, 2006 - Sw: 0x0100 0x0101

    • Full Support for: ATmega48/88/168, ATmega8, ATmega32, ATmega128, ATtiny13, ATtiny25/45/85 and ATtiny2313


Device support

To see which devices are currently supported please read the Device Support page.


Technical Support

Before requesting techical support make sure you have the latest available AVR Studio, tool firmware installed. The latest AVR Studio version can be downloaded from www.atmel.com/avrstudio, and contains the latest firmware version for all Atmel AVR tools. When connecting your tool, AVR Studio will automatically check the firmware version and request an update if needed.

For technical support please contact avr@atmel.com. When requesting technical support for AVR Dragon please include the following information:

  • Version number of AVR Studio. This can be found in AVR studio menu "Help->About"

  • PC processor type and speed

  • PC operating system and version

  • What target AVR device is used (Complete part number)

  • Fuse settings on the AVR

  • Target clock frequency

  • If CLKPR (Clock Prescaler Register) is used (for AVRs with this feature)

  • Target voltage

  • Programming speed

  • A detailed description of the problem, and how to recreate it.

  • Any error or waring information generated by AVR Studio when the error occurred.


Known issues

  • High-level (source-level) single stepping may be unreliable on flash addresses higher than 64k. Low-level (disassembly-level) stepping should be used in these scenarios.

  • Supports PDI progrmming/debugging only on Xmega devices in the A4 series and newer, see the Device Support page for a complete list.

  • JTAG communication with packages in PDIP which have the CKOUT fuse enabled and running above 3.5V may be unstable if there is long wiring from the AVR Dragon to the PDIP AVR.

  • ATtiny43U Programming issue: Parallel Programming may fail if the Internal RC Osc fuse is set with the shortest startup time.

  • ATtiny84 Programming issue: Parallel Programming may fail on the ATtiny84 if both the DWEN fuse and any of the external clock fuses at enabled at the same time. Workaround is to use the STK500 platform for Parallel Programming of this part.

  • ATtiny26 Programming issue: Parallel Programming on ATtiny26 is unstable with the AVR Dragon. Workaround is to use the STK500 platform for Parallel Programming of this part.

  • An error message will be triggered when entering the Board tab in the programming dialog, if there is no target voltage present.

  • In order to set ISP frequency, AVR Dragon needs to sense target voltage. See trouble shooting guide

  • When debugging is terminated while stopped, target need a reset to continue exeution (from reset vector). If debugging is terminated when running (or paused) target will continue executing when debug session is terminated.

  • Toggling of target power during debug or when programming dialog is open is not supported. This will cause the AVR Dragon to loose contact with target, and session must be restarted.


Chapter 1. Introduction

System Overview

Figure 1.1. Front side

Figure 1.2. Back side

With the AVR Dragon, Atmel has set a new standard for low cost development tools. AVR Dragon supports all programming modes for the Atmel AVR and AVR32 device families. It also includes full emulation support for most AVR devices.

At a fraction of the price traditionally associated with this kind of featured tool, the AVR Dragon will fulfill all your programming and emulation needs. The flexible and secure firmware upgrade feature allows AVR Studio to easily upgrade the AVR Dragon to support new devices.

To see which devices are currently supported please read the Device Support page.

(New devices will be added through AVR Studio updates or Service Packs on a regular basis)

AVR Dragon can be used with an external target board. However, the onboard prototype area, allow simple programming and debugging without any additional hardware besides strapping cables. Please see the Using the AVR Prototype Area section for a description on how to use this.

AVR Dragon is powered by the USB cable, and can also source an external target with up to 300mA (from the VCC connector, 5V) when programming or debugging. For more information on technical details, please read the AVR Dragon Requirements section. If the target is already powered by an external power source, the AVR Dragon will adapt and level convert all signals between the target and the AVR Dragon.

Note: If the target board is powered by external power source, no connection should be made between the VCC connector and the external board.

AVR Dragon if fully supported by AVR Studio. This allows the AVR Dragon firmware to be easily updated to support new devices and protocols. When connecting the AVR Dragon, AVR Studio will automatically check the firmware and prompt the user if an updated firmware is available.


System Requirements

The minimum hardware and software requirements are:

  1. Pentium (Pentium II and above is recommended)

  2. Windows 98, Windows ME, Windows 2000 or WindowsXP

  3. 128 MB RAM

  4. AVR Studio 4.12 with Service Pack 3

  5. USB port, self-powered (500mA required)

  6. Internet Connection for Software download

Note: Windows 95 and Windows NT does not support USB, hence cannot be used with AVR Dragon


Electrical Constraints

Table 1.1. System Unit

Power Voltage Requirements | 5.0V USB powered
AVR Dragon Current Consumption | 150mA
Max Current Source Capability (to target) | 300mA
Ambient Temperature | 0-70'C

Table 1.2. Operation

Target Voltage Range 1.8 - 5.5 V

Table 1.3. I/O Pins

Maximum Pull-up on ISP/JTAG header | 1K
Maximum Pull-down on ISP/JTAG header | 10K
Maximum Source Current VCC header | up to total 300mA.

Note that the AVR Dragon requires a USB port that can deliver up to 500mA. (self-powered USB hub)


Device support

Table 1.4. Devices programming and debuggin support
 | Programming |  |  |  |  | Debugging |  |  |
Name | HVPP | HVSP | ISP | JTAG | PDI | JTAG | PDI | debugWire | Connection Sheet | Remarks
AT90CAN128 |  |  | x | x |  | x |  |  | OffBoardTarget |
AT90CAN32 |  |  | x | x |  | x |  |  | OffBoardTarget |
AT90CAN64 |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega164A | x |  | x | x |  | x |  |  | SCKT3100A3 |
ATmega164P | x |  | x | x |  | x |  |  | SCKT3100A3 |
ATmega168 | x |  | x |  |  |  |  | x | SCKT3200A2 |
ATmega16M1 |  |  | x |  |  |  |  | x | OffBoardTarget |
ATmega324A | x |  | x | x |  | x |  |  | SCKT3100A3 |
ATmega324P | x |  | x | x |  | x |  |  | SCKT3100A3 |
ATmega32C1 |  |  | x |  |  |  |  | x | OffBoardTarget |
ATmega32M1 |  |  | x |  |  |  |  | x | OffBoardTarget |
ATmega48 | x |  | x |  |  |  |  | x | SCKT3200A2 |
ATmega48A | x |  | x |  |  |  |  | x | SCKT3200A2 |
ATmega644A | x |  | x | x |  | x |  |  | SCKT3100A3 |
ATmega644P | x |  | x | x |  | x |  |  | SCKT3100A3 |
ATmega64C1 |  |  | x |  |  |  |  | x | OffBoardTarget |
ATmega64M1 |  |  | x |  |  |  |  | x | OffBoardTarget |
ATmega88 | x |  | x |  |  |  |  | x | SCKT3200A2 |
ATtiny24 |  | x | x |  |  |  |  | x | SCKT244484 |
ATtiny25 |  | x | x |  |  |  |  | x | SCKT3400D1 |
ATtiny44 |  | x | x |  |  |  |  | x | SCKT244484 |
ATtiny45 |  | x | x |  |  |  |  | x | SCKT3400D1 |
ATtiny84 |  | x | x |  |  |  |  | x | SCKT244484 |
ATtiny85 |  | x | x |  |  |  |  | x | SCKT3400D1 |
AT32UC3A0128 |  |  |  | x |  | x |  |  | OffBoardTarget |
AT32UC3A0256 |  |  |  | x |  | x |  |  | OffBoardTarget |
AT32UC3A0512 |  |  |  | x |  | x |  |  | OffBoardTarget |
AT32UC3A0512ES |  |  |  | x |  | x |  |  | OffBoardTarget |
AT32UC3A1128 |  |  |  | x |  | x |  |  | OffBoardTarget |
AT32UC3A1256 |  |  |  | x |  | x |  |  | OffBoardTarget |
AT32UC3A1512 |  |  |  | x |  | x |  |  | OffBoardTarget |
AT32UC3A3128 |  |  |  | x |  | x |  |  | OffBoardTarget |
AT32UC3A3128S |  |  |  | x |  | x |  |  | OffBoardTarget |
AT32UC3A3256 |  |  |  | x |  | x |  |  | OffBoardTarget |
AT32UC3A3256S |  |  |  | x |  | x |  |  | OffBoardTarget |
AT32UC3A364 |  |  |  | x |  | x |  |  | OffBoardTarget |
AT32UC3A364S |  |  |  | x |  | x |  |  | OffBoardTarget |
AT32UC3B0128 |  |  |  | x |  | x |  |  | OffBoardTarget |
AT32UC3B0256 |  |  |  | x |  | x |  |  | OffBoardTarget |
AT32UC3B0256ES |  |  |  | x |  | x |  |  | OffBoardTarget |
AT32UC3B0512RevC |  |  |  | x |  | x |  |  | OffBoardTarget |
AT32UC3B064 |  |  |  | x |  | x |  |  | OffBoardTarget |
AT32UC3B1128 |  |  |  | x |  | x |  |  | OffBoardTarget |
AT32UC3B1256 |  |  |  | x |  | x |  |  | OffBoardTarget |
AT32UC3B1512 |  |  |  | x |  | x |  |  | OffBoardTarget |
AT32UC3B164 |  |  |  | x |  | x |  |  | OffBoardTarget |
AT32UC3C0512RevC |  |  |  | x |  | x |  |  | OffBoardTarget |
AT32UC3C1512RevC |  |  |  | x |  | x |  |  | OffBoardTarget |
AT32UC3C2512RevC |  |  |  | x |  | x |  |  | OffBoardTarget |
AT32UC3L016 |  |  |  | x |  | x |  |  | OffBoardTarget |
AT32UC3L032 |  |  |  | x |  | x |  |  | OffBoardTarget |
AT32UC3L064RevB |  |  |  | x |  | x |  |  | OffBoardTarget |
AT32UC3L0256 |  |  |  | x |  | x |  |  | OffBoardTarget |
ATmega16HVA |  |  | x |  |  |  |  | x | OffBoardTarget |
ATmega16HVA2 |  |  | x |  |  |  |  | x | OffBoardTarget |
ATmega16HVB |  |  | x |  |  |  |  | x | OffBoardTarget |
ATmega32HVB |  |  | x |  |  |  |  | x | OffBoardTarget |
ATmega406 |  |  |  | x |  | x |  |  | OffBoardTarget |
ATmega64HVE |  |  | x |  |  |  |  | x | OffBoardTarget |
ATmega8HVA |  |  | x |  |  |  |  |  | OffBoardTarget |
ATmega165A |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega169A |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega645A |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega6450A |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega6490A |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega649A |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega325A |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega329A |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega169 |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega169P |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega169PA |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega329 |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega3290 |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega3290P |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega3290PA |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega329P |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega329PA |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega649 |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega6490 |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega649P |  |  | x | x |  | x |  |  | OffBoardTarget |
AT90PWM1 |  |  | x |  |  |  |  | x | OffBoardTarget |
AT90PWM2 |  |  | x |  |  |  |  | x | OffBoardTarget |
AT90PWM216 |  |  | x |  |  |  |  | x | OffBoardTarget |
AT90PWM2B |  |  | x |  |  |  |  | x | OffBoardTarget |
AT90PWM3 |  |  | x |  |  |  |  | x | OffBoardTarget |
AT90PWM316 |  |  | x |  |  |  |  | x | OffBoardTarget |
AT90PWM3B |  |  | x |  |  |  |  | x | OffBoardTarget |
AT90PWM81 |  |  | x |  |  |  |  | x | OffBoardTarget |
ATmega128 |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega1280 |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega1281 |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega1284 |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega1284P |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega128A |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega128RFA1 |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega16 | x |  | x | x |  | x |  |  | SCKT3100A3 |
ATmega162 | x |  | x | x |  | x |  |  | SCKT3000D3 |
ATmega164PA | x |  | x | x |  | x |  |  | SCKT3100A3 |
ATmega165 |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega165P |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega168P | x |  | x |  |  |  |  | x | SCKT3200A2 |
ATmega16A | x |  | x | x |  | x |  |  | SCKT3100A3 |
ATmega2560 |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega2561 |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega32 | x |  | x | x |  | x |  |  | SCKT3100A3 |
ATmega325 |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega3250 |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega3250P |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega3250PA |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega325P |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega325PA |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega328 | x |  | x |  |  |  |  | x | SCKT3200A2 |
ATmega328P | x |  | x |  |  |  |  | x | SCKT3200A2 |
ATmega32A | x |  | x | x |  | x |  |  | SCKT3100A3 |
ATmega48P | x |  | x |  |  |  |  | x | SCKT3200A2 |
ATmega48PA | x |  | x |  |  |  |  | x | SCKT3200A2 |
ATmega64 |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega640 |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega644 | x |  | x | x |  | x |  |  | SCKT3100A3 |
ATmega644PA | x |  | x | x |  | x |  |  | SCKT3100A3 |
ATmega645 |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega6450 |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega64A |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega8 | x |  | x |  |  |  |  | x | SCKT3200A2 |
ATmega8515 | x |  | x |  |  |  |  |  | SCKT3000D3 |
ATmega8535 | x |  | x |  |  |  |  |  | SCKT3100A3 |
ATmega88P | x |  | x |  |  |  |  | x | SCKT3200A2 |
ATmega8A | x |  | x |  |  |  |  | x | SCKT3200A2 |
ATtiny11 |  | x |  |  |  |  |  |  | SCKT3400D1 |
ATtiny12 |  | x | x |  |  |  |  |  | SCKT3400D1 |
ATtiny13 |  | x | x |  |  |  |  | x | SCKT3400D1 |
ATtiny13A |  | x | x |  |  |  |  | x | SCKT3400D1 |
ATtiny15 |  | x | x |  |  |  |  |  | SCKT3600A1 |
ATtiny167 |  |  | x |  |  |  |  | x | OffBoardTarget |
ATtiny2313 | x |  | x |  |  |  |  | x | SCKT3300D3 |
ATtiny2313A | x |  | x |  |  |  |  | x | SCKT3300D3 |
ATtiny24A |  | x | x |  |  |  |  | x | SCKT244484 |
ATtiny26 | x |  | x |  |  |  |  | x | SCKT3700A1 |
ATtiny261 | x |  | x |  |  |  |  | x | SCKT3700A1 |
ATtiny261A | x |  | x |  |  |  |  | x | SCKT3700A1 |
ATtiny28 | x |  |  |  |  |  |  |  | SCKT3500D- |
ATtiny4313 | x |  | x |  |  |  |  | x | SCKT3300D3 |
ATtiny43U |  |  | x |  |  |  |  | x | OffBoardTarget |
ATtiny44A |  | x | x |  |  |  |  | x | SCKT244484 |
ATtiny461 | x |  | x |  |  |  |  | x | SCKT3700A1 |
ATtiny461A | x |  | x |  |  |  |  | x | SCKT3700A1 |
ATtiny48 | x |  | x |  |  |  |  | x | SCKT3200A2 |
ATtiny861 | x |  | x |  |  |  |  | x | SCKT3700A1 |
ATtiny861A | x |  | x |  |  |  |  | x | SCKT3700A1 |
ATtiny87 |  |  | x |  |  |  |  | x | OffBoardTarget |
ATtiny88 | x |  | x |  |  |  |  | x | SCKT3200A2 |
AT90USB1286 |  |  | x | x |  | x |  |  | OffBoardTarget |
AT90USB1287 |  |  | x | x |  | x |  |  | OffBoardTarget |
AT90USB162 |  |  | x |  |  |  |  | x | OffBoardTarget |
AT90USB646 |  |  | x | x |  | x |  |  | OffBoardTarget |
AT90USB647 |  |  | x | x |  | x |  |  | OffBoardTarget |
AT90USB82 |  |  | x |  |  |  |  | x | OffBoardTarget |
ATmega16U2 |  |  | x |  |  |  |  | x | OffBoardTarget |
ATmega16U4 |  |  | x | x |  | x |  |  | OffBoardTarget |
ATmega32U2 |  |  | x |  |  |  |  | x | OffBoardTarget |
ATmega32U4 |  |  |  | x |  | x |  |  | OffBoardTarget |
ATmega8U2 |  |  | x |  |  |  |  | x | OffBoardTarget |
ATxmega128A1 |  |  |  | x |  | x |  |  | OffBoardTarget |
ATxmega128A3 |  |  |  | x |  | x |  |  | OffBoardTarget |
ATxmega16A4 |  |  |  |  | x |  | x |  | OffBoardTarget |
ATxmega192A3 |  |  |  | x |  | x |  |  | OffBoardTarget |
ATxmega256A3 |  |  |  | x |  | x |  |  | OffBoardTarget |
ATxmega256A3B |  |  |  | x |  | x |  |  | OffBoardTarget |
ATxmega32A4 |  |  |  |  | x |  | x |  | OffBoardTarget |
ATxmega64A1 |  |  |  | x |  | x |  |  | OffBoardTarget |
ATxmega64A3 |  |  |  | x |  | x |  |  | OffBoardTarget |
ATxmega64A3U |  |  |  | x | x | x | x |  | OffBoardTarget |
ATxmega128A3U |  |  |  | x | x | x | x |  | OffBoardTarget |
ATxmega192A3U |  |  |  | x | x | x | x |  | OffBoardTarget |
ATxmega256A3U |  |  |  | x | x | x | x |  | OffBoardTarget |
ATxmega256A3BU |  |  |  | x | x | x | x |  | OffBoardTarget |
ATxmega32A4U |  |  |  |  | x |  | x |  | OffBoardTarget |
ATxmega16A4U |  |  |  |  | x |  | x |  | OffBoardTarget |


Supported Protocols

Currently the following protocols are supported:

Programming Interfaces

  • In System Programming (ISP)

  • High Voltage Serial Programming (HVSP)

  • Parallel Programming (PP)

  • JTAG Programming (JTAG Prog)

  • PDI Programming on selected devices (PDI)

Debuging Interfaces

  • JTAG (JTAG)

  • debugWIRE (dW)

  • PDI on selected devices (PDI)


Chapter 2. Getting started

Please read this section before connecting the AVR Dragon to the computer or target.

Important ! Please install AVR Studio and the USB driver before connecting AVR Dragon to your PC

Follow these simple steps to get started using the AVR Dragon:

  1. Download AVR Studio 4.12 SP3 or later from http://www.atmel.com/avrdragon

  2. Install AVR Studio and the USB driver

  3. Connect AVR Dragon to the computer, and auto-install new hardware (AVR Dragon) on the computer

  4. Start AVR Studio and the AVR Dragon Programming Dialog

  5. Connect AVR Dragon to the target

Unpacking the AVR Dragon.

The box contains:

  • AVR Dragon tool

  • Internet link to Software ( http://www.atmel.com/avrdragon )

There is no CD shipped with the AVR Dragon. The only way of getting the software is by downloading it directly from the Internet.

You will also need: (not included)

  • PC with free USB connector or a USB HUB capable of delivering 500mA

  • USB Cable

  • AVR Studio 4.12 with Service Pack 3 or later ( Link: http://www.atmel.com/avrdragon )

  • 6/10 pin Header Connector (or similar cables to connect the AVR Dragon to the target board)


Hints

  • Always power up the AVR Dragon first before connecting to or powering up the target

  • AVR Dragon needs to sense the target voltage at pin 2 on the ISP header or pin 4 on the JTAG header.

  • This also applies when using High Voltage interface.

  • The High Voltage interface are set to 5V. Make sure the target board are running at 5V before using this interface off board.

  • VCC header are set to 5V, and can source max 300mA.

  • If AVR Dragon is used for programming/debugging targets on the STK500, the RESET jumper on the STK500 must be removed


Software and USB setup

Software and USB setup

In order to use the AVR Dragon it is required to install the USB driver. Please do not connect the AVR Dragon to the computer before running the USB Setup. USB driver installation is done during the AVR Studio installation.

Note: AVR Dragon requires AVR Studio 4.12 with Service Pack 3 or later. Latest version of the AVR Studio can be found at: www.atmel.com/products/AVR/

Start the AVR Studio installation. During this installation the dialog box in the figure below will be presented to the user.

To install the USB driver, check the Install/Upgrade USB Driver checkbox, and the USB Driver will automatically be installed.

Install new hardware on the computer

When AVR Studio and USB driver installation is finished, please attach the USB cable to both PC and AVR Dragon. (The AVR Dragon is powered from the USB). If it is the first time the AVR Dragon is connected to the computer, the box below will appear:

If running Windows XP you need to click "Next" a couple of times. Please wait until the installation process completes by itself. It may take from a few seconds up to a few minutes depending on the computer and operating system.

If the USB driver is correctly installed and AVR Dragon is connect to the PC, the green LED inside the encasing next to the USB connector will be lit.

If the AVR Studio for some reason can't detect the AVR Dragon after the USB setup, try to restart the computer in order to get the driver properly loaded.

Install USB driver after AVR Studio is installed

The USB driver can be installed even after AVR Studio have been installed by following these steps:

  1. Open "Control Panel" on the PC (Windows 95 and Windows NT does not support USB)

  2. Select "Add or Remove Programs"

  3. Select "AVRStudio4" in the list of programs

  4. Click on the "Change" button

  5. Select "Modify"

  6. Select "Install/upgrade USB Driver"

The USB driver is now properly installed on the PC

Note: The AVR Dragon requires a USB port that can deliver 500mA (self-powered USB hub).


Connecting the AVR Dragon

Se section Connecting the AVR Dragon for information on connecting to target for programming and debuging


Chapter 3. Connecting the AVR Dragon

Programming

In System Programming

In System Programming is well suited for programming devices soldered onto external target boards. This section explains how to connect the AVR Dragon to ISP program an external target. The ISP lines are equipped with level converters that automatically will level shift the AVR Dragon to the target board voltage.

It is recommended that a 6-pin header connector with 2.54mm (100 MIL) spacing is placed on the target board to allow easy access to the ISP programming interface. The following pinout should be used.

Figure 3.1. 6pin Header Connector with 2.54mm (100 MIL) spacing

6pin Header Connector with 2.54mm (100 MIL) spacing

Note: When connecting the AVR Dragon to the target, connect MISO to MISO pin on the target device, MOSI to MOSI and so on.

Note: AVR Dragon must sense the target voltage at pin 2 on the ISP header in order to set up the level-converter. For on-board targets, the voltage must be supplied from pin 2,4,6 on the VCC header (5V) into pin 2 (VTG) on the ISP header. When using off-board targets there should be no connection between VCC header and pin 2 of the ISP header.

Connect the 6pin cable from the AVR Dragon to the external target as shown in these pictures:

Figure 3.2.

Figure 3.3.

debugWIRE OCD interface is also accessed through this ISP header.

See the AVR Studio user guide for information about using the "Programming Dialog" to program the target device.

JTAG Programming Description

AVR devices with JTAG interface also support programming through this interface. The connection for JTAG programming is the same as the JTAG debug interface. Please see section "Connecting to target through the JTAG Interface" for information how to connect the AVR Dragon to your external target board.

It is also possible to do JTAG Programming on a device placed on the Prototype Area of the AVR Dragon. Please see the "Device Connection Sheets" for information on how to connect the different AVR devices.

Figure 3.4.

See the AVR Studio user guide for information about using the "Programming Dialog" to program the target device.

PDI Programming Description

AVR devices with PDI interface (see (exceptions). The AVR Dragon also support programming through this interface. The connection for PDI programming is the same as the PDI debug interface. Please see section "Connecting to target through the PDI Interface" for information how to connect the AVR Dragon to your external target board.

Figure 3.5.

See the AVR Studio user guide for information about using the "Programming Dialog" to program the target device.

Parallel Programming Description

High pin count AVR devices support the full Parallel Programming (PP) interface. This interface offer high speed programming, and also support programming all fuse and lock bits in the AVR Device.

Important!

Extreme care should be taken if using PP mode to program a AVR device on an external target. The PP lines do not have level converters, so it is important that the target board then is powered by the AVR Dragon VCC header, and not using its own power supply. In addition the AVR Dragon will apply 12V to the reset pin, so it is important that the target board is designed to handle 12V on this line.

Note that the target voltage, i.e. the 5V from the VCC header must be applied to either pin 2 on the ISP header or pin 4 on the JTAG header. This because the AVR Dragon must read the target voltage.

To avoid damaging the Target Board, the AVR Dragon or both, it is recommended to only use PP mode on devices placed in the 28/40 pin DIP socket on the AVR Prototyp area on the AVR Dragon.

Figure 3.6. Prototype Area

The HV_PROG header pinout is listed below. This is the standard pinout for about all AVR parts. However the pinout on the HV_PROG header are slightly different for some parts, these exceptions are listed further down in this page.

Figure 3.7.

For ATtiny26/261/461/861 the HV_PROG header will have this pinout:

Figure 3.8.

For ATtiny2313 the HV_PROG header will have this pinout:

Figure 3.9.

Please see the "Device Connection Sheet" section for information on how to connect AVR Dragon for PP programming.

See the AVR Studio user guide for information about using the "Programming Dialog" to program the target device.

High Voltage Serial Programming Description

Low pin count AVR devices do not have enough IO pins to support the full Parallel Programming interface. These devices instead use HVSP programming, which is a serial version of the Parallel Programming interface.

Important!

Extreme care should be taken if using HVSP mode to program a AVR device on an external target. The HVSP lines do not have level converters, so it is important that the target board is powered by the AVR Dragon VCC header, and not using another power supply. In addition the AVR Dragon will apply 12V to the reset pin, so it is important that the target board is designed to handle 12V on this line.

Note that the target voltage, i.e. the 5V from the VCC header must be applied to either pin 2 on the ISP header or pin 4 on the JTAG header. This because the AVR Dragon must read the target voltage.

To avoid damaging the Target Board, the AVR Dragon or both, it is recommended to only use HVSP mode on devices placed in the 28/40 pin DIP socket on the AVR Prototyp area on the AVR Dragon.

Figure 3.10. Prototype Area

The High Voltage Serial Programming (HVSP) interface is found on the HV_PROG header. Figure below shows the pinout of the HV_PROG header when used for HVSP for all parts except ATtiny24/44/84 :

Figure 3.11.

The ATtiny24/44/84 uses separate pins for entering programming mode. See the pinout of the HV_PROG header when used for these parts below:

Figure 3.12.

Please see the "Device Connection Sheet" section for information on how to connect AVR Dragon for HVSP programming for the different supported devices.

See the AVR Studio user guide for information about using the "Programming Dialog" to program the target device.

Command Line Tool

The DOS command line tool is the same as for the STK500 starter kit. It is named "AVRDragon.exe" and allows simple batch files for automatic programming. The program is located on the disk at: [INSTALL PATH]\Atmel\AVR Tools\AVRDragon\

Typing "avrdragon -h" will display all the commands, options and the parts currently supported by the AVR Dragon.

Commands:

 -h, -?         Print this help.

 -he            Print exit codes.

 -e             Erase device.

 -f <fusebytes> Write high/low fuse bytes. The LSB of fusebytes will be

                written to the low fuse byte, and the MSB will be written

                to the high fuse byte.

 -j <ID>        Read JTAG ID string. If an optional ID is specified, the

                program will terminate if the read ID differs.

 -l <lockbyte>  Set the lock byte to the specified value.

 -p[f|e|b]      Program FLASH (-pf), EEPROM (-pe) or both (-pb) memories.

                Requires input files specified with the -if (FLASH)

                and/or -ie (EEPROM) options.

 -q             Read fuse bytes. If the selected device has extended fuse,

                it will be also be read.

 -r[f|e|b]      Read FLASH (-rf), EEPROM (-re) or both (-rb) memories.

                Requires output files specified with the -of (FLASH) and/or

                -oe (EEPROM) options.

 -s             Read signature bytes.

 -v[f|e|b]      Verify FLASH (-vf), EEPROM (-ve) or both (vb) memories.

                Requires input files specified with the -if (FLASH) and/or

                -ie (EEPROM) options.

 -y             Read lock byte.

 -E <ext.fuse>  Write extended fuse byte.

 -F <fusebytes> Verify high/low fuse bytes. The LSB of fusebytes will be

                compared to the low fuse byte, and the MSB will be compared

                to the high fuse byte.

 -L <lockbyte>  Verify the lock byte.

 -G <ext.fuse>  Verify the extended fuse byte against the given value.

 -O <address>   Read oscillator calibration byte. Address is location of byte

                as specified in the device's data sheet.

 -S[f|e] <address>

                Write oscillator calibration byte read with -O or -Z to given

                location in FLASH (-Sf) or EEPROM (-Se).

 -W             Disable debugWIRE interface, enabling ISP mode. Only available

                for debugWIRE devices.

 -Y             Perform the oscillator calibration sequence. See appnote

                AVR053 for more information.

 -Z <address>   Load value from address in EEPROM prior to erasing the device.

                This value can be written to FLASH or EEPROM again with

                the -S[f|e] command.

Options:

 -ae <start>,<end>

                Specify address range for reading EEPROM memory. Default is

                entire memory.

 -af <start>,<end>

                Specify address range for reading FLASH memory. Default is

                entire memory.

 -d <device>    [required] Specify the type of device.

 -ie <file>     Specify input file for programming EEPROM memory.

 -if <file>     Specify input file for programming FLASH memory.

 -m[i|j|p]      Choose programming mode: ISP (-mi), parallel/high-voltage (-mp)

                or JTAG (-mj) (default).

 -oe <file>     Specify output file for reading EEPROM memory.

 -of <file>     Specify output file for reading FLASH memory.

 -z             No progress indicator. Useful when redirecting output to file.

 -D <devsbefore,devsafter,bitsbefore,bitsafter>

                Set daisy chain settings. Only available in JTAG mode.

 -I <speed>     Specify ISP frequency (Hz). Only available for ISP mode.

 -J <speed>     Specify device speed (Hz). Only available for JTAG mode.

 -R             Apply external reset while programming. Only available in

                JTAG mode.

Example usage: avrdragon.exe -dATmega128 -e -pf -if -mj c:\tmp\test.hex


Debugging

Connecting to target through the JTAG Interface

A minimum of 6 wires is required to connect AVR Dragon to the target board. These Signals are TCK, TDO, TDI, TMS, VTref and GND.

Optional line is the nSRST. The nTRST signal is not used, and is reserved for compatibility with other equipment.

nSRST is used to control and monitor the target reset line. This is however not necessary for correct emulation. But if the application code sets the JTD bit in the MCUCSR, the JTAG Interface will be disabled. For the AVR Dragon to reprogram the target AVR, it will need to have control of the Reset Pin.

The figure below shows which JTAG lines should be connected to the target AVR to ensure correct operation. To avoid drive contention on the lines it is recommended that series resistors are placed between the JTAG lines and external circuitry. The value of the resistor should be chosen so that the external circuitry and the AVR do not exceed their maximum ratings (i.e. sinks or sources to much current).

Connecting AVR Dragon to Target Board

Figure 3.13.

Figure 3.14.

Connecting AVR Dragon to several devices placed in a JTAG Chain

AVR Dragon support emulation of devices placed in a JTAG Chain. When connecting N devices in a JTAG scan chain all devices should connect to TMS and TCK in parallel. The first device should connects it's TDI to the emulator while the TDO should be wired to TDI of the next device up to device N. The last device should connects it's TDO to the emulator.

Connecting AVR Dragon to STK500

STK500 does not have a dedicated JTAG interface connector. To connect the AVR Dragon to the STK500 board, the JTAG Probe must be strapped to the appropriate JTAG Port Pins of the target device using a squid cable. Check the target device datasheet for the location of the JTAG pins on the appropriate device. Figure below shows an example on how the pins should be connected for an ATmega32 on the STK500. Remember to remove the reset jumper on the STK500 if the reset pin is going to be controlled from the AVR Dragon.

Note: Add-on cards for the STK500 like e.g. STK501/502 may have a dedicated JTAG connector.

Example: Connecting AVR Dragon to STK500 with ATmega32

Figure 3.15.

STK500 JTAG Adapter

The STK500 JTAG Adapter, that comes with the JTAGICE mkII, can be used to simplify the connection to the STK500 for AVR devices with JTAG that mates with socket SCKT3100A3 and SCKT3000D3 on the STK500.

Figure 3.16.

Enabling the JTAG Enable fuse

If the JTAGEN fuse (JTAG Enable) in the target device is un-programmed, the JTAG Interface will be disabled. This fuse cannot be programmed through the JTAG Interface and must therefore be programmed through the ISP Interface or High Voltage Serial or Parallel Interface.

Connecting to target through the debugWIRE Interface

A minimum of 3 wires is required for communication between AVR Dragon and the target board with the debugWIRE interface. These Signals are RESET, VTref and GND.

Important!

This interface uses only 1 pin, (RESET pin) for communication with the target. To enable the debugWIRE interface on an AVR Device, the debugWIRE Enable fuse (DWEN) must be programmed, (DWEN=0). AVR devices with debugWIRE interface are shipped with the DWEN fuse un-programmed from the factory. The debugWIRE interface itself cannot enable this fuse. The DWEN fuse can be programmed through ISP mode, which requires connection to a 6-pin header. For this reason it is recommended to place the full 6-pin ISP connector on your target board to simplify emulation and programming.

NOTE: When the DWEN fuse is set, the ISP Interface normal functionality is disabled. This because the debugWIRE must have control over the RESET pin. When DWEN is set it is no longer possible to use ISP. Use debugWIRE or High Voltage programming to disable the DWEN fuse.

If using this connection from AVR Dragon on a STK500, be sure to detach the RESET jumper on the STK500. And connect to the correct ISP header for the actual AVR device, guided by the colour code in the STK500 silk-print.

AVR Dragon debugWIRE connector

Figure 3.17.

Figure 3.18.

Figure 3.19.

Connecting AVR Dragon probe to 6-pins ISP header using a 6-pin cable

When DWEN fuse is programmed, there is only need for GND, VTref and RESET line for using the debugWIRE interface. However to ease the task of changing between ISP mode and debugWIRE mode, it is recommended to do debugWIRE with all six lines connected. The AVR Dragon will automatically tristate all unused ISP pins when running debugWIRE.

Re-enabling the ISP interface

By following the description below, the ISP Interface is re-enabled.

  1. Connect the AVR Dragon to the target with ISP (6-pin connection) as described above.

  2. Load a project and Start a debug session using the "Start Debugging" command (found under the Debug pulldown-menu in AVR Studio)

  3. Open "AVR Dragon Options" (found under the Debug pulldown-menu in AVR Studio) and select the "Connections" tab.

  4. Click on the button "disable DebugWIRE" as shown in the figure below. And click "Yes" in the next message box.

Figure 3.20.

Note: Some precautions regarding the RESET line must be taken to ensure proper communication over the debugWIRE interface. If there is a pull-up on the RESET line, this resistor must be larger than 10Kohm, and there should be no capacitive load. The pull-up resistor is not required for debugWIRE functionality. Other logic connected to the RESET line should be removed.

It's not possible to use the debugWIRE Interface if the lockbits on the target AVR are programmed. Always be sure that the lockbits are cleared before programming the DWEN fuse and never set the lockbits while the DWEN fuse is programmed. If both the debugWIRE enable fuse (DWEN) and lockbits are set, one can use High Voltage Programming to do a chip erase, hence clear the lockbits. When the lockbits are cleared the debugWIRE Interface will be re-enabled.

The ISP Interface is only capable of reading fuses, signature and do a chip erase when the DWEN fuse is unprogrammed.

Connecting to target through the PDI Interface

A minimum of 2 wires is required for communication between AVR Dragon and the target board with the PDI interface. See PDI Physical. However to ease the task of connecting to a 6 pin SPI style connector, it is recommended to do PDI with all six lines connected. The AVR Dragon will automatically tristate all unused ISP pins when running PDI.

AVR Dragon debugWIRE connector

Figure 3.21.

Figure 3.22.


Device Connection Sheets

Devicesheet: SCKT3000D3

  • Supported Programming Modes: ISP Parallel programming JTAG programming

  • Supported Emulation Modes: JTAG for devices with less than 64kB flash

  • Applicable for the following devices:

    • ATmega8515 Note: JTAG programming and emulation not supported by ATmega8515

      ATmega162

The following pictures show how to connect these devices to the AVRDragon:

Figure 3.23. In System Programming

In System Programming

Figure 3.24. JTAG programming and emulation

JTAG programming and emulation

Figure 3.25. Parallell programming

Devicesheet: SCKT3100A3

  • Supported Programming Modes: ISP Parallel programming JTAG programming

  • Supported Emulation Modes: JTAG for devices with less than 64kB flash

  • Applicable for the following devices:

    • ATmega16

      ATmega32

      ATmega164P

      ATmega324P

      ATmega644

      ATmega644P

      ATmega1284P

      ATmega8535 Note: JTAG programming and emulation not supported by ATmega8535

The following pictures show how to connect these devices to the AVRDragon:

Figure 3.26. In System Programming

In System Programming

Figure 3.27. JTAG programming and emulation

JTAG programming and emulation

Figure 3.28. Parallell programming

Devicesheet: SCKT3200D2

  • Supported Programming Modes: ISP Parallel programming

  • Supported Emulation Modes: debugWIRE

  • Applicable for the following devices:

    • ATmega8 - Note: debugWIRE not supported by ATmega8

      ATmega48

      ATmega48P

      ATmega88

      ATmega168

      ATtiny48

The following pictures show how to connect these devices to the AVRDragon:

Figure 3.29. In System Programming and debugWIRE emulation

In System Programming and debugWIRE emulation

Figure 3.30. Parallell programming

Devicesheet: SCKT3300D3

  • Supported Programming Modes: ISP Parallel programming

  • Supported Emulation Modes: debugWIRE

  • Applicable for the following devices:

    • ATtiny2313

The following pictures show how to connect these devices to the AVRDragon:

Figure 3.31. In System Programming and debugWIRE emulation

In System Programming and debugWIRE emulation

Figure 3.32. Parallell programming

Devicesheet: SCKT3400D1

  • Supported Programming Modes: ISP High Voltage Serial Programming

  • Supported Emulation Modes: debugWIRE

  • Applicable for the following devices:

    • ATtiny11 - Note: ISP and debugWIRE not supported by tiny11

    • ATtiny12 - Note: debugWIRE not supported by tiny12

    • ATtiny13

    • ATtiny25

    • ATtiny45

    • ATtiny85

The following pictures show how to connect these devices to the AVRDragon:

Figure 3.33. In System Programming and debugWIRE emulation

In System Programming and debugWIRE emulation

Figure 3.34. High Voltage Serial Programming

High Voltage Serial Programming

Devicesheet: SCKT3500D-

  • Supported Programming Modes: Parallel programming

  • Supported Emulation Modes: none

  • Applicable for the following devices:

    • ATtiny28 - Note: Only High Voltage Programming available for tiny28

The following pictures show how to connect these devices to the AVRDragon:

Figure 3.35. Parallell programming

Devicesheet: SCKT3600A1

  • Supported Programming Modes: ISP High Voltage Serial Programming

  • Supported Emulation Modes: none

  • Applicable for the following devices:

    • ATtiny15 - Note: Emulation not supported by tiny15

The following pictures show how to connect these devices to the AVRDragon:

Figure 3.36. In System Programming and debugWIRE emulation

In System Programming and debugWIRE emulation

Figure 3.37. High Voltage Serial Programming

High Voltage Serial Programming

Devicesheet: SCKT3700A1

  • Supported Programming Modes: ISP Parallel programming

  • Supported Emulation Modes: debugWIRE

  • Applicable for the following devices:

    • ATtiny26 - Note: debugWIRE not supported by tiny26, PP - prog issue, see known issues section

    • ATtiny261

    • ATtiny461

    • ATtiny861

The following pictures show how to connect these devices to the AVRDragon:

Figure 3.38. In System Programming and debugWIRE emulation

In System Programming and debugWIRE emulation

Figure 3.39. Parallel Programming

Devicesheet: SCKT244484

  • Supported Programming Modes: ISP High Voltage Serial Programming

  • Supported Emulation Modes: debugWIRE

  • Applicable for the following devices:

    • ATtiny24

    • ATtiny44

    • ATtiny84

The following pictures show how to connect these devices to the AVRDragon:

Figure 3.40. In System Programming and debugWIRE emulation

In System Programming and debugWIRE emulation

Figure 3.41. High Voltage Serial Programming

High Voltage Serial Programming

Devicesheet: Off board targets

  • Supported Programming Modes: ISP High Voltage Serial Programming Parallel programming

  • Supported Emulation Modes: debugWIRE JTAG

This Device is not available in PDIP package and can therefore not directly be connected to the AVR Dragon Prototype area. See the applicable datasheet for information on how to connect for ISP, PP and JTAG


Chapter 4. On-Chip Debugging

Introduction to On-Chip Debugging (OCD)

A traditional Emulator is a tool which tries to imitate the exact behaviour of a target device. The closer this behaviour is to the actual device’s behaviour, the better the emulation will be.

The AVR Dragon is not a traditional Emulator. Instead, the AVR Dragon interfaces with the internal On-Chip Debug system inside the target AVR device, providing a mechanism for monitoring and controlling its execution. In this way the application being debugged is not emulated, but actually executed on the real AVRF target device.

With an OCD system, the application can be executed whilst maintaining exact electrical and timing characteristics in the target system – something not technically realisable with a traditional emulator.

Run Mode

When in Run mode, the execution of code is completely independent of the AVR Dragon. The AVR Dragon will continuously monitor the target AVR to see if a break condition has occurred. When this happens the OCD system will interrogate the device through its debug interface, allowing the user to view the internal state of the device.

Stopped Mode

When a breakpoint is reached, program execution is halted, but all I/O will continue to run as if no breakpoint had occurred. For example assume that a USART transmit has just been initiated when a breakpoint is reached. In this case the USART continues to run at full speed completing the transmission, even though the core is in stopped mode.

Hardware Breakpoints

The AVR OCD module contains a number of program counter comparators implemented in hardware. When the program counter matches the value stored in one of the comparator registers, the OCD enters stopped mode. Since hardware breakpoints require dedicated hardware on the OCD module, the number of breakpoints available depends upon the size of the OCD module implemented on the AVR target. Usually one such hardware comparator is ‘reserved’ by the debugger for internal use. For more information on the hardware breakpoints available in the various OCD modules, see the OCD implementations section.

Software Breakpoints

A software breakpoint is a BREAK instruction placed in program memory on the target device. When this instruction is loaded, program execution will break and the OCD enters stopped mode. To continue execution a "start" command has to be given from the OCD. Not all AVR devices have OCD modules supporting the BREAK instruction. For more information on the software breakpoints available in the various OCD modules, see the OCD implementations section.

For further information on the considerations and restrictions when using an OCD system, see the Special Considerations section.


Physical Interfaces

The AVR Dragon supports several hardware interfaces as described in the sections that follow.

JTAG

The JTAG interface consists of a 4-wire Test Access Port (TAP) controller that is compliant with the IEEE 1149.1 standard. The IEEE standard was developed to provide an industry-standard way to efficiently test circuit board connectivity (Boundary Scan). Atmel® AVR devices have extended this functionality to include full Programming and On-Chip Debugging support.

Figure 4.1. JTAG interface basics

JTAG interface basics

When designing an application PCB which includes an AVR with the JTAG interface, it is recommended to use the pinout as shown in Figure 4.2, “JTAG header pinout”. The AVR Dragon JTAG header support this pinout.

Figure 4.2. JTAG header pinout

JTAG header pinout

Table 4.1. JTAG pin description

Name | Pin | Description
TCK | 1 | Test Clock (clock signal from the AVR Dragon into the target device)
TMS | 5 | Test Mode Select (control signal from the AVR Dragon into the target device)
TDI | 9 | Test Data In (data transmitted from the AVR Dragon into the target device)
TDO | 3 | Test Data Out (data transmitted from the target device into the AVR Dragon)
nTRST | 8 | Test Reset (optional, only on some AVR devices). Used to reset the JTAG TAP controller
nSRST | 6 | Source Reset (optional) Used to reset the target device. Connecting this pin is recommended since it allows the AVR Dragon to hold the target device in a reset state, which can be essential to debugging in certain scenarios - for example if the JTD bit is set by the application firmware, disbling the JTAG interface. The nSRST pin has a internal pullup resistor in the AVR Dragon.
VTref | 4 | Target voltage reference. The AVR Dragon samples the target voltage on this pin in order to power the level converters correctly. The AVR Dragon draws less than 1mA from this pin.
GND | 2, 10 | Ground. Both must be connected to ensure that the AVR Dragon and the target device share the same ground reference.

Tip: remember to include a decoupling capacitor between pins 4 and 2.

Note: The AVR Dragon cannot be powered by the target. Vsupply (pin 7) should be left as NOT CONNECTED.

When external circuitry shares the JTAG debug lines on the target application, series resistors should be used to avoid driver contention, as shown in Figure 4.1, “JTAG interface basics”. The value of the resistors should be chosen so that the external circuitry and the AVR do not exceed their maximum ratings (i.e. sink or source too much current). 1k is a commonly used value.

It is recommended to disconnect any analog filters on these lines (which should be on the 'outside' of the resistors) during a JTAG session, since these elements are discharged by the JTAG signals, possibly causing false logic levels influenced by the residual voltage in the capacitor. If the filters cannot be disconnected, it is then recommended to apply target Vcc directly to the capacitor during a session to hold the voltage stable. Be sure to use a large enough resistor between the capacitor and the JTAG line when doing this!

The JTAG interface allows for several devices to be connected to a single interface in a daisy-chain configuration. The target devices must all be powered by the same supply voltage, share a common ground node, and must be connected as shown in Figure 4.3, “JTAG daisy-chain”.

Figure 4.3. JTAG daisy-chain

When connecting devices in a daisy-chain, the following points must be considered:

  • All devices must share a common ground, connected to GND on the AVR Dragon probe

  • All devices must be operating on the same target voltage. VTref on the AVR Dragon probe must be connected to this voltage.

  • TMS and TCK are connected in parallel; TDI and TDO are connected in a serial chain.

  • NSRST on the AVR Dragon probe must be connected to RESET on the devices if any one of the devices in the chain disables its JTAG port.

  • "Devices before" refers to the number of JTAG devices that the TDI signal has to pass through in the daisy chain before reaching the target device. Similarly "devices after" is the number of devices that the signal has to pass through after the target device before reaching the AVR Dragon TDO pin.

  • "Instruction bits before" and "after" refers to the sum total of all JTAG devices' instruction register lengths which are connected before and after the target device in the daisy chain.

  • Note that when changing the daisy-chain settings from the programming dialog, the dialog must be closed and re-opened before the settings take effect.

  • The total IR length (instruction bits before + instruction bits after) is limited to a maximum or 32 bits.

Daisy chaining example: TDI -> ATmega1280 -> ATxmega128A1 -> ATUC3A0512 -> TDO

In order to connect to the XMEGA device, the daisy chain settings are:

Devices before: 1

Devices after: 1

Instruction bits before: 4 (AVR devices have 4 IR bits)

Instruction bits before: 5 (AVR32 devices have 5 IR bits)

PDI Physical

The Program and Debug Interface (PDI) is an Atmel proprietary interface for external programming and on-chip debugging of a device. PDI Physical is a 2-pin interface providing a bi-directional half-duplex synchronous communication with the target device.

This ingteface is only supported on Xmega devices in the A4 series and newer, see the Device Support page for a complete list)

When designing an application PCB which includes an AVR with the PDI interface, the pinout shown in Figure 4.4, “PDI header pinout” should be used.

Figure 4.4. PDI header pinout

PDI header pinout

NOTE: The pinout shown above is compatible with the STK600, AVR ONE!, JTAGICEmkII and future tools with PDI interface. The AVR Dragon might be connected directly to the STK600 using a 6 lead cable.

debugWIRE

The debugWIRE interface was developed by Atmel for use on low pin-count devices. Unlike the JTAG interface which uses 4 pins, debugWIRE makes use of just a single pin (RESET) for bi-directional half-duplex asynchronous communication with the debugger tool.

When designing an application PCB which includes an AVR with the debugWIRE interface, the pinout shown in Figure 4.5, “debugWIRE (SPI) header pinout” should be used.

Figure 4.5. debugWIRE (SPI) header pinout

debugWIRE (SPI) header pinout

NOTE: The debugWIRE interface can not be used as a programming interface. This means that the SPI interface must also be available (as shown in Figure 4.6, “SPI header pinout”) in order to program the target.

When the debugWIRE enable (DWEN) fuse is programmed and lock-bits are un-programmed, the debugWIRE system within the target device is activated. The RESET pin is configured as a wire-AND (open-drain) bi-directional I/O pin with pull-up enabled and becomes the communication gateway between target and debugger.

SPI

In-System Programming uses the target AVR’s internal SPI (Serial Peripheral Interface) to download code into the flash and EEPROM memories. It is not a debugging interface. When designing an application PCB which includes an AVR with the SPI interface, the pinout shown in Figure 4.6, “SPI header pinout” should be used.

Figure 4.6. SPI header pinout

SPI header pinout


AVR OCD Implementations

AVR XMEGA OCD (JTAG and PDI Physical)

The XMEGA OCD is otherwise known as PDI (Program and Debug Interface). Unfortunately due to a limitation on the AVR Dragon only newer Xmega devices is supported. See Known issuesTwo physical interfaces (JTAG and PDI Physical) provide access to the same OCD implementation within the device. It supports the following features:

  • Complete program flow control

  • 1 dedicated program address comparator or symbolic breakpoint (reserved)

  • 4 hardware comparators

  • Unlimited number of user program breakpoints (using BREAK)

  • No limitation on system clock frequency

For special considerations regarding this debug interface, see Special Considerations

AVR Mega OCD (JTAG)

The Mega OCD is based on the JTAG physical interface. It supports the following features:

  • Complete program flow control

  • Four program memory (hardware) breakpoints (1 is reserved)

  • Hardware breakpoints can be combined to form data breakpoints

  • Unlimited number of program breakpoints (using BREAK) (except ATmega128)

For special considerations regarding this debug interface, see Special Considerations

AVR Mega / Tiny OCD (debugWIRE)

The debugWIRE OCD is a specialised OCD module with a limited feature set specially designed for AVR devices with low pin-count. It supports the following features:

  • Complete program flow control

  • Unlimited Number of User Program Breakpoints (using BREAK)

  • Automatic baud configuration based on target clock

For special considerations regarding this debug interface, see Special Considerations


Chapter 5. Hardware description

Board Descriptions

  • Physical dimensions: ( H x W x D ) 53 x 105 x 15 mm

Figure 5.1.

Figure 5.2.


Headers

Out of the box, the AVR Dragon has the following 3 header connectors mounted:

  • ISP Header - Used for ISP programming and debugWIRE OCD

  • JTAG Header - Used for JTAG programming and JTAG OCD.

  • VCC Header - Used for powering Devices placed in the prototype area, or to power external target boards (max 300mA). Set to fixed 5V

Figure 5.3.

The following header are not mounted

  • HV_PROG Header

  • EXPAND Header

  • 40-pin DIP socket

  • 28-pin DIP socket

ISP Header (mounted)

This 6-pin header uses the standard AVR ISP pinout for easy connection to external targets. The signals are level-converted to allow communication with targets running at any voltage between 1.8 and 5.5V

Note that the target voltage must be applied to pin 2 on the ISP header for the AVR Dragons level converters.

Figure 5.4.

JTAG Header(mounted)

The 10-pin JTAG header is a standard pinout JTAG connector. When connecting the AVR Dragon JTAG header to an external target, the signals are level converted to match the target board voltage. This is done automatically. Please note that the AVR Dragon will not power the target through the JTAG interface. The target needs to be powered through a dedicated powersupply. (or by powering it using the VCC connector (5.0V max 300mA). AVR Dragon needs to sense the target voltage on pin 4 on the JTAG connector.

Figure 5.5.

Table 5.1.

Pin | Signal | I/O | Description
1 | TCK | Output | Test Clock, clock signal from AVR Dragon to target JTAG port
2 | GND | - | Ground
3 | TDO | Input | Test Data Output, data signal from target JTAG port to AVR Dragon
4 | VTref | Input | Target reference voltage. VDD from target used to control level-converter
5 | TMS | Output | Test Mode Select, mode select signal from AVR Dragon to target JTAG port
6 | nSRST | In/Out-put | Open collector output from adapter to the target system reset. This pin is also an input to the adapter so that the reset initiated on the target may be reported to the AVR Dragon
7 | - | - | Not connected
8 | - | - | Not Connected
9 | TDI | Output | Test Data Input, data signal from AVR DragoI to target JTAG port
10 | GND | - | Ground

HV_PROG Header (not mounted)

The HV_PROG connector contains all signal required to do HVSP or PP programming. The signals on this connector is not level-converted, and should only be connected to the EXPAND connector on the AVR Dragon. You could damage both your target and the AVR Dragon if you try to do HVSP or PP on an external target board. The signal levels on the HV_PROG header are 5V.

Figure 5.6.

The figure above shows the general pinout of the HV_PROG header. The High Voltage programming pin mapping are not the same for all parts. See the HVSP Description or PP Description chapters for more information on the pinout of this header.

VCC Header (mounted)

Figure 5.7.

The VCC Header contains 5.0 Volt VCC and GND that must be used to power the target device placed in the prototype area of the AVR Dragon board. The voltage can also be used to power an external target board, but it is important that the current consumption is less than 300mA. Please note that the AVR Dragon current sourcing capabilities are also limited by the amount of current the Host USB controller can deliver.

EXPAND Header (not mounted)

Figure 5.8.

The expand connector is directly mapped to the 28 and 40-pin DIP sockets. Pin 1 on the connector - is pin one on both the 28 and the 40pin DIP socket. When doing either programming or emulation on-board, the appropriate signals should be routed from the ISP, JTAG, VCC and HV_PROG headers to the correct pins on the EXPAND connector. Please read the "Using the AVR Dragon Prototype Area" section for more information on how to use this function.

Status LEDs

Figure 5.9.

Two LEDs show the status of the AVR Dragon. Check the Troubleshooting Guide to check for solutions if there are any errors.

Table 5.2.

LED # | Color | Description
2 | Green | Indicates USB traffic
Red | Idle, not connected to AVR Studio |
Dark | Idle, connected to AVR Studio |
Green | Data Transfer |
Yellow | Firmware Upgrade or Initialization |


Onboard Prototype Area

The AVR Dragon has layout for a 40-pin and a 28-pin PDIP socket. The DIP socket pins are connected directly to the 40-pin Header connector. By strapping the ISP, JTAG, HV_PROG and VCC header signals to the 40-pin header connector programming or emulation can be preformed without the need for an external target board.

This section shows how to strap the AVR Dragon for different operation modes. Each supported AVR device has its own Device Connection Sheet containing all information required.

There is a number of ways to utilize the prototype area. If only one device type / programming mode is to be used, the easiest and cheapest way is to just solder wires directly from the HV_PROG, ISP, JTAG and VCC headers to the EXPAND header. Howerver, to make the board more flexible header connectors can be soldered in to allow using cables to be connected without soldering.

Here is a suggestion how to modify the AVR Dragon board to make it flexible and able to use all DIP socket AVR devices.

In this picture one 20-pin header connector, a 40-pin header connector and a 40-pin DIP socket has been soldered onto the AVR Dragon.

To make it even more flexible and allow for narrow DIP packages, a ZIF (Zero Insertion Force) DIP socket has been added in the picture above. Additional sockets can be bought from third party vendors to support MLF/QFN, TQFP, SOIC etc packages. (Link: http://www.atmel.com/products/AVR/thirdparty.asp#adapters)

And finally the complete setup for debugWIRE and ISP programming of the ATtiny45. For details on how this is connected please have a look at the ATtiny45 Device connection sheet


Chapter 6. Software Integration

AVR Studio 4

AVR studio 4 integration

AVR Studio 4 is an Integrated Development Environment (IDE) for writing and debugging AVR applications in Windows 9x/ME/NT/2000/XP/VISTA environments. AVR Studio provides a project management tool, source file editor, simulator, assembler and front-end for C/C++, programming, emulation and on-chip debugging.

AVR Studio 4.09 or later must be used in conjunction with the AVR Dragon.

Programming options

AVR Studio 4 supports programming of AVR devices using the AVR Dragon. The programming dialog can be configured to use JTAG, SPI or PDI(selected devices) modes, according to the target device selected.

The clock frequency can only be configured for the SPI interface. For JTAG and PDI(selected devices) interfaces, programming is done asynchronously to the target's clock.

Debug options

When debugging an AVR device using AVR Studio 4, the AVR Dragon options dialog contains some important configuration options. Those options which need further explanation are:

  • Target clock frequency

    Target clock frequency: Accurately setting the target clock frequency is vital to achieve realiable debugging of MegaAVR device over the JTAG interface. This setting should reflect the lowest operating frequency of your AVR target device in the application being debugged. See the special considerations section for more information.

    Debug sessions on debugWIRE target devices are clocked by the target device itself, and thus no frequency setting is required. The AVR Dragon will automatically select the correct baud rate for communicating at the start of a debug session.

    XMEGA target devices will be clocked at maximum speed for JTAG and a constant 1MHz clock for PDI(selected devices). No synchronization is required for XMEGA devices so the clock is not configurable.

    *Supports only Xmega devices in the A4 series and newer, see the Device Support page for a complete list)

  • Disable debugWIRE

    Disable debugWIRE: When the DWEN fuse is programmed, the debugWIRE OCD module takes control of the RESET line. This means that the SPI interface is no longer accessible. Using the disable debugWIRE button while debugging will instruct the debugWIRE module to temporarily disable itself, thus allowing SPI programming to take place.

    Note that if target power is toggled before DWEN is cleared using SPI, the debugWIRE interface will be re-enabled.

    Note that if the SPIEN fuse has been cleared, the disable debugWIRE button will disable debugWIRE temporarily, but the SPI interface will not be enabled.

    See the special considerations section for more information regarding enabling and disabling debugWIRE.

  • Run timers in stopped mode

    Run timers in stopped mode. This option allows the target device's timers to continue running at their normal speed when single stepping through the code. When this box is not checked, timers will run cycle-correctly but synchronized to the stepping through the code.

  • Preserve EEPROM contents when reprogramming device

    Select this option to avoid erasing the EEPROM during reprogramming of the target before a debug session.

  • Always activate external reset when reprogramming device

    If your target application disables the JTAG interface, the external reset must be pulled low during programming. Selecting this option avoids repeatedly being asked whether to use the external reset.

  • Print breakpoint information in output window

    Enabling this feature causes breakpoint information to be dumped into the message output window during a debug session.

  • Disable use of BREAK instruction for breakpoints

    The AVR Dragon can only use as many hardware breakpoints as the target's OCD module provides. When further comparators are unavailable, the AVR Dragon will insert BREAK instructions in the code. This feature can be disabled by checking this box.

    Note, a manually inserted BREAK instruction is not affected by this function. To get passed a manually inserted BREAK instruction, right click on the source line below the BREAK instruction and use the "Set next statement" function.

  • Enable I/O Debug Register (IDR) in run mode

    When checked, this option allow parts which share the same I/O location for IDR and OSCCAL to output IDR events. IDR events are generated when the application writes to the IDR register.

    Note: IDR is also known as OCDR, and is not available on debugWIRE OCD

  • PWM

    The PWM tab is only active for the AT90PWM2/3 parts. The power stage controllers and analog comparators can be configured to RUN when the device is in stopped mode.

Firmware upgrade

For preparations: FW upgrade preparations

Firmware upgrade is performed by launcing AVR Studio 4, and select: "Tools"->"AVR Dragon Upgrade" from the Tools menu

Firmware upgrade can also be achieved using the command line utility: FW upgrade from command line section.


Command line utility

Programming

AVR Studio 4 is shipped with a command line tool to perform progamming tasks with the AVR Dragon. It is located at [INSTALL PATH]\Atmel\AVR Tools\AvrDragon\avrdragon.exe or equivalent. Here is how to use it.

Usage: avrdragon.exe [commands] [options]
Commands:
 -h, -?         Print this help.
 -he            Print exit codes.
 -e             Erase device.
 -f <fusebytes> Write high/low fuse bytes. The LSB of fusebytes will be
                written to the low fuse byte, and the MSB will be written
                to the high fuse byte.
 -j <ID>        Read JTAG ID string. If an optional ID is specified, the
                program will terminate if the read ID differs.
 -l <lockbyte>  Set the lock byte to the specified value.
 -p[f|e|b]      Program FLASH (-pf), EEPROM (-pe) or both (-pb) memories.
                Requires input files specified with the -if (FLASH)
                and/or -ie (EEPROM) options.
 -q             Read fuse bytes. If the selected device has extended fuse,
                it will be also be read.
 -r[f|e|b]      Read FLASH (-rf), EEPROM (-re) or both (-rb) memories.
                Requires output files specified with the -of (FLASH) and/or
                -oe (EEPROM) options.
 -s             Read signature bytes.
 -v[f|e|b]      Verify FLASH (-vf), EEPROM (-ve) or both (vb) memories.
                Requires input files specified with the -if (FLASH) and/or
                -ie (EEPROM) options.
 -y             Read lock byte.
 -E <ext.fuse>  Write extended fuse byte.
 -F <fusebytes> Verify high/low fuse bytes. The LSB of fusebytes will be
                compared to the low fuse byte, and the MSB will be compared
                to the high fuse byte.
 -L <lockbyte>  Verify the lock byte.
 -G <ext.fuse>  Verify the extended fuse byte against the given value.
 -O <address>   Read oscillator calibration byte. Address is location of byte
                as specified in the device's data sheet.
 -S[f|e] <address>
                Write oscillator calibration byte read with -O or -Z to given
                location in FLASH (-Sf) or EEPROM (-Se).
 -W             Disable debugWIRE interface, enabling ISP mode. Only available
                for debugWIRE devices.
 -Y             Perform the oscillator calibration sequence. See appnote
                AVR053 for more information.
 -Z <address>   Load value from address in EEPROM prior to erasing the device.
                This value can be written to FLASH or EEPROM again with
                the -S[f|e] command.

Options:
 -ae <start>,<end>
                Specify address range for reading EEPROM memory. Default is
                entire memory.
 -af <start>,<end>
                Specify address range for reading FLASH memory. Default is
                entire memory.
 -c <port>      Optional. Specify port to connect to. Can only be USB with
                AVR Dragon serial number specified. Ex: -c USB:00A00000002C
 -d <device>    [required] Specify the type of device.
 -ie <file>     Specify input file for programming EEPROM memory.
 -if <file>     Specify input file for programming FLASH memory.
 -m[i|j|p]      Choose programming mode: ISP (-mi), parallel/high-voltage (-mp)
                or JTAG (-mj) (default).
 -oe <file>     Specify output file for reading EEPROM memory.
 -of <file>     Specify output file for reading FLASH memory.
 -z             No progress indicator. Useful when redirecting output to file.
 -D <devsbefore,devsafter,bitsbefore,bitsafter>
                Set daisy chain settings. Only available in JTAG mode.
 -I <speed>     Specify ISP frequency (Hz). Only available for ISP mode.
 -J <speed>     Specify device speed (Hz). Only available for JTAG mode.
 -R             Apply external reset while programming. Only available in
                JTAG mode.

Example usage: avrdragon.exe -d ATmega128 -e -pf -if c:\tmp\test.hex

Firmware upgrade

For preparations: FW upgrade preparations

Firmware upgrade can be achieved using the command line utility:

[INSTALL PATH]\Atmel\AVR Tools\AvrDragon\avrdragon.exe


Chapter 7. Special Considerations

XMEGA OCD

OCD and clocking

When the MCU enters stopped mode, the OCD clock is used as MCU clock. The OCD clock is either the JTAG TCK if the JTAG interface is being used, or the PDI_CLK if the PDI interface is being used.

The AVR Dragon does not offer a variable clock rate for XMEGA targets.

SDRAM refresh in stopped mode

When the OCD is in stopped mode, the MCU is clocked by the PDI or JTAG clock, as described in the paragraph above. Since nothing is known of this frequency by the debugger or OCD, a low refresh period (0x10) is automatically used. This value can't be changed by the user.

I/O modules in stopped mode

Unlike most ATmega devices, in XMEGA the I/O modules are stopped in stop mode. This means that USART transmissions will be interrupted, timers (and PWM) will be stopped.

Hardware breakpoints

There are four hardware breakpoint comparators - 2 address comparators and 2 value comparators.They have certain restrictions:

  • All breakpoints must be of the same type (program or data)

  • All data breakpoints must be in the same memory area (IO, SRAM or XRAM)

  • There can only be one breakpoint if address range is used

Here are the different combinations that can be set:

  • 2 single data or program address breakpoints

  • 1 data or programm address range breakpoint

  • 2 single data address breakpoints with single value compare

  • 1 data breakpoint with address range, value range or both

AVR Studio will tell you if the breakpoint can't be set, and why. Data breakpoints have priority over program breakpoints, if software breakpoints are available.

The data breakpoint help can be found here. However, not all "Break when" options are supported by the XMEGA. Also, data breakpoints in EEPROM is not supported.

External reset and PDI physical

The PDI physical interface uses the reset line as clock. While debugging, the reset pullup should be 10k or higher, or be removed altogether. Any reset capacitors should be removed. Other external reset sources should be disconnected.


Mega OCD and debugWIRE OCD

IO Peripherals

Most I/O peripherals will continue to run even though the program execution is stopped by a breakpoint. Example: If a breakpoint is reached during a UART transmission, the transmission will be completed and corresponding bits set. The TXC (transmit complete) flag will be set and will be available on the next single step of the code even though it normally would happen later in an actual device.

All I/O modules will continue to run in stopped mode with the following two exceptions:

  • Timer/Counters (configurable using the software front-end)

  • Watchdog Timer (always stopped to prevent resets during debugging)

Single Stepping I/O access

Since the I/O continues to run in stopped mode, care should be taken to avoid certain timing issues. For example, the code:

OUT PORTB, 0xAA

IN TEMP, PINB

When running this code normally, the TEMP register would not read back 0xAA because the data would not yet have been latched physically to the pin by the time it is sampled by the IN operation. A NOP instruction must be placed between the OUT and the IN instruction to ensure that the correct value is present in the PIN register.

However, when single stepping this function through the OCD, this code will always give 0xAA in the PIN register since the I/O is running at full speed even when the core is stopped during the single stepping.

Single stepping and timing

Certain registers need to be read or written within a given number of cycles after enabling a control signal. Since the I/O clock and peripherals continue to run at full speed in stopped mode, single stepping through such code will not meet the timing requirements. Between two single steps, the I/O clock may have run millions of cycles. To successfully read or write registers with such timing requirements, the whole read or write sequence should be performed as a atomic operation running the device at full speed. This can be done by using a macro or a function call to execute the code, or use the run-to-cursor function in the debugging environment.

Accessing 16-bit Registers

The AVR peripherals typically contain several 16-bit registers that can be accessed via the 8-bit data bus (eg: TCNTn of a 16-bit timer). The 16-bit register must be byte accessed using two read or write operations. Breaking in the middle of a 16-bit access or single stepping through this situation may result in erroneous values.

Restricted I/O register access

Certain registers cannot be read without affecting their contents. Such register include those which contain flags which are cleared by reading, or buffered data registers (eg: UDR). The software front-end will prevent reading these registers when in stopped mode to preserve the intended non-intrusive nature of OCD debugging. In addition, some registers cannot safely be written without side-effects occurring - these registers are read-only. For example:

  • Flag registers, where a flag is cleared by writing '1' to any bit. These registers are read-only.

  • UDR and SPDR registers cannot be read without affecting the state of the module. These registers are not accessible.


Mega OCD (JTAG)

Software breakpoints

Since it contains an early OCD module, ATmega128[A] does not support the use of the BREAK instruction for software breakpoints.

JTAG clock

The target clock frequency must be accurately specified in the software front-end before starting a debug session. For synchronisation reasons, the JTAG TCK signal must be less than one fourth of the target clock frequency for reliable debugging. Setting the target clock frequency too high will cause failure of a debug session shortly after programming completes. This may be accompanied by several spurious SLEEP, WAKEUP or IDR messages being displayed. When programming via the JTAG interface, the TCK frequency is limited by the maximum frequency rating of the target device, and not the actual clock frequency being used.

When using the internal RC oscillator, be aware that the frequency may vary from device to device and is affected by temperature and VCC changes. Be conservative when specifying the target clock frequency.

See the software integration section for details on how to set the target clock frequency using the software front-end.

JTAGEN and OCDEN fuses

The JTAG interface is enabled using the JTAGEN fuse, which is programmed by default. This allows access to the JTAG programming interface. Through this mechanism, the OCDEN fuse can be programmed (by default OCDEN is un-programmed). This allows access to the OCD in order to facilitate debugging the device. The software front-end will always ensure that the OCDEN fuse is left un-programmed when terminating a session, thereby restricting unnecessary power consumption by the OCD module. If the JTAGEN fuse is unintentionally disabled, it can only be re-enabled using SPI or PP programming methods.

If the JTAGEN fuse is programmed, the JTAG interface can still be disabled in firmware by setting the JTD bit. This will render code un-debuggable, and should not be done when attempting a debug session. If such code is already executing on the AVR device when starting a debug session, the AVR Dragon will assert the /RESET line while connecting. If this line is wired correctly, it will force the target AVR device into reset, thereby allowing a JTAG connection.

If the JTAG interface is enabled, the JTAG pins cannot be used for alternative pin functions. They will remain dedicated JTAG pins until either the JTAG interface is disabled by setting the JTD bit from the program code, or by clearing the JTAGEN fuse through a programming interface.

IDR events

When the application program writes a byte of data to the OCDR register of the AVR device being debugged, the AVR Dragon reads this value out and displays it in the message window of the software front-end. The IDR registers is polled every 100ms, so writing to it at a higher frequency will NOT yield reliable results. When the AVR device loses power while it is being debugged, spurious IDR events may be reported. This happens because the AVR Dragon may still poll the device as the target voltage drops below the AVR’s minimum operating voltage.


debugWIRE OCD

The debugWIRE communication pin (dW) is physically located on the same pin as the external reset (/RESET). An external reset source is therefore not supported when the debugWIRE interface is enabled.

The debugWIRE Enable fuse (DWEN) must be set on the target device in order for the debugWIRE interface to function. This fuse is by default un-programmed when the AVR device is shipped from the factory. The debugWIRE interface itself cannot be used to set this fuse. In order to set the DWEN fuse, SPI mode must be used. The software front-end handles this automatically provided that the necessary SPI pins are connected. It can also be set using SPI programming from the AVR Studio 4 programming dialog.

  • Either:

    Attempt to start a debug session on the debugWIRE part. If the debugWIRE interface is not enabled, you will AVR Studio 4 will offer to retry, or attempt to enable debugWIRE using SPI programming. If you have the full SPI header connected, debugWIRE will be enabled, and you will be asked to toggle power on the target - this is required for the fuse changes to be effective.

  • Or:

    Open the programming dialog in SPI mode, and verify that the signature matches the correct device. Check the DWEN fuse to enable debugWIRE.

    Note: is it important to leave the SPIEN fuse programmed, the RSTDISBL fuse unprogrammed! Not doing this will render the device stuck in debugWIRE mode, and high-voltage programming will be required to revert the DWEN setting.

To disable the debugWIRE interface, use high-voltage programming to unprogram the DWEN fuse. Alternately, use the debugWIRE interface itself to temporarily disable itself, which will allow SPI programming to take place, provided that the SPIEN fuse is set.

Note: If the SPIEN fuse was NOT left programmed, AVR Studio will not be able to complete this operation, and high-voltage programming must be used.

  • Either:

    During a debug session, open the AVR Dragon options dialog. Click on the 'disable debugWIRE' button. DebugWIRE will be temporarily disabled, and AVR Studio will use SPI programming to unprogram the DWEN fuse.

  • Or:

    Use the command line utility with the -W option. DebugWIRE will be temprarily disabled. Then use SPI programming to unprogram the DWEN fuse.

    Note that if target power is toggled before DWEN is cleared using SPI, the debugWIRE interface will be re-enabled.

Having the DWEN fuse programmed enables some parts of the clock system to be running in all sleep modes. This will increase the power consumption of the AVR while in sleep modes. The DWEN Fuse should therefore always be disabled when debugWIRE is not used.

When designing a target application PCB where debugWIRE will be used, the following considerations must be made for correct operation:

  • Pull-up resistors on the dW/(/RESET) line must not be smaller (stronger) than 10kΩ. The pull-up resistor is not required for debugWIRE functionality, since the debugger tool provides this

  • Connecting the /RESET pin directly to VCC will cause the debugWIRE interface to fail

  • Any stabilising capacitor connected to the /RESET pin must be disconnected when using debugWIRE, since it will interfere with correct operation of the interface

  • All external reset sources or other active drivers on the /RESET line must be disconnected, since they may interfere with the correct operation of the interface

Never program the lock-bits on the target device. The debugWIRE interface requires that lock-bits are cleared in order to function correctly.


Chapter 8. Troubleshooting

Troubleshooting Guide

Table 8.1. Troubleshooting Guide

Problem | Possible Causes | Solution
Signature Bytes read as 0x00 0x00 0x00 | ISP Frequency is to high. | Lower ISP freq under the board settings
Not able to communicate with device through debugWIRE | RESET pullup resistor to small | Remove or increase the pull-up value to 10K ohm or more.
Not able to communicate with device through debugWIRE | Decoupling Capasitor destroys communication on RESET line | Remove Decoupling capasitor on reset line during debugWIRE emulation
debugWIRE communication fails when using STK500 | RESET line strongly tied to VCC | Remove RESET jumper on STK500 to allow AVR Dragon to control the line.
After successfully enabling the DWEN fuse, AVR Dragon is not able to enter debug mode | RESET line strongly tied to VCC | Remove RESET jumper on STK500 to allow AVR Dragon to control the line.
Target voltage is read as 0V for on-board targets | AVR Dragon get no reference voltage to the target voltage sensing. Target voltage is sensed from either pin 2 on ISP header or pin 4 on the JTAG header. | In order to get reference voltage to the level converters of AVR Dragon, connect Pin 2 or 4 or 6 on the VCC header to pin 2 on ISP header or pin 4 on the JTAG header. Note that VCC pins on AVR Dragon are set to 5V and this procedure should therefore not be used for off-board targets.
Target voltage is read as 0V for off-board targets. | AVR Dragon get no reference voltage to the target voltage sensing. Target voltage is sensed from either pin 2 on ISP header or pin 4 on the JTAG header. | Connect the target voltage from the target board to pin 2 on ISP header or pin 4 on the JTAG header.
Not able to set ISP frequency | AVR Dragon is not reading any target voltage. | See above
ISP/PP/HVSP programming fails | AVR Dragon is not reading any target voltage | See above
Not able to connect to AVR Dragon, and status led is yellow | AVR Dragon firmware upgrade failed, or firmware is corrupt. | Go to the menu "Tools->Upgrade AVR Dragon" to perform a manual upgrade.


Chapter 9. Firmware Upgrade

Preparations

The AVR Dragon can be upgraded by the end user as new firmware becomes available to provide support for new parts and families, as well bugfixes.

Before commencing an upgrade, be sure to terminate any active debug session and disconnect the probe from the application being debugged.


Execution

To upgrade the firmware on the AVR Dragon you need to have the proper software installed. See the Software assisted FW upgrade section for more information on upgrading the firmware


Index

C

connecting, Connecting the AVR Dragon

D

debugWIRE, debugWIRE

J

JTAG, JTAG

O

OCD, Introduction to On-Chip Debugging (OCD)
AVR MEGA, AVR Mega OCD (JTAG)
AVR Mega
AVR Tiny, AVR Mega / Tiny OCD (debugWIRE)
AVR XMEGA, AVR XMEGA OCD (JTAG and PDI Physical)

P

PDI, PDI Physical

S

Special Considerations, Special Considerations
Mega, Mega OCD and debugWIRE OCD
debugWIRE, debugWIRE OCD
JTAG, Mega OCD (JTAG)
XMEGA, XMEGA OCD
SPI, SPI

T

Troubleshooting, Troubleshooting Guide