Interfacing a MIDI Keyboard with a Tiva LaunchPad (ARM Cortex-M4 Processor)

I've managed to interface a typical MIDI keyboard controller (an M-Audio Oxygen 61) with my Texas Instruments Tiva LaunchPad (ARM Cortex-M4) development board as shown below.

MIDI Keyboard, Tiva LaunchPad and Circuit

By doing some Googling I found out that the MIDI protocol is a typical UART connection running at a baud rate of 31,250. This was an excellent opportunity to get practical experience with using UART communication on an ARM Cortex-M4 chip.

Googling, I didn't find anyone who had done this using a Tiva LaunchPad. However, I did find Amanda Ghassaei's Instructable which interfaces an Arduino with MIDI. It was a big help in putting together the circuit necessary for the LaunchPad to receive signals from the MIDI keyboard controller. Thank you, Amanda!

Amanda's Instructable does an excellent job of listing the components needed for the circuit. I had to make a minor addition. Since the Tiva LaunchPad outputs power at 3.3v, and not the 5v the Arduino does, I added a voltage converter. I used a ROE 3.305S. The datasheet is located here.

Here's a diagram I've drawn up of the circuit I'm using:

Tiva LaunchPad MIDI Circuit Diagram

As shown in the circuit diagram, only two of the pins are needed from a typical 5 pin DIN MIDI cable. I happened to have a spliced MIDI cable handy from earlier experiments so I just used it and some alligator clips as shown below. I've taped off the extra wires with electric tape so they wouldn't interfere with the ones exposed.

Spliced MIDI Cable

Here's a close-up shot of the circuit and the Tiva LaunchPad (click to enlarge):

Tiva LaunchPad and Circuit

In order to monitor the MIDI keyboard keypresses in realtime I used an additional UART on the Tiva LaunchPad to communicate the MIDI messages to a terminal program. I use PuTTY as shown below. There's a great YouTube tutorial on how to setup UART/terminal communication with a Tiva LaunchPad here.

The image below shows a C key on the keyboard pressed and released:

PuTTY Receiving Debug Messages 1

This next image shows an F major chord pressed and released:

PuTTY Receiving Debug Messages 2

I won't go into the details of the MIDI protocol and how to properly process messages. There is a wealth of information on the MIDI protocol if you simply Google. The protocol is quite straightforward. By Googling, you should find everything you need to know to fully understand it.

If you're interested in taking a look at my source for this project, feel free to download it here. I use TI's Code Composer Studio for development and debugging, but the code can be easily viewed with any text editor.

If you have any questions about this project, just let me know, I'll be happy to discuss. Contact info here.

Date: April 26th, 2017 at 4:24pm
Author: Terence Darwen
Tags: Embedded, Tiva LaunchPad, TM4C123G, ARM Cortex-M4, Synth Project, MIDI Keyboard, Sabbatical

Previous Next