Writing the Firmware

For a firmware, I started with the open source MIDI SPort driver. This is a replacement firmware for the SPort USB to MIDI adapter series, available as an example from the linux-hotplug project.

This thing is already supported in Linux of course and I assume that the Open Source firmware will remain compatible with the Windows drivers.

MIDI is a serial protocol and this USB MIDI adapter works in a very similar way to a USB to Serial convertor. I took this firmware and removed the MIDI input parts, replacing them with a key matrix scanner. The keys are scanned, and any changes in the key state are converted to the appropriate MIDI signals before being sent over USB to the PC. To the PC it behaves no differently than the original hardware so no new drivers are needed.

Here is the source code: ezusbmidi-keyboard-0.0.3.tar.gz
And here is the precompiled binary: ezusbmidi.ihx.gz

This is a very basic release. I cut a lot of the files from the original distribution to keep it simple. I'll hopefully be able to do a cleaner release some time soon.

In order to compile the firmware source you'll need to install the SDCC package. It's available in one of the Ubuntu repositories as "sdcc". After you have installed it, just unpack the firmware source archive, CD into the created directory and type "make". This produces the file "ezusbmidi.ihx".

Uploading is also quite easy. You need to use the fxload tool (Ubuntu package "fxload".) Plug in your EZ-USB board and, at a command prompt, type "lsusb". You should see a line like:

Bus 002 Device 033: ID 0547:0080 Anchor Chips, Inc.

Note the device and bus numbers. You must pass these to fxload when loading the firmware. In the above case I would type:

sudo fxload -D /proc/bus/usb/002/033 -I ezusbmidi.ihx

This loads the firmware into the EZ-USB's memory. You have to do this every time the device is plugged in. There are two alternatives to this: Configure Linux hotplugging to do it automatically when the device is plugged in, or use a second stage loader to flash the external eeprom on your board, if it has one.

Once you have loaded the firmware, you should be able to type "lsusb" again and see that the old line is replaced by this one:

Bus 002 Device 039: ID 0763:1110 Midiman

You should also find a new character device such as /dev/midi2, and if you open it using "cat /dev/midi2" you should see binary data when you press keyboard keys. You might need to "sudo modprobe snd-seq" in order for the /dev/midi device to appear.

Previous Page | Next Page

al – Fri, 18/08/2006 – 01:41