A Mutable Log

Arduino USB DFU firmware from scratch

The Device Firmware Upgrade (DFU) firmware for the ATmega16U2 on Arduino Uno R3 is used to flash the USB Serial firmware, among others, using Atmel’s FLIP tool.

This post documents how you can build from scratch DFU firmware using Atmel Studio 7 and its LUFA Library extension. You’ll need an ISP/ICSP programmer to program the ATmega16U2.

You can install the LUFA extension from the Extensions and Updates dialog (Tools -> Extensions and Updates).

Install LUFA Extension

Create a new project based on the DFU Bootloader example (File -> New -> Example Project…).

DFU LUFA Example in Atmel Studio

Change the compiler optimization setting to -Os in toolchain properties (Project -> Properties).

Optimize for Size Configuration

Build the solution and flash (Tools -> Device Programming) using an ISP/ICSP programmer connected to the ICSP2 header.

Device Programming