3.1.4 Disabling the debugWIRE Interface

Disabling debugWIRE can be done either by:
  • Selecting “Disable DebugWIRE and close” from the Debug menu during a debug session, or
  • Using Atmel Studio command line programming utility: atprogram.exe

    atprogram.exe -t powerdebugger -i debugwire -d atmega328pb dwdisable 
    and then using ISP to clear DWEN, either in the Atmel Studio programming dialog, or using atprogram.exe:
    • Read the high fuse (offset 1)
      atprogram.exe -t powerdebugger -i isp -d atmega328pb read -fs -s 1 -o 1 --format hex
    • OR the output value with 0x40 (DWEN is bit 6)
    • Write the value back to the high fuse (offset 1)
      atprogram.exe -t powerdebugger -i isp -d atmega328pb write -fs -o 1 --values <new_fuse_value>
CAUTION: Take extreme care when writing fuses on the target device. Modifying the wrong fuse can result in the Xplained Mini kit being permanently unusable.