My STM32 project has an issue about VCP on a CubeMX generated project.

When the USB cable is plugged in, the windows10 can't recognise it and in the device manager panel, it says "Unknown USB Device(Descriptor Request Failed), error code 43". The funny thing is after the USB cable been plugged in and out several times (usually more than 10 times), windows suddenly can recognize it. After that, if I power off the board for a short time(several seconds), the USB can always be recognized successfully by windows even if it is plugged out and in repeatedly; but if I shut down the board for a long time, then the issue will arise again.

I've taken the following steps to debug it but no effect:

  • I build a simple project on CubeMX with just OTG_FS, this issue is still existing.
  • I've also tried to enable/disable VBUS sensing function but it's the same.
  • I've measured the voltage on DP and VBUS which are 2.8v/4.4v when this issue exists.

I can't think of another method to debug this issue. Any ideas or suggestions about solving this issue is welcome. Thank you!

These are information related to the USB in my project:

The chip is STM32F205VGT, cubeMX version is 5.0.1.

Keil version:

enter image description here

USB configration: enter image description here

enter image description here

Clock: enter image description here

Schematic and PCB, the board is powered from wall supply rather than VBUS: enter image description here enter image description here

  • \$\begingroup\$ Screenshots don't constitute code, nor have you provided the circuitry around the MCU itself. Might be worth temporarily adapting it to bus power to reduce variables. \$\endgroup\$ – Chris Stratton Mar 6 at 4:52
  • \$\begingroup\$ @ChrisStratton To avoid code error, the simple project is all generated with CubeMX, I don't write a single line code. \$\endgroup\$ – Ross Mar 6 at 4:58
  • \$\begingroup\$ If you're going to develop by point and click, post only screenshots, and omit schematics you don't have an answerable question on an SE site. Perhaps ST support will help you. \$\endgroup\$ – Chris Stratton Mar 6 at 5:02
  • \$\begingroup\$ Why use HSI RC for USB clock source while HSE is the clock source for everything else? Also, why directly connect the resistor from 3V3 to DP? It will tell PC to start enumeration when MCU gets power, not when the MCU firmware is ready to enumerate. \$\endgroup\$ – Justme Mar 6 at 5:23
  • \$\begingroup\$ One problematic thing is that the R34 pull-up must be engaged only after VBUS is applied (cable plugged into host). If your MCU is not ready for some reason (still booting, USB code is confused by something), windows will try to enumerate your device prematurely, and will fail. You need to make the R34 pull-up conditional with the VBUS, and enable it only when your code is ready. \$\endgroup\$ – Ale..chenski Mar 6 at 5:23

In my case I changed input frequency of HSE from 16 Mhz to 8 Mhz and it helped.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.