Advertisement

AVR Bootloader – Tutorial #18

Here you can learn many more interesting and useful about USB bootloaders for AVR microcontrollers. In practice, one of the most proper microcontroller programming method is using a bootloader program,because you don’t need any special external programming hardwares or special programming skills. All you just need is to connect a standard cable from your PC to the target microcontroller board and run special program on PC which communicates with MCU bootloader program!

Almost all AVR ATmega family microcontrollers have ability to be programmed with bootloader. Bootloaders can be various sizes and can use different algorithms and interfaces (I2C, USART, SPI, USB…) from where program will be loaded.

The Program start address depends on AVR fuse settings, ie if fuse settings instructs that program counter has to jump to bootloader section after the reset operation, then first of all, the bootloader has to be executed. In short, if a microcontroller is preconfigured, then after the reset event, it starts running not from the default start memory location (usually at 0×0000 address) but at some specific location, where usually bootloader resides.

AVR18-1

Note that most of AVR bootloaders are using COM port for connectivity with the PC, and for our convenience these can be adapted to USB by using USART to USB hardware bridges. But it is more flexible if USB can be interfaced directly to the MCU and communication task is done by firmware USB driver, without any additional hardware.

Firmware-Only USB Drivers

As said, it is very convenient to use any microcontroller design integrated with a ‘firmwareonly usb driver’ system, because it allows us to handle usb connectivity (and programming) without any external hardware dongle. But how, from where we get a suitable one? One answer to this FAQ is V-USB’s ‘BootloadHID’. This USB driver is a firmware-only implementation of the USB 1.1 standard (low speed device) on cheap single chip microcomputers of Atmel’s AVR series!

AVR18-0

BootloadHID is a USB boot loader for AVR microcontrollers. It can be used on all AVRs with at least 2 kB of boot loader section, like our ATMega8. The firmware is flashed into the upper 2 kB of the flash memory and takes control immediately after reset. If a certain hardware condition is met, the boot loader waits for data on the USB interface and loads it into the remaining part of the flash memory. If the condition is not met, control is passed to the loaded firmware. The uploader tool requires no kernel level driver on Windows and can therefore be run without installing any DLLs. You may get all about this from here http://www.obdev.at/products/vusb/index.html

(microcontroller design with usb-only firmware-an example)

(microcontroller design with usb-only firmware-an example)

Imagine that you are in a plan to make your own microcontroller board with usb-only firmware,which allows the end-user to modify the pre-installed program just by using his computer with a GUI (graphical user interface) through a standard usb cable. No doubt, this is a positive business move.

For implementing this smart idea, you should know that:

  • bootloader is a software which can replace the hardware programmer
  • programming can be done by using a serial (usb)connection
  • you will need a ‘bootloader’ program (opensource/custom)
  • you need to program a fuse to tell it to use the bootloader
  • you will need a programmer at first to upload the bootloader
  • you won’t ever need the programmer again

→ Part 19: Working With Bootloaders & Build Your Own Bootloader
← Part 17: AVR & Robotics

One Comments

Join the conversation!

Error! Please fill all fields.
Looking for the latest from TI?