Arduino Leonardo Upload Differences

by Visual Micro 2. June 2012 08:15

The Arduino Leonardo is a usb device that works in a different way to older or existing Arduino hardware. When a Leonardo starts it breifly appears in programming mode on a different serial port to the one it normally uses.

When an Arduino upload request begins the specified Leonardo serial port is polled at 1200 baud causing the Leonardo to reset. If the port is not found, both the Arduino and Visual Studio IDEs assume that the Leonardo has been reset or was resetting/starting and skip the attempt to reset.

Both Visual Studio and the Arduino IDE, scan to detect the new programming port appearing in the computers serial ports list which indicates a Leonardo startup has been detected. If a new port is not detected then both IDEs' will wait for 5 seconds (on windows) before raising the error:- "Couldn’t find a Leonardo on the selected port. Check that you have the correct port selected. If it is correct, try pressing the board's reset button after initiating the upload."

On Microsoft windows, once the upload has completed, there is a 0.5 sec pause to ensure the Leonardo has re-booted and that the original serial port has re-connected.

After upload, Visual Studio confirms the actual upload port to the user using the "Sketch Output" tab. An example Leonardo upload message is shown below. Notice the switch from Leonardo serial COM37 to COM38

Compiling 'MySensor' for 'Arduino Leonardo'

Binary sketch size: 4844 bytes (of a 28672 byte maximum) (0.507 secs)

Uploading to I/O board using 'COM37'

Done uploading via 'COM38'

 

This document is a result of reading the source code for the arduino ide provided by arduino.cc