Main Content

This article describes how you can use an Arduino sketch running on one Arduino to control and debug another Arduino, or an AVR-Series micro-controller such as an ATTiny85. With some limitations, you can use the controlling Arduino to disassemble code, single step code, inspect and modify the current value of registers. I/O ports and SRAM and run code with a hardware breakpoint set. And, all you need to do this is the RESET pin on the target device, a >10K resistor pulling RESET to Vcc, and a standard, ATMega328-based Arduino to act as the controlling debugger. Because using another Arduino as the target device requires some changes to the target Arduino’s circuitry, this article is going to show how to use an ATTiny85 as the target device. A future article will go into the changes needed to use an Arduino as the target device. And, while most of these currently remain untested, the code I’m presenting is designed to ultimately support debugging the following AVR devices:

- Tiny13
- Tiny2313
- Tiny24/44/84
- Tiny25/45/85
- Tiny441/841
- Mega48A/PA
- Mega88A/PA
- Mega8u2/16U2/32U2
- Mega168A/PA
- Mega328
- Mega328P

FYI - this project is a work in progress, as there are some details I’m still working to unravel. So, if you experience problems trying to use this code, please check back here for possible future updates. In addition, I want to mention that much of what I’ve been able to accomplish was made possible by the hard work of others, such as David C W Brown and RikusW. Their work in deciphering the undocumented debugWire protocol was invaluable.”

Link to article