rpi USB limited to 15 ports?


23 posts
by elatllat » Tue Aug 07, 2012 4:26 pm
All of the ports on my USB hubs work on my x86.
Only the first 15 work on the rpi.
The rpi is connected to a 7-port-hub which is connected to a 10-port-hub.

dmesg for 16+:
Code: Select all
[ 1071.682998] usb 1-1.3.1.1.4: new high speed USB device number 7 using dwc_otg
[ 1071.785001] usb 1-1.3.1.1.4: New USB device found, idVendor=13fd, idProduct=1340
[ 1071.785049] usb 1-1.3.1.1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1071.785071] usb 1-1.3.1.1.4: Product: FANTOM DRIVE   
[ 1071.785087] usb 1-1.3.1.1.4: Manufacturer: MICRONET
[ 1071.785102] usb 1-1.3.1.1.4: SerialNumber: blabla
[ 1071.795097] usb 1-1.3.1.1.4: can't set config #1, error -71


dmesg for 15-:
Code: Select all
[ 1226.176894] usb 1-1.3.1.7: new high speed USB device number 13 using dwc_otg
[ 1226.278388] usb 1-1.3.1.7: New USB device found, idVendor=13fd, idProduct=1340
[ 1226.278436] usb 1-1.3.1.7: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1226.278458] usb 1-1.3.1.7: Product: FANTOM DRIVE   
[ 1226.278473] usb 1-1.3.1.7: Manufacturer: MICRONET
[ 1226.278488] usb 1-1.3.1.7: SerialNumber: blabla
[ 1226.293803] scsi5 : usb-storage 1-1.3.1.7:1.0
[ 1227.297710] scsi 5:0:0:0: Direct-Access     MICRONET FANTOM DRIVE     2.10 PQ: 0 ANSI: 4
[ 1227.299488] sd 5:0:0:0: [sda] 3907029168 512-byte logical blocks: (2.00 TB/1.81 TiB)
[ 1227.300641] sd 5:0:0:0: [sda] Write Protect is off
[ 1227.300693] sd 5:0:0:0: [sda] Mode Sense: 21 00 00 00
[ 1227.301886] sd 5:0:0:0: [sda] No Caching mode page present
[ 1227.301934] sd 5:0:0:0: [sda] Assuming drive cache: write through
[ 1227.306118] sd 5:0:0:0: [sda] No Caching mode page present
[ 1227.306169] sd 5:0:0:0: [sda] Assuming drive cache: write through
[ 1227.319576]  sda: sda1
[ 1227.325733] sd 5:0:0:0: [sda] No Caching mode page present
[ 1227.325784] sd 5:0:0:0: [sda] Assuming drive cache: write through
[ 1227.325809] sd 5:0:0:0: [sda] Attached SCSI disk


Notably 2^4=16.

Can anyone reproduce this problem or use more than 15 USB ports?
Posts: 1027
Joined: Sat Dec 17, 2011 5:05 pm
by jbeale » Tue Aug 07, 2012 4:34 pm
I haven't tried attaching that many ports, so I can't say if there's a software issue with > 15 ports. However, are you using externally powered hubs? If not, there could also be a problem with the low (100 mA) current available from the R-Pi USB host ports.

I do have a cheap 10-port hub I could try, although I believe internally it is two devices, a 4-port hub of which one output goes to a 7-port hub (or maybe the reverse). So it might be that you are crossing an internal dividing line between two sub-hubs in your 10-port device.
User avatar
Posts: 1980
Joined: Tue Nov 22, 2011 11:51 pm
by elatllat » Tue Aug 07, 2012 4:45 pm
Hi jbeale,

