Skip to content

Program AVR devices with debugWIRE over just the RESET pin.

License

Notifications You must be signed in to change notification settings

mvirkkunen/dwprog

Repository files navigation

dwprog

Program AVR devices with debugWIRE over just the RESET pin.

What is debugWIRE?

debugWIRE is an undocumented protocol used on AVR microcontrollers, mostly supported by proprietary Atmel tools only. It can be used to debug and program AVR devices over just the debug pin.

This program enables you to flash AVR devices over debugWIRE. It can also be used to resurrect chips where the DWEN fuse has been accidentally programmed, as it cannot be disabled without first sending a debugWIRE disable command to the target.

Pros:

  • Uses only the reset pin so you can use the rest of the pins for anything.
  • No bootloader required so you can use the entirety of your tiny ATtiny's flash capacity.
  • Only two wires (ground and reset) required for flashing.

Cons:

  • Must be enabled before use by programming the DWEN fuse via ISP. This only needs to be done once, as the device remains in debugWIRE more with ISP disabled until it receives a a debugWIRE disable command.
  • The flashing speed is slow, ranging from 500 to 750 bytes per second depending on the serial adapter used. But it's meant for tiny projects anyway.
  • Cannot be used to program fuses.

Dependencies

  • pySerial
  • Optionally:
    • pyelftools - for ELF file support

Basic usage

dwprog.py -d attiny85 flash program.elf

Flash a program to an ATtiny85. ".hex" files also work.

dwprog.py identify

Detect the target device and report its name.

dwprog.py disable

Disable debugWIRE and re-enable ISP until the next power cycle. If you want to permanently disable it, issue the command and then reset the DWEN fuse using ISP.

dwprog.py --help

Display detailed help and all the command line switches for overriding automatic default behavior.

Hardware

dwprog talks to the AVR chip over a standard serial port, usually a USB to TTL converter. Below is a simple schematic for the connection. Note that the reset pull-up resistor in your project should be fairly large, such as 10k, in order for the 1k resistor in the adapter to overcome it.

Serial                     AVR

            1k
TX   o----/\/\/\----\
                     >---o RESET (note: use 10k resistor for pull-up)
RX   o--------------/

GND  o-------------------o GND

Because the adapter only requires two connections to the target, it's entirely feasible to leave out the programming connector completely and use two test clips to hook the programmer up to component legs. A two-pin header connection will also work.

About

Program AVR devices with debugWIRE over just the RESET pin.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages