This is a USB MIDI 1.0 device class driver for the Zephyr RTOS, which allows sending and receiving MIDI data over USB.
The current implementation, which uses Zephyr's soon-to-be legacy USB stack, is usable but should be considered work in progress and needs more testing before it's ready for real world use. If you run into any issues, please consider reporting them or submitting a PR.
The USB MIDI device class driver is contained in a Zephyr module. The sample app's CMakeLists.txt file shows one way of adding this module to an app.
The public API is defined in usb_midi.h.
The sample app demonstrates how to send and receive MIDI messages and how to efficiently send large sysex messages to the host. It also logs sysex transfer speeds and can echo incoming sysex messages. See Kconfig
for sample app config vars.
- Button 1 - Send a large sysex message
- LED 1 - On when the device is connected to a host
- LED 2 - Flashes when MIDI data is received
- LED 3 - Flashes when MIDI data is sent
The app should work on dev boards with at least one button and three LEDs, for example stm32f4_disco and nrf52840dk_nrf52840.
zephyr_usb_midi_sample.mp4
CONFIG_USB_DEVICE_MIDI
- Set toy
to enable the USB MIDI device class driver.CONFIG_USB_MIDI_NUM_INPUTS
- The number of jacks through which MIDI data flows into the device. Between 0 and 16 (inclusive). Defaults to 1.CONFIG_USB_MIDI_NUM_OUTPUTS
- The number of jacks through which MIDI data flows out of the device. Between 0 and 16 (inclusive). Defaults to 1.CONFIG_USB_MIDI_USE_CUSTOM_JACK_NAMES
- Set toy
to use custom input and output jack names defined by the options below.CONFIG_USB_MIDI_INPUT_JACK_n_NAME
- the name of input jackn
, wheren
is the cable number of the jack.CONFIG_USB_MIDI_OUTPUT_JACK_n_NAME
- the name of output jackn
, wheren
is the cable number of the jack.