This project is a software USB Bootloader for Atmel© ATMega µControllers. It is based on
a software USB project v-usb .
This project includes build-scripts that are optimized for Windows Visual Studio nmake utility,
you will have to modify the makefiles, if you intend to use another make-utility.
The Bootloader requires some definitions from the main project, such as the clock speed and the
µController, that means the bootloader is not a standalone project, but it is intended to
be included in another project, which will create the main application, and the bootloader.
The BootLoader is compatible with 'Usb Bootloader' in FirmwareUI, use FirmwareUI to
communicate with this boot loader.
I have tested this bootloader with ATMega328p and with ATMega1284p devices, all running
with a 12MHz crystal. The software USB also supports CPU frequencies 12.8 MHz, 15MHz, 16MHz,
16.5MHz, 18MHz and 20MHz, however the 18MHz version might need some modifications in
avr/BootLoader/usbconfig.h, may have to set USB_CFG_CHECK_CRC = 1.
Please also read the data sheet for the specific µController, some devices
specify lower clock speeds when operated at power less than 5 V.
A sample project using the bootloader can be found in 'ATMega Tutorial 1' and
'ATMega Tutorial 2' on this web site.
Note The compiled size of the USB Bootloader is about 3 KBytes, that means the
target device must support bootloader with 4 KBytes or more (ATMega members with 32 KBytes Flash
and more allow for 4 KBytes bootloader size), in other words you cannot use this bootloader
with ATMega 8 or ATMega16 devices.
I save all my µController projects in a base-folder, e. g. avr-development; Unpack the contents of the zip file into the base-folder, which will result in the subfolders
The main buildfile must pass some parameters to the BootLoader build scripts. These Parameters are required:
This bootloader implements a HID device using public vendor and product id's, VID = 0x16c0, PID = 0xdf05.
The vendor name is "www.loewenwasser.de", and the Device name is "CUsbBootLdr".
The HID report descriptor defines two Report IDs, Report 1 has a length of 16 Bytes, Report 2
has a length of 34 Bytes.
Report 1 read:
Download UsbBootLoader.zip and unpck the contents to your BASE_FOLDER as described above.
It may happen very rare that the software USB disconnects while flashing
the application on ATMega 1284p devices (never saw it with ATMega 328p). I guess that this is a
timing issue when disabling interrupts to write the device, but I could not yet fix it,
all interrupts are re-enabled as fast as possible...
I therefor recommend to burn the BOOTRST fuse (please also set the parameter BUILD_OPTIONS="-DBOOTRST=1")
to start the µController in the bootsection.
Reset the µController if this happens, the USB should reconnect, and you may flash
the application again.