sora03
Posts: 193
Joined: Mon Dec 29, 2014 4:11 pm
Contact: Website

Any workaround for USB HUB STT?

Thu Aug 15, 2019 1:00 pm

I have a problem with a new USB hub, it has an external PSU. It is a generic USB Hub 7 ports, based on lsusb, it has two USB STT not TT per port hub. I have 3 devices connected but this causes the USB HDD SATA to disconnects (USB SATA is connected directly to Pi and not in the hub, since that hub cannot handle USB HDDs). I have the rootfs on the USB HDD, so it being disconnected will cause EXT4 errors, making me do a hard reboot. I have isolated the problem, (sort of), the USB 3G Huawei E153 if plugged in to the hub causes the HDD disconnection issue. Is there a workaround for this, I mean some dwc.otg parameters except dwc_otg.speed=1? I have also updated the firmware with rpi-update but no joy.

For more info:
USB HUB has these (Downstream):
- USB 3G (if plugged in, causes USB HDD SATA to be disconencted randomly even at boot)
- USB webcam (320p)
- USB DVBT RTL2832U
(not a PSU issue)

PI 3B+ USB:
- USB HDD SATA
- USB WIFI RALINK
- USB PORT UPSTREAM
- official Pi PSU
(not a PSU issue)

I have opened a github issue (it has more info than this post), but no one is interested to even reply.
https://github.com/raspberrypi/firmware/issues/1222

Is there a way to reset the pi with Sysrq when the USB SATA got disconnected? No external program just in RAM.

Thank You
FLOSS enthusiast, Debian user (linux-libre)

User avatar
thagrol
Posts: 1780
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Any workaround for USB HUB STT?

Thu Aug 15, 2019 6:37 pm

Is your USB hub really a seven port hub or is it two four port hubs one cascaded off the other?

By "USB PORT UPSTREAM" do you mean the hub's upstream port to the 3B+?

Do you get the same result with the USB 3G dongle connected directly to the 3B+ (using an extention cable if needed)? If so, this would likely rule out the external hub as being the cause.

Some things to consider:
  • Too many active endpoints on the USB bus with everything connected. There's an upper limit that in the past that has manifested with too many (>5?) HDDs connected related to this. It's not impossible that other devices could cause similar problems. Search the forums but I don't recall there being any solution other than to use fewer devices.
  • Too many USB hubs in the chain though I'd expect that to manifest with device further down the tree.
  • Bandwidth and/or latency problems. For all models prior to 4B there is only one USB port on the SoC. so your maximum bandwidth across all device and the onboard ethernet is 480Mb/s
I doubt this is a STT/multtiple TT issue in the external hub. I wouldn't expect changes of this nature further down the tree to affect devices connected both higher up and on a different branch.
This space unintentionally left blank.

sora03
Posts: 193
Joined: Mon Dec 29, 2014 4:11 pm
Contact: Website

Re: Any workaround for USB HUB STT?

Sun Aug 18, 2019 2:29 am

Yes it is 7 port hub, I tested all the ports with my PC.
for the upstream. the USB hub is connected to one of the Pi's port.
More information can be found on the issue: https://github.com/raspberrypi/firmware/issues/1222

Whenever I connect the 3G dongle the HDD will have random disconnects.

