Firmware

The Finch's firmware is the code running on the robot's microcontroller. We are releasing the source so that:

  • People may modify the Finch firmware to suit their own purposes.
  • Developers of computer-based Finch applications can see the code that their applications communicate with.

The Gory Details

The Finch firmware runs on an Atmel Atmega16u4, which is the 8-bit RISC microcontroller at the heart of the Finch robot that interfaces with USB and controls all of the Finch's peripheral features. The code, which is attached, was compiled using WinAVR-20100110 and is integrated with LUFA, an open-source USB firmware library developed by Dean Camera. As such, the Finch firmware is subject to the same licensing restrictions as LUFA.

The code attachment contains the entire LUFA library that the Finch firmware uses. We decided to include it as LUFA is constantly being updated, whereas the Finch firmware was compiled with a specific version of LUFA. The Finch uses LUFA's 091223 release. The Finch code is deeply embedded in the LUFA library; to see the Finch source code, navigate to Demos->Device->ClassDriver->Finch. The source code contains comments detailing the operation of the firmware. We suggest you begin with the Finchr2.c file, which contains the main program.

Compiling the Source

To compile the source, you will need to download avr-gcc for your OS. All-in-one packages are available for Windows (WinAVR) and Mac (CrossPack). Once you have a development environment set up, you can compile the code by navigating to the Finch directory and typing "make all". If you create a new main source file, you will need to edit the TARGET argument in the makefile located in the Finch directory. 

WinAVR and most other current distributions of avr-gcc come with an incorrect header file for the Atmega16u4 - their version is missing address definitions for the i2c or two wire interface. A corrected copy is attached to this page - you must place it in the compiler's include/avr directory. 

If you wish to reflash the firmware, you'll need to purchase an AVR-ISP or other Atmel programmer and connect it to the ISP header with the ribbon cable oriented towards the edge of the circuit board. A clean version of the .hex file is attached to the page in case you wish to revert your Finch to the default firmware. We've created a brief tutorial describing how to open the Finch and change the firmware.

Schematic

You may find the schematic of the Finch circuit board helpful when reading or modifying the firmware. Download it here.

AttachmentSize
FinchLUFA.zip4.6 MB
Finchr2.hex20.48 KB
iom16u4.h29 KB