Skip to content

HIDUINO via DFU Method

ddiakopoulos edited this page Feb 28, 2012 · 1 revision

Table of Contents

Introduction

This guide will direct a user through configuring a new Arduino UNO or Mega2560 as a class-compliant MIDI device. There are several different tools and methods for performing many of these steps, but this guide is an attempt outline the steps the developers used for testing.

The Atmel DFU (Device Firmware Update) is a USB protocol that enables microcontrollers to be flashed via USB without an in-system programmer.

The primary Arduino chip cannot be flashed while an alternate firmware (such as HIDUINO) is loaded on the 8u2 chip. To this end, many users will find themselves flashing the 8u2 between a HIDUINO firmware and the default Arduino usbserial firmware quite often, since Arduino sketches need to be bootloaded through the virtual serial port.

Prerequisites

Arduino Guide

Currently, the Arduino site has an excellent guide describing the entire process: please see http://arduino.cc/en/Hacking/DFUProgramming8U2

The DFU-ready firmwares are located in:

    HIDUINO\Compiled Firmwares

The raw .hex files can be flashed onto the Arduino with Atmel's FLIP software (Windows) or dfu-programmer (OSX/Linux) as outlined in the above guide from Arduino.

Flashing Arduino Sketches

Since the Arduino will no doubt be interfacing with your own electronics/sensors/robots, you'll want to flash your Arduino sketch first. For the primary Arduino chip to communicate internally with the ATmega 8u2, we use old-school serial-based MIDI. This is done through the popular Arduino MIDI library (listed at the top of the guide).

Once the Arduino MIDI library is downloaded, drop the MIDI folder into your Arduino\libraries folder (located in Documents on OSX or My Documents on Windows) -- you may have to create the libraries directory first. Then add it to your sketch using the menu in the Arduino IDE. Arduino will only see new libraries after it has been restarted.

See the examples for a better idea.

  HIDUINO\Arduino Example Sketches\

As any alternate firmware running on the 8u2 removes the ability to contact the primary ATmega 328 chip using a virtual serial port, you will find yourself re-flashing the 8u2 with the default usbserial firmware and HIDUINO firmwares quite often during development.

Finishing Up

Congratulations! If all went well, you should have a fully class-compliant MIDI device via Arduino. Open your favorite MIDI-compatible program and have fun.

Don't forget, in order to program the Arduino you will need to switch back to the default firmware.