0

For development, I bought a USB hub with 28 USB hubs: Manhattan MondoHub II. The device is powered by an external power supply, sufficient for my use case.

On the USB hub, 15 development boards are connected (STMicro Nucleo boards). Basically, once you plug the dev board in a USB port, the ST-Link v2 chip exposes the underlying microcontroller's flash as a USB drive, on which you can drag-and-drop a firmware file. The board is then flashed with that firmware. I need to flash them automatically. Thus, I connect every board to the hub and run a script which flashes everything.

The problem is that not all of the 15 connected devices are recognized. Only 11 of them are. dmesg throws errors about the USB host controller not having enough resources.

Internally, the USB hub seems to be composed of multiple USB hubs.

dmesg when I plug in the USB hub, no devices connected:

[269831.218406] usb 2-3: new high-speed USB device number 91 using xhci_hcd
[269831.369806] usb 2-3: New USB device found, idVendor=2109, idProduct=2811
[269831.369813] usb 2-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[269831.369817] usb 2-3: Product: USB2.0 Hub             
[269831.369821] usb 2-3: Manufacturer: VIA Labs, Inc.         
[269831.370918] hub 2-3:1.0: USB hub found
[269831.371195] hub 2-3:1.0: 4 ports detected
[269831.678404] usb 2-3.1: new high-speed USB device number 92 using xhci_hcd
[269831.790645] usb 2-3.1: New USB device found, idVendor=1a40, idProduct=0201
[269831.790650] usb 2-3.1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[269831.790654] usb 2-3.1: Product: USB 2.0 Hub [MTT]
[269831.791150] hub 2-3.1:1.0: USB hub found
[269831.791177] hub 2-3.1:1.0: 7 ports detected
[269831.886375] usb 2-3.2: new high-speed USB device number 93 using xhci_hcd
[269831.998500] usb 2-3.2: New USB device found, idVendor=1a40, idProduct=0201
[269831.998504] usb 2-3.2: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[269831.998506] usb 2-3.2: Product: USB 2.0 Hub [MTT]
[269831.998942] hub 2-3.2:1.0: USB hub found
[269831.998964] hub 2-3.2:1.0: 7 ports detected
[269832.090378] usb 2-3.3: new high-speed USB device number 94 using xhci_hcd
[269832.202654] usb 2-3.3: New USB device found, idVendor=1a40, idProduct=0201
[269832.202658] usb 2-3.3: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[269832.202660] usb 2-3.3: Product: USB 2.0 Hub [MTT]
[269832.203232] hub 2-3.3:1.0: USB hub found
[269832.203258] hub 2-3.3:1.0: 7 ports detected
[269832.294400] usb 2-3.4: new high-speed USB device number 95 using xhci_hcd
[269832.415440] usb 2-3.4: New USB device found, idVendor=14cd, idProduct=8601
[269832.415449] usb 2-3.4: New USB device strings: Mfr=1, Product=3, SerialNumber=0
[269832.415454] usb 2-3.4: Product: USB 2.0 Hub            
[269832.415458] usb 2-3.4: Manufacturer: USB Device  
[269832.416721] hub 2-3.4:1.0: USB hub found
[269832.416838] hub 2-3.4:1.0: 4 ports detected

When disconnecting:

[269873.242343] usb 2-3: USB disconnect, device number 91
[269873.242349] usb 2-3.1: USB disconnect, device number 92
[269873.243596] usb 2-3.2: USB disconnect, device number 93
[269873.244672] usb 2-3.3: USB disconnect, device number 94
[269873.245725] usb 2-3.4: USB disconnect, device number 95

I then connect board after board. Board 1 through 11 are recognized and cause this type of messsage:

