Close

LUFA for the atmega16u2

A project log for fNIR Brain Imager

Measure brain activity with light

jeremy-ruhlandJeremy Ruhland 08/19/2014 at 02:010 Comments

To simplifly communication, the fNIR scanner uses a USB connection similar to an arduino. The circuit will enumerate as a USB serial device and spit out measurements in CSV format. This seems like a more simple way to go than something like a HID and is more suited to collecting raw data. Raw data will probably be useful in experimental or research situations, rather than just returning a limited amount of HID information.

The LUFA project is a set of drivers for AVR processors that handles many parts of the USB protocol. My code is based off the USB-serial examples contained in the LUFA documentation. Upon startup it attempts to connect to a host device (your computer) and once connected it creates a stream using a function provide by the LUFA code. This stream can then be used by the fprintf function just like in normal *nix c programming.

Atmel's usb enabled microcontrollers come with a built in DFU bootloader, so no special programming devices are needed. The board is always programmable over the same USB connection, again similar to an arduino which allows for rapid firmware development.

In the next few built logs I will go over my firmware and hardware design and the basic theory of operation of an fNIR device.

Discussions