4

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?

  • 5
    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
  • 1
    @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
  • 1
    DebugWire is an Atmel proprietary protocol, not much information available about it. – jippie Feb 27 '14 at 15:44
  • 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
6

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.

  • 1
    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
  • 1
    Doesn't this require removing a capacitor? – Peter Mortensen Sep 16 '17 at 11:42
  • 1
    @PeterMortensen I don't know, you'd have to examine the arduino uno schematic and the debugwire requirements along with your debugger's documentation. It may be worth asking a new question to get or share details of a specific setup. – Adam Davis Sep 16 '17 at 12:00
1

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

  • Will this really work on Arduino Uno? – Peter Mortensen Sep 16 '17 at 11:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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