cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX USB Device generator bug

tm3341
Associate II
Posted on December 18, 2016 at 21:16

Today I played with CubeMX and USB CDC device and I found very silly bug in generated code.

I chose USB FS Device only mode and I used CDC class. Nothing else set. I did not enable VBUS.

Generated code enabled VBUS sensing but VBUS sense pin was not enabled.

I spent 2 hours to figure that out.

Please correct this mistake, disable VBUS sense by default or if you enable VBUS sense, then also initialize VBUS pin to sense voltage.

Have a nice day.

#stm32f7 #stm32cubemx #usb
5 REPLIES 5
Imen.D
ST Employee
Posted on December 21, 2016 at 10:39

Dear

Majerle.Tilen

‌,

Which CubeMx version are you using ?

Best Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on December 21, 2016 at 11:11

Latest, 4.18.

Posted on December 21, 2016 at 13:47

Hello

Majerle.Tilen

‌,

I have checked and reproduced this casefrom my side.

I will share internally your feedback for further review and we will keep you informed about the taken actions/explanation if needed.

Thank you for your contribution.

Best Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Frantz LEFRERE
ST Employee
Posted on January 03, 2017 at 17:08

hello majerle,

FYI : there are two types of vbus available:

1- External Vbus (External Pin)

2- Internal Vbus

By default the internal VBUS is enabled -> this is your case

To disable it, go to tab Configuration in CubeMX and open the USB configuration window, now you have to select disable for Vbus sensing parameter.

best regards,

Frantz

Posted on April 20, 2017 at 20:25

I have run into this also, thanks god for your post!

I run STM32CubeMX version 4.20.1 and don't have a setting in the USB on Configuration tab.

I had to edit the code by hand to fix, in USBD_LL_Init():

   hpcd_USB_OTG_FS.Init.vbus_sensing_enable = DISABLE;