[269950.734094] usb 2-3.2.1: new full-speed USB device number 103 using xhci_hcd
[269950.856137] usb 2-3.2.1: New USB device found, idVendor=0483, idProduct=374b
[269950.856140] usb 2-3.2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[269950.856142] usb 2-3.2.1: Product: STM32 STLink
[269950.856144] usb 2-3.2.1: Manufacturer: STMicroelectronics
[269950.856146] usb 2-3.2.1: SerialNumber: 0671FF323532543457250836
[269950.911199] usb-storage 2-3.2.1:1.1: USB Mass Storage device detected
[269950.911377] scsi host5: usb-storage 2-3.2.1:1.1
[269950.911809] cdc_acm 2-3.2.1:1.2: ttyACM2: USB ACM device
[269951.942405] scsi 5:0:0:0: Direct-Access     MBED     microcontroller  1.0  PQ: 0 ANSI: 2
[269951.942686] sd 5:0:0:0: Attached scsi generic sg4 type 0
[269951.942980] sd 5:0:0:0: [sdd] 2080 512-byte logical blocks: (1.06 MB/1.02 MiB)
[269951.943876] sd 5:0:0:0: [sdd] Write Protect is off
[269951.943887] sd 5:0:0:0: [sdd] Mode Sense: 03 00 00 00
[269951.944137] sd 5:0:0:0: [sdd] No Caching mode page found
[269951.944143] sd 5:0:0:0: [sdd] Assuming drive cache: write through
[269951.963779] sd 5:0:0:0: [sdd] Attached SCSI removable disk

When I connect the 12th board, it is not recognized. Log:

[270155.277574] usb 2-3.2.6: new full-speed USB device number 112 using xhci_hcd
[270155.407457] usb 2-3.2.6: New USB device found, idVendor=0483, idProduct=374b
[270155.407464] usb 2-3.2.6: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[270155.407468] usb 2-3.2.6: Product: STM32 STLink
[270155.407472] usb 2-3.2.6: Manufacturer: STMicroelectronics
[270155.407476] usb 2-3.2.6: SerialNumber: 066DFF323532543457074843
[270155.408451] usb 2-3.2.6: Not enough host controller resources for new device state.
[270155.408681] usb 2-3.2.6: can't set config #1, error -12

What's going on here? Am I being limited by the USB protocol, by hub, or by my kernel / drivers?

Running Ubuntu Budgie '18.04.1 LTS (Bionic Beaver)' on a Lenovo ThinkPad E550.

Will fetch more logs if needed. Full log file: https://pastebin.com/BarBHwnc

0

It seems that this was an issue with both my different Laptops / their USB chipset. I switched to a Desktop PC whose motherboard has lots of USB connections.

There, Windows 10 and Linux (Debian 9) both recognized every one of the 100 devices (4 MondoHub II with 25 devs each) flawlessly with no "Not enough host controller resources" message popping up.

0

I ran into this same issue with my Windows machine and I believe the root cause of the problem comes down to the USB architecture and the number of USB Host controllers you have and are connected to on your PC. This National Instruments knowledge base article is the most succinct explanation I've found for this problem.

The USB specification has fixed standards for its communication protocol. In regards to enumerating and communicating with USB devices, the number of USB addresses and endpoints allowed are given by the structure of the USB Token Packet as shown below:

{see link for image}

The Address field is used to represent physical USB devices. Since it is 7 bits long, a single USB Host Controller can allow up to 127 (27 – 1 Host Controller) connected devices. A connected USB Hub counts as a USB device address and every device connected to it goes towards the maximum allowed addresses for that one host controller.

Similarly, the Endpoint field is used for routing of specific types of data across the USB bus and they are analogous to ports in the TCP/IP communication protocol. Its field length is 4 bits long allowing for 16 (24) addressable endpoints. However, since endpoints are unidirectional (either in or out of the USB device), a single USB device can allocate up to 32 endpoints. The total number of USB endpoints allowed is dependent on the USB Host Controller and its firmware, however, this number can be less than 100 total allowable USB endpoints for some controllers.

Therefore, if a USB Device is trying to be added to a Host Controller, and it would cause the number of addresses or endpoints to be exceeded, the aforementioned Windows Resource Error will be thrown. Since some devices can use up to 32 endpoints per device, you can exceed the number of allowable endpoints when connecting NI Devices with a USB hub. As well, some computers’ own internal USB ports and other internal devices (such as wireless network cards, audio, cameras, etc.) are all tied to a single USB Host Controller which can lead to exceeding USB resources fairly quickly.

With that being said, this link explains many different ways of seeing the number of USB devices and controllers on your PC.

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.