A blog by Devendra Tewari
I have need to change the USB descriptors of an Arduino Uno R3 acting as a peripheral to another device. This post describes how I built a USB Serial firmware for the ATmega16U2 on an Arduino Uno R3, using Atmel Studio 7 and its LUFA Library extension. It can be flashed using the built-in DFU firmware and Atmel’s FLIP tool.
Source files that perform the actual USB/serial proxying are derived from USB to Serial Converter example project for the at90usb1287 (File -> New -> Example Project…). I suggest creating a project based on that example and copying the files over. I have also borrowed code from the official source code at GitHub to enable additional functionality such as allowing a sketch to be uploaded from the Arduino IDE.
Install LUFA Library extension if not already installed (Tools -> Extensions and Updates…)
Create a new project for the ATmega16U2 (File -> New -> Project…)
Use ASF Wizard (ASF -> ASF Wizard) to add LUFA modules and remove the Generic board support (driver) module.
Configure GCC symbols (Project -> Properties). Change BOARD
to BOARD_UNO
, and add F_CPU=16000000UL
and F_USB=16000000UL
.
Copy over source files from the example project mentioned earlier. Resolve any build errors.
Flash (Tools -> Device Programming) the firmware using the FLIP tool
Reboot the Arduino.