Pointless Circuits

- Programming, Electronics and Breaking Things. -

AVR Serial Bootloader Generator

FastBoot

Peter Danneggers’s FastBoot (German) is a serial bootloader for AVR microcontrollers. A serial bootloader is a program running on the microcontroller, allowing for the device to be programmed using a serial line. FastBoot seems to be widely used, as it has many neat features:

  • Soft UART: any pin can be used for send/receive.
  • One-wire mode: can use a single pin for both send and receive.
  • Baudrate detection: send at any baudrate, if it’s physically possible, FastBoot will handle it.
  • Small size: Written in assembler to keep it tiny. It uses only 256 words (512 bytes) of flash.
  • Wide range of supported devices: From ATtiny to ATmega, see below.

Sound’s great? It is! The only pain is the generation of the actual bootloader firmware if you’re using GNU tools. With every update of avr-gcc, ugly bash scripts break and need some unnerving fiddling. You also need to register at atmel.com and download several hundred MB just for some .inc files. This site is here to generate the bootloader as frictionless as possible!

Serial Bootloader HOWTO

Step 1: Generate the bootloader firmware

Select the AVR model from the dropdown list and enter your ports and pins in the input fields. If you want to use the one-wire mode, simply enter the same port and pin for send an receive. Click on “Generate Bootloader” and your browser should download the bootloader with the requested properties. The format is Intel’s hex format, readable by most (if not all) programming software.

Receive port (RX):

Receive pin (RX):

Transmit port (TX):

Transmit pin (TX)

Clock frequency (Hz)

Step 2: Program and set fuses

Burn the downloaded hex file onto your controller using your preferred method (e.g. ISP).

To enable the bootloader, you need to set some fuses (fusecalc might be helpful), namely:

  • BOOTRST (SELFPRGEN for some chips) needs to be set (0).
  • BOOTSZ (if available) needs to be set to at least 256 words. You’ll probably need to consult the datasheet for the right combination.

Step 3: Host software

Now that the controller is set up for uart programming, it needs some software on the host PC to talk to.

Linux

Boregard’s FBoot-Linux works well for me.

Windows

UpdateLoader (German) is the recommended Windows host, even comes with a GUI.

Mac

Boregard’s FBoot-Linux works on OS X as well.

Step 4: Connect the UART

Setup your serial connection like you’re used to, e.g. with a USB to TTL converter. If you’re using the one-wire mode, connect the PC side receive pin straight to the AVR pin and the PC side transmit pin through a 4k7 resistor.

Step 5: Program over UART

Fire up your host program of choice and start the transmit. If you haven’t connected the reset line, manually reset the controller now. After a reset, the AVR will for a short time (~0.3 seconds) wait for FastBoot to kick in, if that doesn’t happen, your actual application starts.

General remarks

I have only tested this online tool with a small number of MCUs (see dropdown list). If you get it to work on one of the other devices, please leave a comment so I can mark it as tested.

The original code for fastboot was released under the GPL, so I am obliged to provide the source code for the binary forms of the programs I offer for downloading. I set up a git repository which should enable you to build the bootloader yourself. Just replace the values in the beginning of the Makefile with the ones you entered above.

Project updates

  • Oct 16th 2015: App not working due to server migration issues.
  • Oct 26th 2015: Migration issues resolved.
  • Nov 13th 2017: App running again after pointless-circuits.com was offline for ages. New migration might lead to new issues, keep fingers crossed!

Comments