4.5.1.5.1 debugWIRE Special Considerations

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 (DWEN) fuse must be set on the target device for the debugWIRE interface to function. This fuse is by default unprogrammed when the Microchip AVR device is shipped from the factory. The debugWIRE interface itself cannot be used to set this fuse. To set the DWEN fuse, the 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 manually using SPI programming in the software front-end.

Either:

Attempt to start a debug session on the debugWIRE part. If the debugWIRE interface is not enabled, the software front-end 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 Microchip Studio in SPI mode and verify that the signature matches the correct device. Check the DWEN fuse to enable debugWIRE.

Important:

It is important to leave the SPIEN fuse programmed and 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.

Important:

If the SPIEN fuse was NOT left programmed, the software front-end will not be able to complete this operation and High-Voltage programming must be used.

In MPLAB X IDE, if debugWIRE is enabled on the target device and an SPI programming session is attempted, the IDE will offer to disable debugWIRE first. In Microchip Studio, this must be done manually by, during a debug session, selecting the ‘Disable debugWIRE and Close’ menu option from the ‘Debug’ menu. debugWIRE will be temporarily disabled, and the software front-end will use SPI programming to unprogram the DWEN fuse.

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 than 10 kΩ. The pull-up resistor is not required for debugWIRE functionality since the debugger tool provides this.
  • Any stabilizing capacitor connected to the RESET pin must be disconnected when using debugWIRE since they 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 to function correctly.