cancel
Showing results for 
Search instead for 
Did you mean: 

Using CubeMX for STM32F411: USB Device code not functional

greatbena
Associate II
Posted on January 19, 2016 at 14:16

I have a STM32F411 Discovery board, when I use the latest CubeMX to generate templates that configure the board as a USB device audio class, the board doesn't get recognized by the host computer (as in, the computer doesn't think there is a USB device plugged in at all, not even USBlyzer captures any communication on the USB bus.)

The USB descriptor in the code should make the board show up as a loudspeaker in the computer, which is the case when I tried the same thing on a STM32F407 Discovery board.

Could anyone confirm this? Or help me with a workaround?

Thanks

#usb #stm32f411
3 REPLIES 3
Posted on January 19, 2016 at 17:37

Verify the PLL settings and clocks are set up appropriately. The Q tap of the PLL needs to generate 48 MHz. Perhaps the F411 has other sources of 48 MHz to permit 100 MHz CPU operation, not a part I'm actively using.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
greatbena
Associate II
Posted on January 20, 2016 at 11:50

Thanks for your input. I checked the PLL settings in CubeMX, the default setting generates the correct 48MHz clock at the output of PLLQ.

My new discovery is, when I program a F407 board with the USB project generated for F411 Discovery, it actually works (at least the board is recognized as loudspeaker). More interestingly, when I program the F411 board with a USB project generated for F407, but with PLLs underclocked so that the processor runs at 96MHz, it also works!

I suppose there might be some mistake with the low layer configuration files......

greatbena
Associate II
Posted on January 21, 2016 at 13:09

I think I've found a solution. By changing the value of RCC_OscInitStruct.HSEState from RCC_HSE_BYPASS to RCC_HSE_ON in main.c, the USB device is successfully recognized.

So this is a bug of CubeMX, then?