6.1.3 Debug Options
When debugging a Microchip AVR device, there are some important configuration options. These are found in the Atmel-ICE section in the 'Project Properties' in MPLAB X IDE, or the 'Tool' tab in the project properties view in Atmel Studio. The options which need further explanation are detailed here.
Target Clock Frequency
Accurately setting the target clock frequency is vital to achieving reliable debugging of a Microchip megaAVR device over the JTAG interface. This setting should be less than one-fourth of the lowest operating frequency of your AVR target device in the application being debugged. See megaAVR® Special Considerations for more information.
Debug sessions on debugWIRE target devices are clocked by the target device itself, and thus no frequency setting is required. The Atmel-ICE will automatically select the correct baud rate for communicating at the start of a debug session. However, if you are experiencing reliability problems related to a noisy debug environment, some tools offer the possibility to force the debugWIRE speed to a fraction of its ‘recommended’ setting.
Debug sessions on AVR XMEGA target devices can be clocked at up to the maximum speed of the device itself (usually 32 MHz).
Debug sessions on AVR UC3 target devices over the JTAG interface can be clocked at up to the maximum speed of the device itself (limited to 33 MHz). However, the optimal frequency will be slightly below the current SAB clock on the target device.
Debug sessions on UC3 target devices over the aWire interface will be automatically tuned to the optimal baud rate by the Atmel-ICE itself. However, if you are experiencing reliability problems related to a noisy debug environment, some tools offer the possibility to force the aWire speed below a configurable limit.
Debug sessions on SAM target devices over the SWD interface can be clocked at up to ten times the CPU clock (but limited to 2 MHz max.)
Preserve EEPROM
In Atmel Studio, there is an option called 'Preserve EEPROM' in the project properties view. Select this option to avoid erasing the EEPROM during the reprogramming of the target before a debug session. In MPLAB X IDE, there is no such option. Instead, the EESAVE fuse must be set explicitly.
Use External Reset
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. This option is currently only available in Atmel Studio.