Wireless Arduino Programming with Electric Imp

Pages
Contributors: Nate
Favorited Favorite 9

Bootloading 101

Now for a bit of history and bootloader basics:

Optiboot logo

The Optiboot Logo

There have been lots of serial bootloaders written throughout the years for lots of different microcontrollers. I wrote one for the PIC ages ago and one to wirelessly bootload Arduinos over XBee as well. The Arduino originally used the STK500 bootloader written by Atmel(see app note AVR061) that was then updated by Peter Knight and Bill Westfield to become the shrunk down Optiboot. Optiboot and a handful of similar bootloaders are what are installed on every ATmega328 based Arduino today.

The serial bootloader is activated each time the ATmega328/Arduino is powered up or reset. For a brief period of time (about 500ms), the microcontroller will listen for a special set of characters. If it hears nothing from the computer, then the ATmega will exit the bootloader and begin to run the user's code that resides in flash memory. However, if the microcontroller hears those special characters, then it will know that a new program needs to be downloaded and begins to wait for a HEX file to be sent. Normally this communication is done while connected to a computer (via a USB to serial connection), but anything capable of attaching to the serial port on the Arduino has the option to reprogram it. The Imp can talk serial with ease, and the fact that it connects to the world wide web so easily makes it a good choice for wirelessly bootloading your board.