10 years, 1 month ago.

USB support ST Nucleo F401RE

Hi, I would like to know if there is any support of USB stack for ST Nucle F401RE ? Regards Xavier

Question relating to:

Affordable and flexible platform to ease prototyping using a STM32F401RET6 microcontroller.

5 Answers

9 years, 9 months ago.

I'm also interested in this question. ? The board Nucleo-F401RE doesn't support USB Otg connectors directly, but could be hand wired to support two USB micro-AB. mbeb has USB Host support qu 1) does this support the two USB Otg of the F401RE Elsewhere in the Cube4 documents and UM1720 the USB Host Libray is discussed. qu 2) is this the same, or better/worse then the mbed USB Host support qu 3) OR I need to do my own evaluation

8 years, 7 months ago.

To Josh,

Did you find a solution by now?

I have the same problem. I have a STM32F411 and I am trying to create a USBDevice. My final target is an audio device but for now I would be happy to get any type of USB device to work that gets recognised by my computer. I use a X-NUCLEO-CCA02M1 shield, which contains MEMS microphones and a USB socket along with a driver IC. The driver IC connects to the pins 12 and 14 on the right connector (CN10), which should be the pins PA12 and PA11, the same you mentioned in your post.

Any hints on how to get this to work?

9 years, 6 months ago.

I'd also like to see USB support as well as support for DMA and sleep modes if possible.

9 years, 6 months ago.

Afaik it has both USBDevice (http://developer.mbed.org/users/mbed_official/code/USBDevice/) and USBHost (http://developer.mbed.org/users/va009039/code/F401RE-USBHost/) support. You do need to add the required connector yourself though.

Also @Halherta, sleep modes should already be supported using sleep() and deepsleep().

Erik, Thanks for the speedy response! I've just ordered two F411 boards and I will be testing them with the mbed libraries/ide.

posted by Ziryab 06 Oct 2014

As of 6th October 2014, Mbed's USBDevice library fails to build on the Nucleo_F411RE. Reports the following errors for pins PA_8, PA_9, PA_10, PA_11 & PA_12.:

Error: Too few arguments in invocation of macro "STM_PIN_DATA" in "USBDevice/USBDevice/USBHAL_STM32F4.cpp", Line: 58, Col: 42 Error: Expected an expression in "USBDevice/USBDevice/USBHAL_STM32F4.cpp", Line: 58, Col: 24

I also get two warnings: -Warning: Integer operation result is out of range in "USBDevice/USBDevice/USBHAL_STM32F4.cpp", Line: 230, Col: 50 -Warning: Integer operation result is out of range in "USBDevice/USBDevice/USBHAL_STM32F4.cpp", Line: 256, Col: 49

These errors occur when building the USBMouse example in the online compiler. Same errors occur when building the USBDevice library for the Nucleo_F411RE using the offline Python build system.

A seemingly quick fix is to replace line 51 of USBHAL_STM32F4.cpp : #if defined(TARGET_STM32F407VG) with: #if defined(STM32F411xE). The code now compiles but I have no idea if it runs or not since I'm still waiting for my Nucleo_f411re board

posted by Ziryab 07 Oct 2014

Looks like there are two different implementations of the STM_PIN_DATA macro, depending on which device is used(1). Apparantly the current check doesn't work on the F411, but since your new one only works on the f411, I don't think that is the correct one either.

Putting an or statement in between (#if defined() || (defined()) would probably be better already.

(1) You see that very often with manufacturer supplied driver code. They like to keep all developers on their toes by completely randomly modifying the API of their code between versions of the code and different microcontrollers with exactly the same peripherals. Or maybe they just hate other human beings.

posted by Erik - 07 Oct 2014

I hope you'll forgive my ignorance, but to what pins do I attach my USB connector? I've gathered that PA11 and PA12 are what I'm looking for, but I wired a USB connector to those pins, along with +5V and ground, and hooked it to a computer, and it didn't work. The board powered up, but the computer didn't recognize I'd plugged anything in.

posted by Josh Tolley 24 Oct 2014
9 years, 4 months ago.

To Josh,

I'm in exactly the same boat as you. The compilation errors have been fixed in newer versions of the USBDevice library (by adding an explicit #ifdef stm32f401re nonetheless), but, alas, the bloody thing just doesn't work (board is powered on, but hangs on the first USBHall::connect() call).

I also posted another question about this, but no answer thus far.. :(

Any news on this?

I've found in an implementation on the FRDM-L25z that a USB stick has to be plugged in and then it worked for me.

posted by neil hancock 25 Nov 2014