5 years, 2 months ago.

USBMIDI on nucleo


I wonder if anyone did port this library on the F401RE? When I try to compile I gen many errors even if I update the different libraries...

What I would like to have is this library working on the default USB port of the nucleo.

Thanks in advance!

Question relating to:

Comment on this question

2 Answers

5 years, 2 months ago.

Pls change souce code, it will compile success on Nucleo F401RE Board.

But it seems PA9-PA12 is used USB OTG FS (device port),But Nucleo not have it....

Is it work ? i want to know.

I make Music Synthesizer on Nucleo F401RE.

What do you want to do?


//#if defined(TARGET_STM32F4XX)
#if defined(TARGET_STM32F4)

   // Enable power and clocking
    pin_function(PA_8, STM_PIN_DATA(2, 10));
    pin_function(PA_9, STM_PIN_DATA(0, 0));
    pin_function(PA_10, STM_PIN_DATA(2, 10));
    pin_function(PA_11, STM_PIN_DATA(2, 10));
    pin_function(PA_12, STM_PIN_DATA(2, 10));

    pin_function(PA_8, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL,10));
    pin_function(PA_9, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, 0));
    pin_function(PA_10, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP,10));
    pin_function(PA_11, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL,10));
    pin_function(PA_12, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL,10));

Thank you for your answer! I would like to build a midi receiver. For example I would like to get midi commands (NoteOn, NoteOff...) on the USB port (detected as USB MIDI device).

What I will probably do is to use the MIDI library from Suga koubou. I think this will be the easiest way to do what I want, but then the MIDI master won't detect the device teh proper way and then I will have to integrate a proper MIDI connector. But that is what I want to avoid...


posted by Benoît GEISLER 24 Jun 2014
5 years, 2 months ago.

There is USBDevice library customized for Nucleo 401 Don't forget change clock to 48MHz.


If I understood right, you propose me to build a USBDevice, but why not use the integrated virtual COM port of the nucleo board! The only thing is that the USB won't show up as MIDI class on the PC. That's my problem...

To my understanding we can use theUSB port of the board instead of building a new one?


posted by Benoît GEISLER 24 Jun 2014


I'm not aware of possibility using USB connector on programmer part of Nucleo board. You have to connect some Nucleo pins to be D+ and D- ports for USB (PA12 (D+), PA11(D-)).

I'm referring to this library because it's port of official USB driver library for mbed. This library also contains USBMidi (just look into documentation).

posted by Michal Stehlik 24 Jun 2014

USB port of Nucleo is ST-Link, it's not USB-MIDI.

USB-MIDI have own specification.

If you really need USB-MIDI driver at HostPC, you must added USB peripheral connector on Nucleo.

Otherwise, you choice USB-serial as below,But it is not what you expect.

USB-SERIAL on default usb port

#include "mbed.h"
#include "MIDI.h"// suga koubou midi library

//MIDI midi(PB_6, PB_7); 
MIDI midi(SERIAL_TX, SERIAL_RX);// Default USB-Serial Port

int main(){

  /* your code  */


posted by p igmon 25 Jun 2014

You need to log in to post a question