NOTICE: This website will be shut down in the near future. Product content has moved to nxp.com. Forum content and FAQs have been moved to community.nxp.com. We encourage you to create a user account on nxp.com to use the new community forums and access NXP microcontroller content. We greatly appreciate your contributions and look forward to seeing you at our new web location.

 

USBD Get Device Configuration Descriptor truncated packets

No replies
usedbytes
Offline
Joined: 2016-02-15
Posts: 4

Hi,

I'm seeing some issues with a USBD CDC application. Whilst it works most of the time, there are intermittent enumeration failures.
I believe this is the same problem described in several other posts:
https://www.lpcware.com/content/forum/usb-rom-resource-usage#comment-1120292 (point 2)
https://www.lpcware.com/content/forum/lpc11u24-usb-cdc-class-source-files-and-header-files#comment-1123074

A typical Linux kernel log when resetting the device multiple times shows:

Feb 15 19:05:26 eva kernel: usb 1-1.3.2: new full-speed USB device number 82 using ehci-pci
Feb 15 19:05:26 eva kernel: usb 1-1.3.2: unable to read config index 0 descriptor/all
Feb 15 19:05:26 eva kernel: usb 1-1.3.2: can't read configurations, error -32
Feb 15 19:05:26 eva kernel: usb 1-1.3.2: new full-speed USB device number 83 using ehci-pci
Feb 15 19:05:26 eva kernel: usb 1-1.3.2: unable to read config index 0 descriptor/all
Feb 15 19:05:26 eva kernel: usb 1-1.3.2: can't read configurations, error -32
Feb 15 19:05:26 eva kernel: usb 1-1.3.2: new full-speed USB device number 84 using ehci-pci
Feb 15 19:05:26 eva kernel: usb 1-1.3.2: unable to read config index 0 descriptor/all
Feb 15 19:05:26 eva kernel: usb 1-1.3.2: can't read configurations, error -32
Feb 15 19:05:26 eva kernel: usb 1-1.3-port2: unable to enumerate USB device
Feb 15 19:05:31 eva kernel: usb 1-1.3.2: new full-speed USB device number 85 using ehci-pci
Feb 15 19:05:31 eva kernel: usb 1-1.3.2: unable to read config index 0 descriptor/all
Feb 15 19:05:31 eva kernel: usb 1-1.3.2: can't read configurations, error -32
Feb 15 19:05:31 eva kernel: usb 1-1.3.2: new full-speed USB device number 86 using ehci-pci
Feb 15 19:05:31 eva kernel: cdc_acm 1-1.3.2:1.0: ttyACM0: USB ACM device

Here you can see the kernel attempting 4 times to read the device descriptors (device numbers 82, 83, 84) before giving up - "unable to enumerate USB device"
Sometimes the device descriptor reads successfully on the first, second or third attempt and then the CDC device works OK.

I've used usbmon and Wireshark to diagnose the problem, and whenever the descriptor read fails it is always because the descriptor data is coming back 3 bytes short.
The full configuration descriptor is 67 bytes (wTotalLength), and when it fails, only 64 bytes are returned.

I've attached images showing a corrupted and a non-corrupted packet. You can see the truncated data for the last endpoint at the end.

I strongly suspect there is a bug in the ROM driver when handling Config (Endpoint0) requests where the descriptor size is larger than 64 bytes. I say this because in the Wireshark logs, the requests are always truncated to 64 bytes.
Additionally, I reduced the size of my Device Configuration descriptor by removing the CDC Call Management Functional Descriptor which makes the full descriptor size (wTotalLength) 62 bytes and enumeration always succeeds.

Can anyone confirm if such a problem exists in the ROM driver, and whether there is any workaround?

Many thanks,
-Brian

Corrupt packet
Non-corrupt packet
0
Your rating: None
feedback