6.2 AVR Studio 4

6.2.1 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.

6.2.2 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 modes, according to the target device selected.

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

6.2.3 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. No synchronization is required for XMEGA devices so the clock is not configurable.

  • 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.

6.2.4 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.