<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>LPC MicrocontrollersのトピックUSBD Get Device Configuration Descriptor truncated packets</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/USBD-Get-Device-Configuration-Descriptor-truncated-packets/m-p/524005#M6641</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by usedbytes on Mon Feb 15 14:30:25 MST 2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm seeing some issues with a USBD CDC application. Whilst it works most of the time, there are intermittent enumeration failures.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I believe this is the same problem described in several other posts:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=https%3A%2F%2Fwww.lpcware.com%2Fcontent%2Fforum%2Fusb-rom-resource-usage%23comment-1120292" rel="nofollow noopener noreferrer" target="_blank"&gt;https://www.lpcware.com/content/forum/usb-rom-resource-usage#comment-1120292&lt;/A&gt;&lt;SPAN&gt; (point 2)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=https%3A%2F%2Fwww.lpcware.com%2Fcontent%2Fforum%2Flpc11u24-usb-cdc-class-source-files-and-header-files%23comment-1123074" rel="nofollow noopener noreferrer" target="_blank"&gt;https://www.lpcware.com/content/forum/lpc11u24-usb-cdc-class-source-files-and-header-files#comment-1123074&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A typical Linux kernel log when resetting the device multiple times shows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
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
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Sometimes the device descriptor reads successfully on the first, second or third attempt and then the CDC device works OK.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've used usbmon and Wireshark to diagnose the problem, and whenever the descriptor read fails it is &lt;/SPAN&gt;&lt;STRONG&gt;always&lt;/STRONG&gt;&lt;SPAN&gt; because the descriptor data is coming back 3 bytes short.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The full configuration descriptor is 67 bytes (wTotalLength), and when it fails, only 64 bytes are returned.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;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 &lt;/SPAN&gt;&lt;STRONG&gt;always&lt;/STRONG&gt;&lt;SPAN&gt; succeeds.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anyone confirm if such a problem exists in the ROM driver, and whether there is any workaround?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-Brian&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 16:47:00 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T16:47:00Z</dc:date>
    <item>
      <title>USBD Get Device Configuration Descriptor truncated packets</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/USBD-Get-Device-Configuration-Descriptor-truncated-packets/m-p/524005#M6641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by usedbytes on Mon Feb 15 14:30:25 MST 2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm seeing some issues with a USBD CDC application. Whilst it works most of the time, there are intermittent enumeration failures.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I believe this is the same problem described in several other posts:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=https%3A%2F%2Fwww.lpcware.com%2Fcontent%2Fforum%2Fusb-rom-resource-usage%23comment-1120292" rel="nofollow noopener noreferrer" target="_blank"&gt;https://www.lpcware.com/content/forum/usb-rom-resource-usage#comment-1120292&lt;/A&gt;&lt;SPAN&gt; (point 2)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=https%3A%2F%2Fwww.lpcware.com%2Fcontent%2Fforum%2Flpc11u24-usb-cdc-class-source-files-and-header-files%23comment-1123074" rel="nofollow noopener noreferrer" target="_blank"&gt;https://www.lpcware.com/content/forum/lpc11u24-usb-cdc-class-source-files-and-header-files#comment-1123074&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A typical Linux kernel log when resetting the device multiple times shows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
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
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Sometimes the device descriptor reads successfully on the first, second or third attempt and then the CDC device works OK.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've used usbmon and Wireshark to diagnose the problem, and whenever the descriptor read fails it is &lt;/SPAN&gt;&lt;STRONG&gt;always&lt;/STRONG&gt;&lt;SPAN&gt; because the descriptor data is coming back 3 bytes short.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The full configuration descriptor is 67 bytes (wTotalLength), and when it fails, only 64 bytes are returned.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;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 &lt;/SPAN&gt;&lt;STRONG&gt;always&lt;/STRONG&gt;&lt;SPAN&gt; succeeds.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anyone confirm if such a problem exists in the ROM driver, and whether there is any workaround?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-Brian&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:47:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/USBD-Get-Device-Configuration-Descriptor-truncated-packets/m-p/524005#M6641</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:47:00Z</dc:date>
    </item>
  </channel>
</rss>

