Frustrated at not knowing why your Arduino code is doing something funky? Or perhaps you’re a battle-hardened veteran of the “sprinkle Serial.println() every other line” school of coding. We at EngBlaze have had our own bad days with tracking down obscure code problems, and Steve is here to help.
On his blog, Steve writes about getting his Arduino to talk to the Atmel AVR Dragon, a low cost (~$50) programmer and development board. The Dragon supports JTAG, ISP, and DebugWIRE communication. The latter is Atmel’s proprietary AVR debugging protocol, which uses only the RESET line to communicate, so it doesn’t tie up any precious I/O ports. Once everything is put together, you can use WinAVR and AVR Studio to step through your code and set breakpoints, just like on any desktop IDE. The article includes a detailed tutorial to let you hit the ground running.
Getting the Arduino successfully hooked up requires a slight modification to the board’s RESET line, and if you keep it that way you’ll have to manually reset the bootloader when you load new code. However, some would consider this a small price to pay for enabling real-world debugging while still being able to use Arduino functionality.