Do you think using a Raspberry Pi 4 will mitigate this problem?
RPi4 is still not available in my country as of this time. :(
Thank you for your response
FLOSS enthusiast, Debian user (linux-libre)

User avatar
rpdom
Posts: 15019
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Any workaround for USB HUB STT?

Sun Aug 18, 2019 3:27 am

What is the rating of the power supply for the hub?

As thagrol said, most 7-port USB hubs contain two 4-port USB hub chips with the last port of the first chip linked to the upstream port of the second chip, and there is a limit on the number of USB endpoints (logical devices) that can be connected to all Pi models prior to the 4B, which is 6, I believe. You have to be careful here, as some physical USB devices show as more than one endpoint or even device.

andrum99
Posts: 778
Joined: Fri Jul 20, 2012 2:41 pm

Re: Any workaround for USB HUB STT?

Sun Aug 18, 2019 8:07 am

It sounds like you may be hitting the limit of the total number of USB devices the Pi 3B+ can use at the same time. I'm not sure if changing to a multi-TT hub would help.

If you want to try a multi-TT hub then I have successfully used the D-Link DUB-H7 revision B1 (https://eu.dlink.com/uk/en/products/dub ... sb-2-0-hub), although note that it is up to revision D now, so may work slightly differently. Although as I said above, changing hubs might not help.

You can use lsusb -t to see the USB devices on your system in "tree" form, which makes it easier to see if the hub contains two 4-port hub chips. The DUB-H7 does this trick, in the version I have. Your lsusb output shows two hub chips: both 214b:7000.

Since the hub you are using was back-powering the Pi until you put some tape over a connection, I'm not sure you can rule out a PSU problem with the hub. Back-powering is a sign that the hub is poor quality, since the manufacturer has left out protection components to reduce cost. Poor quality hubs can often have poor quality PSUs.

The Rapsberry Pi 4B would probably fix your problem, as the USB root hub is much more capable. But until you test it, you won't know for certain. You can buy the Pi 4B from another country and have it sent internationally, but the cost might be rather high. Which country are you in? Pimoroni ship from the UK to various destinations worldwide - see https://shop.pimoroni.com/pages/shipping-information - but note the list of countries which they don't ship to.

User avatar
thagrol
Posts: 1780
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Any workaround for USB HUB STT?

Sun Aug 18, 2019 11:12 am

@sora03:

When you say "Yes it is 7 port hub, I tested all the ports with my PC." that tells us very little. The number of physical ports dosn't map directly to how the OS on the host sees them and your PC is running a different OS to that on the Pi. Has it not struck you that seven is an odd number when most consumer USB hubs have two or four ports? Eight would be a more logical number unless the physical hub actually contains two four ports hubs in a cascaded/daisy chained configuration. The presence of "two USB STT" supports this as if it were a single seven port hub there'd only be one.

When you say "Whenever I connect the 3G dongle the HDD will have random disconnects." Does that happen if instead of conencting the 3G dongle via the hub you connect to one of the USB ports on the Pi? If so that pretty much rules out the hub as being the problem.

A further test to establish where the problem is:
  1. shut everything down
  2. disconnect one of your other USB devices from the hub (the webcam or the DVBT RTL2832U]
  3. connect the 3G dongle
  4. boot the pi
  5. plug in the previously disconnected device.
If you see the same behaviour the problem is not specific to the 3G dongle so more likely to be you hitting the know endpoint problem.

If the problem is the hub, your only solution is to purchase a better one. You can't solve this sort of hardware problem with software. As you only have three devices connected to the hub I suggest you go for a high quality four port hub over a low quality seven port one.

@rpdom:
I believe it's more complicated than just the number of endpoints/logical devices. It depends on what those devices are, what sort of end point, and other low level parts of the USB protocol. Seven keyboards might work but seven mass storage devices won't. Unfortunately I don't have any links to support this to hand and am by no means an expert on USB so could easily be wrong about this.

@andrum99:
"Back-powering is a sign that the hub is poor quality" As is not have a TT per port.

I wasn't aware that the 4B doesn't suffer from this limitation. Good to know but can you provide a supporting link please.
This space unintentionally left blank.

andrum99
Posts: 778
Joined: Fri Jul 20, 2012 2:41 pm

Re: Any workaround for USB HUB STT?

Sun Aug 18, 2019 11:22 am

thagrol wrote:
Sun Aug 18, 2019 11:12 am
I wasn't aware that the 4B doesn't suffer from this limitation. Good to know but can you provide a supporting link please.
Which limitation do you mean?

On Pi 4B the type-A USB ports are driven by a VLI805 which is designed as a host root hub. By contrast, the old USB block in the SoC was designed to be used in mobile phones or set-top boxes as an OTG-capable device-mode controller, so was rather limited in its capabilities. On Pi 4B the old USB block is routed to the type-C power connector. It also seems there is an internal USB 3.x block on the BCM2811, but this is not used on the Pi 4B.

User avatar
thagrol
Posts: 1780
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Any workaround for USB HUB STT?

Sun Aug 18, 2019 11:29 am

andrum99 wrote:
Sun Aug 18, 2019 11:22 am
thagrol wrote:
Sun Aug 18, 2019 11:12 am
I wasn't aware that the 4B doesn't suffer from this limitation. Good to know but can you provide a supporting link please.
Which limitation do you mean?
The no more than six endpoints one. I'm aware of the changes in USB hardware for the 4B, I'd expect the SoC's USB port exposed via the USB C connection to still be affected.

It was my understanding, possibly incorrectly, that there was also a software element to this restriction. Hence my request for supporting evidence before I try to add more than six HDD to my 4B based NAS.
This space unintentionally left blank.

User avatar
rpdom
Posts: 15019
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Any workaround for USB HUB STT?

Sun Aug 18, 2019 12:22 pm

thagrol wrote:
Sun Aug 18, 2019 11:12 am
I wasn't aware that the 4B doesn't suffer from this limitation. Good to know but can you provide a supporting link please.
https://www.raspberrypi.org/forums/view ... 5#p1484595

32 devices (not endpoints now) maximum on the new USB, plus 6 on the old one on the USB C connector.

User avatar
thagrol
Posts: 1780
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Any workaround for USB HUB STT?

Sun Aug 18, 2019 1:19 pm

rpdom wrote:
Sun Aug 18, 2019 12:22 pm
thagrol wrote:
Sun Aug 18, 2019 11:12 am
I wasn't aware that the 4B doesn't suffer from this limitation. Good to know but can you provide a supporting link please.
https://www.raspberrypi.org/forums/view ... 5#p1484595

32 devices (not endpoints now) maximum on the new USB, plus 6 on the old one on the USB C connector.
Execelent. Thanks.
This space unintentionally left blank.

sora03
Posts: 193
Joined: Mon Dec 29, 2014 4:11 pm
Contact: Website

Re: Any workaround for USB HUB STT?

Wed Aug 21, 2019 11:01 pm

rpdom wrote:
Sun Aug 18, 2019 3:27 am
What is the rating of the power supply for the hub?

As thagrol said, most 7-port USB hubs contain two 4-port USB hub chips with the last port of the first chip linked to the upstream port of the second chip, and there is a limit on the number of USB endpoints (logical devices) that can be connected to all Pi models prior to the 4B, which is 6, I believe. You have to be careful here, as some physical USB devices show as more than one endpoint or even device.
I have replaced the PSU with a more reputable one, it is not the problem.

andrum99 wrote: It sounds like you may be hitting the limit of the total number of USB devices the Pi 3B+ can use at the same time. I'm not sure if changing to a multi-TT hub would help.

If you want to try a multi-TT hub then I have successfully used the D-Link DUB-H7 revision B1 (https://eu.dlink.com/uk/en/products/dub ... sb-2-0-hub), although note that it is up to revision D now, so may work slightly differently. Although as I said above, changing hubs might not help.

You can use lsusb -t to see the USB devices on your system in "tree" form, which makes it easier to see if the hub contains two 4-port hub chips. The DUB-H7 does this trick, in the version I have. Your lsusb output shows two hub chips: both 214b:7000.

Since the hub you are using was back-powering the Pi until you put some tape over a connection, I'm not sure you can rule out a PSU problem with the hub. Back-powering is a sign that the hub is poor quality, since the manufacturer has left out protection components to reduce cost. Poor quality hubs can often have poor quality PSUs.

The Rapsberry Pi 4B would probably fix your problem, as the USB root hub is much more capable. But until you test it, you won't know for certain. You can buy the Pi 4B from another country and have it sent internationally, but the cost might be rather high. Which country are you in? Pimoroni ship from the UK to various destinations worldwide - see https://shop.pimoroni.com/pages/shipping-information - but note the list of countries which they don't ship to.
Sadly, pimoroni does not ship to my country. It is not a PSU problem, I have replaced it with a good one.

thagrol wrote: @sora03:

When you say "Yes it is 7 port hub, I tested all the ports with my PC." that tells us very little. The number of physical ports dosn't map directly to how the OS on the host sees them and your PC is running a different OS to that on the Pi. Has it not struck you that seven is an odd number when most consumer USB hubs have two or four ports? Eight would be a more logical number unless the physical hub actually contains two four ports hubs in a cascaded/daisy chained configuration. The presence of "two USB STT" supports this as if it were a single seven port hub there'd only be one.

When you say "Whenever I connect the 3G dongle the HDD will have random disconnects." Does that happen if instead of conencting the 3G dongle via the hub you connect to one of the USB ports on the Pi? If so that pretty much rules out the hub as being the problem.

A further test to establish where the problem is:
  1. shut everything down
  2. disconnect one of your other USB devices from the hub (the webcam or the DVBT RTL2832U]
  3. connect the 3G dongle
  4. boot the pi
  5. plug in the previously disconnected device.
If you see the same behaviour the problem is not specific to the 3G dongle so more likely to be you hitting the know endpoint problem.

If the problem is the hub, your only solution is to purchase a better one. You can't solve this sort of hardware problem with software. As you only have three devices connected to the hub I suggest you go for a high quality four port hub over a low quality seven port one.

@rpdom:
I believe it's more complicated than just the number of endpoints/logical devices. It depends on what those devices are, what sort of end point, and other low level parts of the USB protocol. Seven keyboards might work but seven mass storage devices won't. Unfortunately I don't have any links to support this to hand and am by no means an expert on USB so could easily be wrong about this.

@andrum99:
"Back-powering is a sign that the hub is poor quality" As is not have a TT per port.

I wasn't aware that the 4B doesn't suffer from this limitation. Good to know but can you provide a supporting link please.
My PC runs Debian GNU+Linux, so far I have tested USB wifi,2 usb flash drive, keyboard, mouse, usb dvb-t all plugged in and being detected in my PC. I suspect this issue may be fixed by using RPI 4.

Plugging the 3g dongle to the pi, then only 2 devices plugged on the hub will also cause the issue, it may not be related to the hub. this rules out the hub problem.
A further test to establish where the problem is:
  1. shut everything down
  2. disconnect one of your other USB devices from the hub (the webcam or the DVBT RTL2832U]
  3. connect the 3G dongle
  4. boot the pi
  5. plug in the previously disconnected device.
The same issue, HDD disconnects after I plug them in.

Thanks for all of your opinion for this problem.
FLOSS enthusiast, Debian user (linux-libre)

User avatar
thagrol
Posts: 1780
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Any workaround for USB HUB STT?

Thu Aug 22, 2019 12:07 am

sora03 wrote:
Wed Aug 21, 2019 11:01 pm
My PC runs Debian GNU+Linux, so far I have tested USB wifi,2 usb flash drive, keyboard, mouse, usb dvb-t all plugged in and being detected in my PC. I suspect this issue may be fixed by using RPI 4.
I'm afraid that tells us precisely nothing about the behaviour on a Pi. Your PC has completely different hardware (intel as opposed to ARM, no "hidden" USB hub, ethernet probably on PCI or PCIe, etc) and a different build of the OS: Debian compiled for x86 without any hardware or RPF software tweaks.
Plugging the 3g dongle to the pi, then only 2 devices plugged on the hub will also cause the issue, it may not be related to the hub. this rules out the hub problem.
That's what I was excting to see. The single TT vs multiple TT thing was very unlikely to be the cause. All that would do is slow USB 2 devices down to USB 1 speeds had any USB 1 devices been pluged in to the hub.
A further test to establish where the problem is:
  1. shut everything down
  2. disconnect one of your other USB devices from the hub (the webcam or the DVBT RTL2832U]
  3. connect the 3G dongle
  4. boot the pi
  5. plug in the previously disconnected device.
The same issue, HDD disconnects after I plug them in.
That suggests the problem is not specific to the 3G dongle but either a power or too many endpoints problem. Does the HDD still disconnect if instead of the keyboard or DVB-T stick you plug in an extra keyboard or mouse? It's not just the number of end point but the type as well.

Does your "more reputable" new PSU provide a well regulated 5v supply with a permitted load of at least 2.5 amps? If not it could still be the problem.
Thanks for all of your opinion for this problem.
All I can suggest now is that you either try a 4B (they don't have the endpoints problem) or split the tasks across two (or three) 3B.
This space unintentionally left blank.

Return to “Troubleshooting”