USB AVR chips
Here are memos on AVRs with focus on newer hardware USB chips.
- ATmega8u2 Flash 8KiB
- Board: Arduino UNO R2 serial
- ATmega16u2 Flash 16KiB
- Board: Arduino UNO R3 serial
- ATmega32u4 Flash 32KiB
- Board: Teensy1.0, Teensy2.0, Arduino Leonardo, pro micro, Arduino micro, many badusb usb virtual keyboard (16MHz)
- AT90USB1286 Flash 128KiB
- Board: Teensy2.0++ (16MHz)
- AT90USB1287 Flash 128KiB -- USB OTG support
- Board: AT90USBKEY2 (8MHz)
Hardware USB enabled AVR chips can be programmed in 3 ways:
- ISP (In System Programmer) on ICSP port
- Host application on PC:
avrdude
- Protocol: AVR910
- This is the same protocol to program a non-USB enabled AVR chips ATmega328 on Arduino Uno R3 board via SPI connection via ICSP port.
- Connection: SPI (Serial Peripheral Interface) connection! (MOSI/MISO/... ) on ICSP port
- Programming hardware (ISP programmer):
- AVRISP mkII (
-c avrisp2
) - FT232 based ISP (My toy) https://github.com/osamuaoki/avrdude-friend (
-c ttl232r
) - Arduino based ISP (old AVR-ISP-like)
-
https://www.arduino.cc/en/Tutorial/ArduinoISP running ISP sketch https://github.com/rsbohn/arduinoisp (
-c avrisp
) - Hardware (ISP): ARDUINO UNO based http://mightyohm.com/blog/2008/09/arduino-based-avr-high-voltage-programmer/
-
https://www.arduino.cc/en/Tutorial/ArduinoISP running ISP sketch https://github.com/rsbohn/arduinoisp (
- AVRISP mkII (
- Bootloader code on MCU: None
- Host application on PC:
- CDC Class USB AVR Bootloader (Communications Device Class)
- Host application on PC:
avrdude -c AVR109
- Protocol: AVR109
- This is the same protocol to program a non-USB enabled AVR chips ATmega328 on Arduino Uno R3 board via serial UART connection via on USB-serial board FT232 (as on STK500). Some Arduono needs external USB-serial board.
- Connection: USB
- Programming hardware: None (USB cable)
- Bootloader code on AVR:
- 4KiB: LUFA CDC (http://www.fourwalledcubicle.com/LUFA.php)
- 4KiB: Caterina (Arduino Leonardo comes with this bootloader, smaller optimized)
- Host application on PC:
- DFU Class USB AVR Bootloader (Device Firmware Update)
- Host application on PC:
FLIP
(Windows),dfu-programmer
(Linux) (neweravrdude
also seems to support this) - Protocol: AVR282: USB Firmware Upgrade for AT90USB
- This is the same protocol to re-program a fresh ATmega16u4 which normally function as USB to TTL-UART converter on Arduino Uno R3 board from USB port.
- Connection: USB
- Programming hardware: None (USB cable)
- Bootloader code on AVR:
- 4KiB: Atmel DFU? (Bare chip comes with this) (closed source)
- 4KiB?: LUFA DFU (http://www.fourwalledcubicle.com/LUFA.php)
- 4KiB: Leonardo DFU (Arduino+LUFA)
- USB DFU Bootloader Datasheet
- Host application on PC:
- HID Class USB AVR Bootloader (Human Interface Device)
- Host application on PC:
-
hid_bootloader_cli
(LUFA) -
teensy_loader_cli
modified https://github.com/osamuaoki/teensy_loader_cli -
teensy_loader_cli
https://github.com/PaulStoffregen/teensy_loader_cli (Only for Teensy)
-
- Connection: USB
- Programming hardware: None (USB cable)
- Protocol: Teensy Programming Protocol Specification (pjrc)
- Bootloader code on AVR:
- 4KiB?: LUFA HID (http://www.fourwalledcubicle.com/LUFA.php)
- 512B: Teensy (striped down firmware, proprietary)
- 512B: nanoBoot (teensy compatible GPL3 firmware, https://github.com/volium/nanoBoot )
- Host application on PC:
- Mass Storage Class USB AVR Bootloader
- Printer Class USB AVR Bootloader
- High voltage programming -- last resort for bricked EEPROM chips
- Host program: avrdude http://www.atmel.com/webdoc/stk500/stk500.highVoltageProgramming.html
On Windows system, you need to install device driver file for all but HID Class USB AVR Bootloader.
FYI: ATmega328p on Arduino Uno R3 comes with optimized 512B optiboot serial line bootloader whitch uses the same protocol as CDC Class USB AVR Bootloader.
FYI: "Let’s shorten the bootloader time of the Leonardo/Micro/Esplora": http://www.leonardomiliani.com/en/2013/accorciamo-i-tempi-del-bootloader-della-leonardomicroesplora/
LUFA is a free AVR USB stack library and bootloader program licensed under the MIT license.
- The latest LUFA release: http://www.fourwalledcubicle.com/LUFA.php
- Tutorial: http://fourwalledcubicle.com/AVRArticles.php
LUFA seems to be preferred library over:
- Atmel USB AVR Stack (Atmel Inc.)
- PJRC Teensy Stack (Paul Stoffregen)
- V-USB (Objective Development) -- USB on serual AVR
hid_bootloader_cli
in LUFA is modified Teensy CLI. This should be good drop in replacement (except for ARM based teensy 3 support etc.)
I have made updated bootloader cli based on the newer teensy_loader_cli
to support
LUFA HID bootloader with hid_bootloader_cli as https://github.com/osamuaoki/teensy_loader_cli
Fuse calculator:
See more on AVR fuses