-
Notifications
You must be signed in to change notification settings - Fork 7
Arduino Leonardo Bootloader Process
The Arduino Leonardo process for updating the firmware operates in a slightly unexpected way that can be confusing for users (and programmers!). The process involves rebooting the device and swapping between two different serial ports.
Every Arduino Leonardo actually has two USB serial ports but, like Clark Kent and Superman, they are never seen together. These are actually one and the same serial port, but they appear different to Windows so it treats them like two completely different ports and they will have different COM port numbers.
The primary port is the one you will see most of the time and this is the one you connect to when the device is in normal operation. This port will show up as Arduino Leonardo (COMx)
in device manager. If your port doesn't show up correctly with that name, then you may need to update your serial drivers (please see troubleshooting for more information)
The second serial port only appears during firmware updates. This is known as the "bootloader" port and will appear as Arduino Leonardo bootloader (COMx)
in device manager. The bootloader normally runs for 5 seconds whenever the device is powered up. After 5 seconds, if no upload begins, the bootloader times out, the bootloader port is deactivated, the primary port is activated and the previously uploaded firmware begins to run. If you are quick, you'll be able to see the ports appearing and disappearing in Device Manager whenever you press the reset botton on your Arduino or connect the power.
To upload a new sketch (update the firmware), the device must be in bootloader mode. This requires that the device is rebooted and that's normally achieved by:
- pressing the RESET button
- cycling the power
- connecting to the primary serial port using a special combination of baud rate, parity and flow control that is not normally used. This is detected by the Arduino core software and causes the device to reboot.
The latter is the technique used by the Arduino IDE and the NexDome firmware update utility.
Connecting to the primary port using this special combination of settings causes the Arduino to reboot, and thus enter bootloader mode, giving a 5 second time window in which to start uploading new firmware. The firmware updater is able to detect the bootloader port and begin the firmware update process. Once the upload is complete and the sketch begins to run, the bootloader port is disabled and the primary port appears once again.