cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 as a USB/MIDI device?

Quentin Broizat
Associate II
Posted on November 21, 2017 at 22:32

Hi,

i'm working on a STM32F4-Discovery and i would like to know if it is possible to make a midi device with this board. I read a lot of project about this but it is hard to find a working project.

I already success to configure my board and it is recognize as a MIDI device (Audio Class) but i can't send MIDI messages. I use CubeMX and SW4STM32 to develop and i would like to use HAL library only.

Do you have an idea to build a good message that will be recognize as a midi message?

Thank you very much for your help,

Regards

Quentin

6 REPLIES 6
Christopher Pappas
Senior II
Posted on November 22, 2017 at 12:12

Since you are fortunate to own an STM32F4-Discovery board, I would suggest starting with

https://github.com/MrBlueXav/Dekrispator_v2

, and then modify it to fit your own needs.

My

https://community.st.com/0D50X00009bMM4jSAG

is also available as well, but it is built around an STM32F767ZI Nucleo board. I would imagine that most of the code can easily be ported over to the 

STM32F4-Discovery board. Since you want the board to act as a Midi Device, download the 

Nucleo Synth Device 

Version 0.8.0 Project. The Host and Slave versions are for users who want to plug in a midi keyboard directly to the board.

Quentin Broizat
Associate II
Posted on November 22, 2017 at 13:44

Hi pappas.chris,

thank you for your help, your project looks like very interesting! I'll try to adapt your code to my STM32F411  

Yes you understood i want the board to act as a MIDI device for the computer. 

I will come back if i have a question, THANKS!  

Regards 

Quentin Broizat
Associate II
Posted on November 23, 2017 at 17:11

Hi pappas.chris,

i worked on your project it is awesome! But i didn't success to send a midi message to my computer yet... My board is recognized as a MIDI device but the messages not.

Could you explain me how to do that easily? Maybe it is just a fonction to call?

Thanks,

Regards

Quentin Broizat
Associate II
Posted on November 23, 2017 at 23:07

I will try to look around the MIDI_DataTx routine.

How can I check if the message is received properly?

Thanks for your help.

Posted on November 23, 2017 at 22:18

In the usbd_midi_if.c file, there is a routine called MIDI_DataTx that is supposed to send msgs. I tried to get it to work here, but I am getting the same results as you, nothing received in 'Midi Monitor' app on the PC.

Can you send a msg from your PC to the board ? Does the board receive msgs properly?

Posted on November 24, 2017 at 19:08

The fastest way to check if the message is received properly is to set a breakpoint in the MIDI_DataRx routine and read the variables for each packet.

I use Keil uVision 5 IDE, so unfortunately I do not know how (or if it is even possible) to set a breakpoint and read variables in SW4STM.