Only Leonardo for MIDI?

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
ochenk
 
Posts: 7
Joined: Fri Apr 22, 2011 4:09 pm

Only Leonardo for MIDI?

Post by ochenk »

On one of the project tutorial pages (https://learn.adafruit.com/untztrument- ... irst-steps), it says that for that type of MIDI application, the only Arduino that will work is a Leonardo. The only explanation given is "Because MIDI." But there seem to be many other projects that implement MIDI on other boards. See e.g. http://playground.arduino.cc/Main/Inter ... dware#MIDI. At first I thought there was something about it being a USB MIDI device, but there seem to be projects that predate that Untz tutorial that do USB MIDI, such as http://hunt.net.nz/users/darran/weblog/ ... mware.html.

Are you able to fill me in on what "Because MIDI" means, and why the Leonardo is the only board for that application?

Thanks!

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Only Leonardo for MIDI?

Post by adafruit_support_mike »

The Untztrument is a USB MIDI device.

It's designed for the ATmega32u4 microcontroller, which has built-in USB support and can identify itself to the computer as something other than a Serial connection. It's possible to do MIDI in other ways, but that particular body of code assumes you have an ATmega32u4.

User avatar
ochenk
 
Posts: 7
Joined: Fri Apr 22, 2011 4:09 pm

Re: Only Leonardo for MIDI?

Post by ochenk »

Ah, so it needs a Leonardo because of the code, not "Because of MIDI," is that right? Is there any reason that implementing USB MIDI on a Leonardo is vastly easier? Does it have serial magic that's baked in that one would have to implement manually using other boards?

Thanks!

User avatar
michaelmeissner
 
Posts: 1821
Joined: Wed Aug 29, 2012 12:40 am

Re: Only Leonardo for MIDI?

Post by michaelmeissner »

I believe the Uno and Mega have separate off-board USB controllers that actually talk to the host and this controller works by monitoring the serial lines, so you would need to re-program these to add the midi support. The 32u4 in the Leonardo has code that directly does the USB support, so it can support other USB modes than simple serial support.

The Teensy 3.1 has direct MIDI support. It uses a different processor (Arm Cortex-M4), so if your code uses machine dependent I/O on the 32u4, you would have to rewrite it. While Adafruit sells the Teensy 3.1, you might get faster responses about the Teensy 3.1 and its MIDI support directly on their forum: https://forum.pjrc.com/forum.php. The older Teensy 2.0 and 2.0++ have the 32u4 processor like the Leonardo, and probably would work as well.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Only Leonardo for MIDI?

Post by adafruit_support_mike »

A USB device has to identify itself in terms Base Class, SubClass, and Protocol codes which are defined in various standards documents.

Those codes tell the host computer what drivers to use to talk to the device, how the device will use the bus, and what kinds of messages it will send and receive. The USB chip in a camera will identify itself differently than the USB chip in a wireless keyboard.

The ATmega32u4 handles USB within the chip, so you can explicitly set the Base Class, SubClass, and Protocol codes it emits during enumeration. If you have it emit the codes for a keyboard, a computer will see a keyboard when you plug in the USB cable. If you have it emit the codes for a USB MIDI device, that's what the computer will see when you connect it.

The USB-to-Serial interface chip on an Arduino Uno identifies itself that way, so no matter how you program the ATmega328, a computer will never see anything but a USB-to-Serial interface.

User avatar
wbajzek
 
Posts: 10
Joined: Mon Dec 14, 2015 10:07 pm

Re: Only Leonardo for MIDI?

Post by wbajzek »

Just curious, since Leonardo is discontinued... Is there a new board, or a revision of the Untz in the works, that will allow it to live on?

User avatar
dhalbert
 
Posts: 401
Joined: Tue Feb 17, 2015 6:18 pm

Re: Only Leonardo for MIDI?

Post by dhalbert »

It would be nice to have the Untz reworked for a newer board, but if you want to build one now:

The Leonardo is a 32u4 board which runs on 5V and has 5V I/O, which matches what the Untz wants for its Trellis pushbutton boards. There are other 5V 32u4 boards, but some have different form factors or other differences (e.g., Teensy, as Michael mentioned). The Arduino Micro (Adafruit #1086) is smaller but otherwise quite similar. (Adafruit's Feather line has many 32u4 boards but they run at 3.3V). I don't think it would be too hard to rework the mounting holes for the Arduino Micro. Also, I see that Polulu has stock of Leonardos left, and they also have their own fancier 32u4 boards with the same form factor as the Leonardo. There are other distributors with Leonardo stock left as well.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”