Friday, May 18, 2012

Bootloaders: How they Work.

Micro controller units are devices which contain a processing unit, programming and data memory and I/O. Early MCU's could not modify its program memory only the data memory. The program memory of present day MCU's can be modified with an in circuit programmer - ISP or ICSP - thru designated pins on the device or by the processor using special instructions.

A bootloader  is firmware, usually written into upper memory, which is executed when the MCU is reset. Typically, on reset, the bootloader waits for data to be input on the serial port and if this does not happen in a few seconds the bootloader jumps to the previously loaded code. If the data does start flowing, it is checked for correct protocol and loaded into program memory. The Atmel ATmega and the Microchip 18F MCU's handle bootloaders in a similar way.

A bootloader PC application interfaces with the MCU using the serial port. Before using the pc app to download the hex code, the reset switch at the MCU must be pressed. This sequence can be simplified by the PC application first triggering the serial port's DTR signal which at the MCU is connected to the reset pin. On the Arduino this is called auto reset.

No comments:

Post a Comment