4
\$\begingroup\$

I'm building a device that I want to communicate with a computer using MIDI over a USB connection. There are lots of USB MIDI devices that are class-compliant and thus require no special drivers, which is exactly what I want.

I was hoping that I could use a microcontroller with hardware USB (e.g., MSP430) or a FTDI-style serial-to-USB chip to do this, but it seems like none of them support setting the device descriptors to identify as a MIDI device. So how can I accomplish this? Do I need a dedicated USB controller MCU?

I have only a fractured understanding of USB, but I've tried to read the USB MIDI spec.

I'm aware of serial-to-MIDI converter software, but it's not what I'm looking for here.

\$\endgroup\$
  • \$\begingroup\$ I thought you could set the device descriptors to be whatever you wanted? You might have to write the stack yourself, but I can find references to people doing this on PIC: microchip.com/forums/m409051.aspx \$\endgroup\$ – pjc50 Nov 5 '13 at 13:42
  • \$\begingroup\$ @pjc50 The descriptors are not the worst problem; the USB MIDI protocol is not compatible with the serial protocol. \$\endgroup\$ – CL. Nov 5 '13 at 13:51
  • \$\begingroup\$ Not compatible with which serial protocol? The CDC one? Not even if you pretend to be a device with multiple endpoints? \$\endgroup\$ – pjc50 Nov 5 '13 at 14:23
  • \$\begingroup\$ What other hardware/software handles the MIDI data? \$\endgroup\$ – CL. Nov 5 '13 at 15:03
  • \$\begingroup\$ @pjc50 How would multiple endpoints help? Data for multiple ports must be multiplexed through a single endpoint. \$\endgroup\$ – CL. Nov 5 '13 at 15:09
2
\$\begingroup\$

There is no chip that would support USB MIDI in hardware (except the QinHeng CH345, which is buggy, and the MFM0860, which also is buggy).

You can use any general-purpose USB microcontroller for USB MIDI. However, you have to write all of the firmware yourself, or modify the software for some existing protocol (like CDC).

In the case of the MSP430, you would not be able to use the Descriptor Tool but had to construct the descriptors by hand.

There are also several open-source USB MIDI implementations for 8051-based microcontrollers; and the LUFA library for AVR and NXP chips. Cypress has a USB MIDI library for their PSoC chips.

If your device is generating the MIDI commands (as opposed to receiving MIDI data from somewhere else), you do not need to parse the MIDI stream to convert it into USB MIDI event packets, and your implementation becomes easier.

\$\endgroup\$
  • \$\begingroup\$ Right, thanks. Do you think, then, that it would be easier to just use something like CDC and then write custom drivers to interpret this and spit it back out as MIDI? I also found there's a big open framework for USB on AVR that includes MIDI called LUFA, which is pretty cool. \$\endgroup\$ – shannon Nov 6 '13 at 10:23
  • \$\begingroup\$ That depends. What does your device do with the MIDI data, i.e., what kind of micro controller do you need? What operating system do you need to interface with? \$\endgroup\$ – CL. Nov 6 '13 at 12:24
  • \$\begingroup\$ The device receives commands over RF with a Nordic nRF24L01, and converts them to MIDI based on some simple logic. I've already got a prototype running as a virtual COM port using a serial-to-USB converter, which then gets translated to MIDI by some software on the computer. Operating system? For the sake of argument let's say OSX. \$\endgroup\$ – shannon Nov 6 '13 at 12:37
  • \$\begingroup\$ I'd estimate that writing (code that interfaces with) the USB MIDI firmware once is easier than writing a real driver for a desktop OS, but that ultimately depends on what you have more experience with. \$\endgroup\$ – CL. Nov 6 '13 at 13:02
2
\$\begingroup\$

Then Teensy USB Development Board is an off the shelf prototyping microcontroller board that uses an ARM chip. It can support many types of USB input/output including MIDI:
Teensy MIDI Library

It is compatible with the arduino IDE and many of the arduino libraries. The MIDI library is an easy to use interface.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.