Though an emulator is quite useful for debugging code that has no side effects, most real-world applications include some circuitry besides the Arduino. If a microcontroller on an Arduino had a JTAG interface, it would be pretty straight-forward, but what if it's e.g. an Arduino Uno?

share|improve this question
3  
Could you elaborate on what you are trying to accomplish? Its not clear from the question that what exactly do you want to debug. – AsheeshR Feb 27 '14 at 12:24
2  
@AsheeshR The only thing that is possible to debug on Arduino is source code. There's a set of tools called "debuggers", which employ breakpoints, step-by-step evaluation etc. I don't understand your question. – polkovnikov.ph Feb 27 '14 at 15:12
    
@jippie You're wrong about that. DebugWire yes, but JTAG No. The ATMega168/368 has no JTAG support whatsoever. If you do a quick search of the datasheet you will not find any reference to JTAG – Madivad Feb 27 '14 at 15:15
    
@Madivad Is it possible to make another Arduino into USB to DebugWire connector? – polkovnikov.ph Feb 27 '14 at 15:17
1  
It seems there is possibility for interactive debugging with this tool: visualmicro.com/post/2012/05/05/Debug-Arduino-Overview.aspx it is not free but it is quite cheap. I haven't used it myself so I don't want to provide an answer for it. – jfpoilpret Feb 27 '14 at 22:47
up vote 6 down vote accepted

The Arduino Uno uses the Atmel Atmega328p microcontroller, which only has one debug option, DebugWire. There are a few tools that can work with it, but the least expensive and most commonly available is the AVR Dragon.

You can use AVR Studio 6 for this. You can use the .elf file file produced during the Arduino build process directly, but setting up the debugger is a little easier if you port the Arduino program to the AVR Studio. It's not difficult, but there are a lot of little pieces to deal with. There are guides online to help you through this.

share|improve this answer
    
Is there an AVR Dragon clone with open-source firmware? – polkovnikov.ph Feb 28 '14 at 13:28
    
Any links to those online guides? – polkovnikov.ph Feb 28 '14 at 13:30
    
There are MKII clones which will do debugwire with this chip, but I'm not aware of their open source hardware or software status, and am having trouble finding a good example easily. Here's one guide for using AVR Studio 6 with arduino projects: engblaze.com/… – Adam Davis Feb 28 '14 at 15:48

This might not be right for you but the Visual Micro plugin for Atmel Studio and Visual Studio has a usb debugger which only uses Arduino code.

In the background the debugger uses Serial which might affect some time sensitive applications.

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.