Thanks for bringing that up.
Yes the hubs are externally powered, so is the external drive.
If it were a power problem it would matter how many drives I plugged in not where I plugged in a single drive.
So I'm confidant we can rule out power problems.
It seems more likely to me that usb drivers address space is limited to a byte or half.
Posts: 1027
Joined: Sat Dec 17, 2011 5:05 pm
by jbeale » Wed Aug 08, 2012 4:31 am
Ok, I tried connecting a 10-port hub, and also several 4-port hubs (powered separately from the Pi, with isolated-power USB cables so there's no power feedback either). My observation is that I cannot use any daisy-chained hub. That is, a 4-port hub connected to one of the ports on another 4-port hub does not work. Also, error messages in dmesg show up when the secondary hub is connected. My 10-port hub is internally configured as a 7+4 port hub. The first 6 ports work, and the other 4 ports (which are on the secondary hub internally) do not.

So let me pose this question: has anyone successfully daisy-chained two or more hubs from the R-Pi? A quick google search seems to give me (a) entirely theoretical discussions, and (b) people trying this without success.

dmesg output when connecting the 10-port hub:

Code: Select all
[ 4290.893707] usb 1-1.3: new high speed USB device number 25 using dwc_otg
[ 4290.995334] usb 1-1.3: New USB device found, idVendor=1a40, idProduct=0201
[ 4290.995426] usb 1-1.3: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[ 4290.995504] usb 1-1.3: Product: USB 2.0 Hub [MTT]
[ 4291.015584] hub 1-1.3:1.0: USB hub found
[ 4291.015995] hub 1-1.3:1.0: 7 ports detected
[ 4291.303693] usb 1-1.3.1: new high speed USB device number 26 using dwc_otg
[ 4291.406258] usb 1-1.3.1: New USB device found, idVendor=1a40, idProduct=0101
[ 4291.406347] usb 1-1.3.1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[ 4291.406417] usb 1-1.3.1: Product: USB 2.0 Hub
[ 4291.422769] hub 1-1.3.1:1.0: USB hub found
[ 4291.433717] hub 1-1.3.1:1.0: 4 ports detected
[ 4291.535242] INFO:: periodic_channel_available: Total channels: 8, Periodic: 5, Non-periodic: 3
[ 4291.535259]
[ 4291.535280] INFO:: schedule_periodic: No host channel available for periodic transfer.
[ 4291.535292]
[ 4291.535370] ERROR::dwc_otg_hcd_urb_enqueue:518: DWC OTG HCD URB Enqueue failed adding QTD. Error status -4008
[ 4291.535384]
[ 4291.535562] hub 1-1.3.1:1.0: activate --> -4008
User avatar
Posts: 1980
Joined: Tue Nov 22, 2011 11:51 pm
by jackokring » Wed Aug 08, 2012 4:52 am
This appears as a software issue, and may effect some single devices with internal multifunction. I haven't tried. I think it's maybe a fixed size array in the USB driver. Assuming self powered hubs of course ...

Cheers Jacko
Pi=B256R0USB CL4SD8GB Raspbian Stock. https://sites.google.com/site/rubikcompression/strictly-long https://dl.dropboxusercontent.com/u/1615413/Own%20Work/Leptronics.pdf https://groups.google.com/forum/#!topic/comp.compression/t22ct_BKi9w
User avatar
Posts: 784
Joined: Tue Jul 31, 2012 8:27 am
Location: London, UK
by elatllat » Wed Aug 08, 2012 7:53 am
jbeale wrote:...has anyone successfully daisy-chained two or more hubs from the R-Pi?...


As indirectly stated in my OP I can get 6 of a 10-port-hub daisy-chained off a 7-port-hub working.

jbeale wrote:...My 10-port hub is internally configured as a 7+4 port hub...


So maybe only some types of hubs are daisy-chainedable with the rpi, or maybe there is a max depth. My 10-port-hub is also a 7+4:

Code: Select all
cat /var/log/kern.log |grep "] hub"
Aug  5 23:01:19 raspbian kernel: [    3.266071] hub 1-0:1.0: USB hub found
Aug  5 23:01:19 raspbian kernel: [    3.272652] hub 1-0:1.0: 1 port detected
Aug  5 23:01:19 raspbian kernel: [    3.938399] hub 1-1:1.0: USB hub found
Aug  5 23:01:19 raspbian kernel: [    3.945373] hub 1-1:1.0: 3 ports detected
Aug  5 23:01:19 raspbian kernel: [    4.709066] hub 1-1.3:1.0: USB hub found
Aug  5 23:01:19 raspbian kernel: [    4.717682] hub 1-1.3:1.0: 7 ports detected
Aug  5 23:01:19 raspbian kernel: [    5.194829] hub 1-1.3.1:1.0: USB hub found
Aug  5 23:01:19 raspbian kernel: [    5.202637] hub 1-1.3.1:1.0: 7 ports detected
Aug  5 23:01:19 raspbian kernel: [    9.629203] hub 1-1.3.1.1:1.0: USB hub found
Aug  5 23:01:19 raspbian kernel: [    9.639018] hub 1-1.3.1.1:1.0: 4 ports detected
Aug  5 23:04:56 raspbian kernel: [  245.865225] hub 1-1.3.1.1:1.0: unable to enumerate USB device on port 4
Posts: 1027
Joined: Sat Dec 17, 2011 5:05 pm
by jbeale » Wed Aug 08, 2012 11:16 pm
According to this post, you are limited to a total of 8 hub ports in the USB driver:

viewtopic.php?f=28&t=12097&p=145278#p145479
Also note that there is a deficiency in the driver which means we're limited currently to a maximum of 8 periodic endpoints, this is because the driver reserves a channel (of which there are eight) for each periodic endpoint. Now I believe that for each hub port you have at least one interrupt endpoint so once you get to seven hub ports then you run out of channels!
User avatar
Posts: 1980
Joined: Tue Nov 22, 2011 11:51 pm
by elatllat » Thu Aug 09, 2012 7:49 pm
As I noted in that thread you can add hubs until this number hits 7:
Code: Select all
lsusb -v | grep -iP "Transfer Type.*(Interrupt|Isochronous)" | wc -l

After that, hubs won't work.
(That is about 2 hubs with 7 ports each assuming they are not internally split)
Posts: 1027
Joined: Sat Dec 17, 2011 5:05 pm
by Stric » Wed Aug 15, 2012 9:37 pm
My WiFi dongle (TP-Link TL-WN721N) eats 2 channels and a Logitech C270 HD Webcam eats a whopping 16. Right now my rpi shows 23 when these two are connected to a 4p genesys based hub. Given previous information, I might not be surprised that wifi gets randomly non-worky when taking snapshots with the webcam.

Is there a way to fix this?
Posts: 2
Joined: Wed Aug 15, 2012 9:32 pm
by dom » Wed Aug 15, 2012 11:03 pm
Stric wrote:My WiFi dongle (TP-Link TL-WN721N) eats 2 channels and a Logitech C270 HD Webcam eats a whopping 16. Right now my rpi shows 23 when these two are connected to a 4p genesys based hub. Given previous information, I might not be surprised that wifi gets randomly non-worky when taking snapshots with the webcam.

Is there a way to fix this?

If you are getting "INFO:: schedule_periodic: No host channel available for periodic transfer." then there is a source code patch available (from one of the github issues) that seems to help this case.

I need to merge the code in, in a way that it can be easily switched on and off (e.g. module parameter) so more people can test it.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3999
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by jweob » Wed Aug 22, 2012 2:27 am
Hi Dom

I have this issue as well - my webcam stops working after a short time and when check dmesg I get the error messages below. The webcam is plugged into a four port USB hub. The other devices on the hub are a wifi dongle and a lego mindstorms brick.

I checked github for the patch you mentioned but couldn't find the right one. Can you provide any more information on which patch I need to use (hints on installation would be great too!).

Thanks!

[ 506.559820] INFO:: periodic_channel_available: Total channels: 8, Periodic: 4, Non-periodic: 4
[ 506.559837]
[ 506.559859] INFO:: schedule_periodic: No host channel available for periodic transfer.
[ 506.559870]
[ 506.560053] ERROR::dwc_otg_hcd_urb_enqueue:518: DWC OTG HCD URB Enqueue failed adding QTD. Error status -4008
[ 506.560067]
[ 506.560089] uvcvideo: Failed to submit URB 0 (-4008).
Posts: 13
Joined: Sun Jul 15, 2012 1:56 pm
by dom » Wed Aug 22, 2012 9:09 am
jweob wrote:I checked github for the patch you mentioned but couldn't find the right one. Can you provide any more information on which patch I need to use (hints on installation would be great too!).

Update to latest firmware (e.g. with rpi-update). Add
microframe_schedule=1
to cmdline.txt
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3999
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by jweob » Thu Aug 23, 2012 3:29 am
Thank you very much for the quick reply! Unfortunately I still get the same problem. I have used rpi_update following the instructions on https://github.com/Hexxeh/rpi-update and then added the text to commandline.txt in the boot directory so that commandline.txt now reads:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 $
smsc95xx.turbo_mode=N
microframe_schedule=1


When I run the webcam it works for a few minutes then it stops. I check dmesg and see:

[ 165.799645] smsc95xx 1-1.1:1.0: eth0: Failed to read register index 0x00000114
[ 476.758782] smsc95xx 1-1.1:1.0: eth0: Failed to read register index 0x00000114
[ 963.005308] smsc95xx 1-1.1:1.0: eth0: Failed to read register index 0x00000118
[ 977.846275] INFO:: periodic_channel_available: Total channels: 8, Periodic: 4, Non-periodic: 4
[ 977.846292]
[ 977.846316] INFO:: schedule_periodic: No host channel available for periodic transfer.
[ 977.846326]
[ 977.849486] ERROR::dwc_otg_hcd_urb_enqueue:518: DWC OTG HCD URB Enqueue failed adding QTD. Error status -4008
[ 977.849502]
[ 977.849606] uvcvideo: Failed to submit URB 0 (-4008).


The smsc95xx error didn't start appearing until I added "smsc95xx.turbo_mode=N". This was following advice in another thread on how to stop the pi from crashing under load.

Any ideas what I'm doing wrong?

Thanks again!
Posts: 13
Joined: Sun Jul 15, 2012 1:56 pm
by kg001 » Thu Aug 23, 2012 4:16 am
I am interested to see if you have similar issues to me. Can you constantly ping your PI from another machine? & let me know what happens to the ping time when the webcam fails. My ping times go from 0.3ms at the command line to 500ms to 1000ms with a desktop environment open then to 3000ms+, once I am actively using anything from the desktop, at that point things start dropping off external connections.
Posts: 14
Joined: Wed Jul 25, 2012 1:06 pm
Location: Pt Augusta South Australia
by fbutler » Thu Aug 23, 2012 7:00 am
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 $
smsc95xx.turbo_mode=N
microframe_schedule=1

Any ideas what I'm doing wrong?

Thanks again!

It looks like you have added the additional options as separate lines in cmdline.txt. They need to be appended to the first line instead
User avatar
Posts: 299
Joined: Thu Mar 15, 2012 4:09 pm
Location: Surrey, England
by jweob » Thu Aug 23, 2012 11:02 am
Thanks fbutler! I have put the options at the end of the line instead so my cmdline.txt looks like this:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait smsc95xx.turbo_mode=N microframe_schedule=1


However I still get the same problem. Webcam stops, dmesg reads:

[ 38.779457] wlan0: no IPv6 routers present
[ 111.370517] INFO:: periodic_channel_available: Total channels: 8, Periodic: 4 , Non-periodic: 4
[ 111.370533]
[ 111.370556] INFO:: schedule_periodic: No host channel available for periodic transfer.
[ 111.370567]
[ 111.370901] ERROR::dwc_otg_hcd_urb_enqueue:518: DWC OTG HCD URB Enqueue faile d adding QTD. Error status -4008
[ 111.370915]
[ 111.370939] uvcvideo: Failed to submit URB 0 (-4008).
[ 241.260876] smsc95xx 1-1.1:1.0: eth0: Failed to read register index 0x0000011 4


Any ideas?

@kg001 I am able to ping my pi consistently, but I am just using the CLI over SSH. Ping is usually 1-5ms, occasionally as long as 200 ms but only once or twice.
Posts: 13
Joined: Sun Jul 15, 2012 1:56 pm
by kg001 » Thu Aug 23, 2012 6:51 pm
Thanks for the info looks like the issue i'm having is not related Running my CLI via SSH as well incidentally.

Cheers KG001
Posts: 14
Joined: Wed Jul 25, 2012 1:06 pm
Location: Pt Augusta South Australia
by fbutler » Thu Aug 23, 2012 7:46 pm
jweob wrote:Thanks fbutler! I have put the options at the end of the line instead so my cmdline.txt looks like this:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait smsc95xx.turbo_mode=N microframe_schedule=1


However I still get the same problem. Webcam stops

Perhaps a silly question. Did you reboot the Pi after you made the change and before testing?
User avatar
Posts: 299
Joined: Thu Mar 15, 2012 4:09 pm
Location: Surrey, England
by dom » Thu Aug 23, 2012 11:59 pm
jweob wrote:Thanks fbutler! I have put the options at the end of the line instead so my cmdline.txt looks like this:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait smsc95xx.turbo_mode=N microframe_schedule=1


Should be:
dwc_otg.microframe_schedule=1
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3999
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by jweob » Fri Aug 24, 2012 2:23 am
Thanks for the help. I have made the edit and rebooted but still get the error. Webcam runs for about 2 mins then I get the same error. Sorry to keep asking you on this, what should I try next? :oops:

cmdline.txt
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait smsc95xx.turbo_mode=N dwc_otg.microframe_schedule=1


dmesg
[ 1214.197366] INFO:: periodic_channel_available: Total channels: 8, Periodic: 4, Non-periodic: 4
[ 1214.197383]
[ 1214.197406] INFO:: schedule_periodic: No host channel available for periodic transfer.
[ 1214.197416]
[ 1214.197618] ERROR::dwc_otg_hcd_urb_enqueue:518: DWC OTG HCD URB Enqueue failed adding QTD. Error status -4008
[ 1214.197633]
[ 1214.197654] uvcvideo: Failed to submit URB 0 (-4008).
Posts: 13
Joined: Sun Jul 15, 2012 1:56 pm
by dom » Fri Aug 24, 2012 9:22 am
jweob wrote:Thanks for the help. I have made the edit and rebooted but still get the error. Webcam runs for about 2 mins then I get the same error. Sorry to keep asking you on this, what should I try next? :oops:

cmdline.txt
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait smsc95xx.turbo_mode=N dwc_otg.microframe_schedule=1


I assume thereisn't a new line in cmdline.txt?
Can you report output of:
uname -a
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3999
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by samsamsam » Fri Aug 24, 2012 11:58 am
I had similar problem. When I put
Code: Select all
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait smsc95xx.turbo_mode=N dwc_otg.microframe_schedule=1


The parameter dwc_otg.microframe_schedule=1 not working, but when I set:
Code: Select all
dwc_otg.microframe_schedule=1 dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait smsc95xx.turbo_mode=N

It's works very well.
Posts: 36
Joined: Fri Aug 17, 2012 11:36 am
by jweob » Fri Aug 24, 2012 3:02 pm
Sorry - your original solution did work. When I did uname -a I saw that I had version 3.1.9. I did the update a few weeks ago and didn't realise there had been a firmware update since then. Rerunning rpi-update fixes the issue, webcam can now run indefinitely

Thanks for all the help!
Posts: 13
Joined: Sun Jul 15, 2012 1:56 pm