How To Enable Arduino Debugging

by Visual Micro 5. May 2012 07:05

Note: Since version 1404 (Apr 2014) simple debugging is enabled for all configurations (debug/release/custom) by default.

To enable finer control of the debugger un-tick "Tools>Visual Micro>Automatic Debugging". In this mode the debugger can be enable for a specific configuration such as the Debug configuration (see tool bar)... 

Open the project properties window by clicking on the project name in the solution explorer and either pressing F4 (ALT+ENTER in Atmel Studio) or by selecting the menu "View>Properties Window".

Set the project property called "(Micro Debug)" to "Full" to enable Arduino usb debugging

The default debugger settings use the built in Arduino "Serial" port at 115200 and the projects local upload port/usb

Click the grey left side border next to source code to add breakpoints. Right click breakpoints to set properties such as variables to watch

Per Configuration

"Per configuration" settings means that the settings are saved based upon the current Visual Studio configuration such as "Release" or "Debug".

In the following example the configuration is set to "Debug"

The following example is using the default arduino software serial library.

Tip: The TX/RX pins in this example are the default so did not need to be entered. The same applies to the speed settings at 115200. To use the defaults you can simply set the transport to SoftwareSerial


To enable debug you do NOT need to add or alter any of your Arduino source code. ANY arduino project can be debugged.

Bear in mind that if you don't configure at least one source trace/break point(s) then you won't see very much in the trace other than an Arduino startup confirmation message.

To avoid confusion it is recommened that debug is enabled when Visual Studio is set to the "Debug" configuration. This then allows the configuration option to be used to quickly switch between a Release or Debug Arduino build and upload.

IMPORTANT WARNING - Enable Break/Pause causes the Arduino to STOP/WAIT when a breakable point in the source code is reached. You must only enable this option if you understand the consequences of the Arduino stopping and waiting for an F5 (continue) command. Further more, because the debug uses the serial port to communicate any transmission to the arduino serial port will cause the arduino to continue. REMOVE all propellers and consider the dangers of debug pause prior to using this feature! For this reason the default for this option is false (off) which forces all break points to become tracepoints regardless of their settings.

Other Pages