cancel
Showing results for 
Search instead for 
Did you mean: 

USB Device sometimes not recognized

LMorr.3
Senior II

Using an STM32F373, I setup a USB DEVICE virtual port class.  The connection does work but it takes disconnecting/reconnecting the USB cable once or twice before it gets detected successfully as a serial port/usb device on my linux box.  I use lsusb to see which USB devices are found, and when the connection intialy fails, I get the following message in 'dmesg':

"new full-speed USB device number 48 using xhci_hcd
usb 3-1: config index 0 descriptor too short (expected 67, got 9)
usb 3-1: config 1 has 0 interfaces, different from the descriptor's value: 2
usb 3-1: New USB device found, idVendor=0000, idProduct=0001, bcdDevice= 2.00
usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 3-1: Product: my Module
usb 3-1: Manufacturer: STMicroelectronics
usb 3-1: SerialNumber: 2077345D5646

 

If I disconnect the USB cable and reconnect it it usually works.

Any ideas on what I should look at to fix this issue?

Thank you,

4 REPLIES 4
Pavel A.
Evangelist III

It fails to return the configuration descriptor for some reason. Debug. Likely the host reads the device descriptor and strings first, but does not print that before parsing config descriptors.

 

What's odd is the descriptor Product, Manufacturer and Serial gets corrupted with 'pi' character or sometimes repeats the Product string for Manufacturer and Serial Number when it fails.  ( maybe USB uses those as defaults before they are read in ).  But the connection seems to work well when it does connect... 

Also, it always shows 'expected 67, got 9' so if it was receiving 'garbage' it would not always be '9' I would assume.  I'll keep looking...

Seems very unlikely that the descriptor, which is largely a static array with a constant size, is actually changing size. What would the mechanism even be? Not questioning your results, just thinking the problem may lie elsewhere.

Do you have a Windows machine you could try it on?

You could try inserting a delay (250ms or so) before initializing USB, and after initializing it before using it. This is a USB-powered device, yes?

If you feel a post has answered your question, please click "Accept as Solution".

The device is self-powered so it does not use the USB+5V other than current sensing it.

I will try introducing a 250ms delay before and after USB initialization tomorrow.  It also happens when the device is powered up and connected successufully to USB, but I disconnect and reconnect the USB cable.  I use EXTI interrupt to detect the USB+5V to enable the pull-up on DP