bromham
Posts: 27
Joined: Sat Oct 27, 2018 4:09 pm

Pi 4 fails to boot when active USB switch attached

Sat Jul 06, 2019 9:38 pm

I have an interesting issue with my new Pi 4 (4 GB) with the official power supply.

I have a Ugreen USB switch that switches a keyboard and mouse between two computers when a button on the switch is pressed. The keyboard and mouse plug into the switch and there are two USB cables on the other side of the switch, one going to each of two separate computers, one of which is the new Pi 4.

I've discovered that the Pi fails to boot when the cable from the switch is plugged into it AND the switch is set to connect the keyboard and mouse to the Pi. It always boots fine when the USB cable is disconnected and when the switch is set to select the other computer but never boots if the cable is connected and the switch is set to select the Pi. When the Pi fails to boot, the red LED comes on but nothing else happens: no LED flickering, no sign of life on an attached HDMI monitor. The failure happens with both USB2 and USB3 ports.

Once the Pi has started to boot, the USB switch works as it should: I can switch the keyboard and mouse between the Pi and the other computer at will and it all works as expected.

I can avoid the issue by making sure that the switch is set to select the other computer when booting the Pi, so this is more of a minor nuisance than a problem, but I wondered if anyone has any ideas why this is happening. Some signal or voltage on the USB cable from the switch is somehow stopping the Pi from booting.

trejan
Posts: 3709
Joined: Tue Jul 02, 2019 2:28 pm

Re: Pi 4 fails to boot when active USB switch attached

Sat Jul 06, 2019 10:24 pm

I've got one of these USB switch boxes. Dug it out and it does exactly the same as what you're seeing. If you disconnect the other computer from the box then it doesn't need you to switch again and back. My guess is that the switch box is backfeeding power up the USB cables and the RPi 4 doesn't like it.

Chimneyfactory
Posts: 58
Joined: Sun May 19, 2019 1:30 pm

Re: Pi 4 fails to boot when active USB switch attached

Sun Jul 07, 2019 2:33 pm

I can confirm my Pi4 4gb does this as well.

Doesn't even attempt to boot if a powered USB hub is connected.

The moment the hub is disconnected, the pi starts booting.

trejan
Posts: 3709
Joined: Tue Jul 02, 2019 2:28 pm

Re: Pi 4 fails to boot when active USB switch attached

Mon Jul 08, 2019 11:41 pm

Confirming that the RPi 4 doesn't like it if you backpower it from the USB ports and won't restart. I sliced open one of USB cables on the USB switch and disconnected the red power wire so the USB switch is now only powered from one side only. No problems with restarting the RPi 4 after doing that.

bromham
Posts: 27
Joined: Sat Oct 27, 2018 4:09 pm

Re: Pi 4 fails to boot when active USB switch attached

Tue Jul 09, 2019 9:11 pm

Thanks to Chimneyfactory and trejan for their comments. Another way of avoiding the issue may be to insert a diode in the red power wire in the USB cable between the switch and the PI, so that the switch can be powered from the Pi but the Pi can't be back-powered from the "other computer" via the switch.

I don't know enough about the USB spec to know whether it's valid for a peripheral to present power to the host but I wonder if anyone from the Foundation could comment on whether this failure-to-boot behaviour is correct/expected.

trejan
Posts: 3709
Joined: Tue Jul 02, 2019 2:28 pm

Re: Pi 4 fails to boot when active USB switch attached

Tue Jul 09, 2019 9:52 pm

bromham wrote:
Tue Jul 09, 2019 9:11 pm
Another way of avoiding the issue may be to insert a diode in the red power wire in the USB cable between the switch and the PI, so that the switch can be powered from the Pi but the Pi can't be back-powered from the "other computer" via the switch.
I'd be wary of the voltage drop on that even with a Schottky diode. It depends on what USB peripherals are plugged into the front of this switch unit and how tolerant they are of low VBUS.

If the diode doesn't work with your peripherals then disconnecting the red wire in both leads and using the separate micro USB power socket is the next best option.

James Adams
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 127
Joined: Wed Mar 19, 2014 2:58 pm
Location: Cambridge

Re: Pi 4 fails to boot when active USB switch attached

Wed Jul 10, 2019 9:59 am

USB peripherals should never back-power VBUS like this - so this is bad peripheral behaviour.

VBUS applied to an unpowered Pi will cause the rails to charge up and the PMIC will then not start (as it is designed to only start from a known state - all rails less than ~200mV - so it makes sure the power up sequence is well controlled).
James Adams
Raspberry Pi - COO & Hardware Lead

hippy
Posts: 10733
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Pi 4 fails to boot when active USB switch attached

Wed Jul 10, 2019 10:09 am

James Adams wrote:
Wed Jul 10, 2019 9:59 am
VBUS applied to an unpowered Pi will cause the rails to charge up and the PMIC will then not start (as it is designed to only start from a known state - all rails less than ~200mV - so it makes sure the power up sequence is well controlled).
It is not clear to me how a back-powered 5V VBus causes the PMIC output rails, which are all 3V3 and less, to be affected, prevents the PMIC from starting, but my question is - Does this also apply to the Pi 3B+ ?

bromham
Posts: 27
Joined: Sat Oct 27, 2018 4:09 pm

Re: Pi 4 fails to boot when active USB switch attached

Wed Jul 10, 2019 5:59 pm

This issue doesn't apply to the Pi 3B. I've just swapped over my Pi 4 for a Pi 3B and it boots consistently when attached to the USB switch whether or not the other computer attached to the switch is switched on and whichever computer is selected on the switch.

I don't have a 3B+ to check but I suspect that this behaviour is specific to the Pi 4.

It would be interesting to see if the issue apears when any powered USB device (such as a simple powered hub) is attached to a Pi 4 before boot.

trejan
Posts: 3709
Joined: Tue Jul 02, 2019 2:28 pm

Re: Pi 4 fails to boot when active USB switch attached

Wed Jul 10, 2019 7:33 pm

bromham wrote:
Wed Jul 10, 2019 5:59 pm
It would be interesting to see if the issue apears when any powered USB device (such as a simple powered hub) is attached to a Pi 4 before boot.
Same problem when restarting with a powered USB hub that presumably backpowers the RPi

bromham
Posts: 27
Joined: Sat Oct 27, 2018 4:09 pm

Re: Pi 4 fails to boot when active USB switch attached

Wed Jul 10, 2019 8:26 pm

trejan wrote:
Wed Jul 10, 2019 7:33 pm
Same problem when restarting with a powered USB hub that presumably backpowers the RPi
Then, even if a USB device "shouldn't" back-power the computer it's connected to, the Pi 4 is unusual in refusing to boot in this situation. No other computer I've ever used with a powered hub (including earlier versions of Pi) has shown this behaviour. It's easy to work around in my situation (just switch the mouse/keyboard to the other computer before booting the Pi), but not easy to tolerate if using a powered hub to connect external disks.

Are there any powered USB-hubs that don't back-power?

bromham
Posts: 27
Joined: Sat Oct 27, 2018 4:09 pm

Re: Pi 4 fails to boot when active USB switch attached

Wed Jul 10, 2019 8:48 pm

bromham wrote:
Wed Jul 10, 2019 8:26 pm

Are there any powered USB-hubs that don't back-power?
To answer my own question (sorry - should have Google'd before posting), yes, there are. This one from Pi-hut is reported as not doing so. Something to be aware of when connecting disks to the Pi 4.

dismaldunc
Posts: 1
Joined: Thu Aug 15, 2019 3:11 pm

Re: Pi 4 fails to boot when active USB switch attached

Thu Aug 15, 2019 3:17 pm

hi peeps, yup I have this issue too, I bought the hub from the pihut just because it said this hub would not backfeed into the pi, the external drive I have plugged into the hub is usb 3. So I plugged the hub into the usb 3 port on the pi.

however if I plug it into one of the old usb 2 ports it boots fine. which is a pain as i wanted the fast transfer rates

nbgh007
Posts: 8
Joined: Tue Aug 20, 2019 7:45 am

Re: Pi 4 fails to boot when active USB switch attached

Wed Aug 21, 2019 3:29 pm

Everyone, I have started a similar Thread in the Raspbian Bug Report thread about this problem ("Buster fails to (re)boot with powered USB Switch/Hub") because...

Whilst I would have been tempted to agree on the hardware being the source of the problem - that was my first thought - the fact that it worked with a July version of Stretch on RPI 3b+, and then does not work anymore on the same RPI 3b+ with the latest version of Stretch contradicts that first thought...

And therefore, I do think that it is a problem with a recent raspbian update. Note that the problem appears earlier in Buster than in Stretch...

bogdanserban
Posts: 3
Joined: Sun Sep 08, 2019 12:18 pm

Re: Pi 4 fails to boot when active USB switch attached

Sun Sep 08, 2019 12:26 pm

I can confirm the same issue on my RPi4 with a "orico" USB3 hub. However, I dismantled the hub and desoldered the +5V wire so that it doesn't backfeed into the Pi, and surprise, it still won't boot. So I suspect it's some kind of flag that the hub controller sends back to he Pi.

Image

Image

trejan
Posts: 3709
Joined: Tue Jul 02, 2019 2:28 pm

Re: Pi 4 fails to boot when active USB switch attached

Sun Sep 08, 2019 1:48 pm

bogdanserban wrote:
Sun Sep 08, 2019 12:26 pm
I can confirm the same issue on my RPi4 with a "orico" USB3 hub. However, I dismantled the hub and desoldered the +5V wire so that it doesn't backfeed into the Pi, and surprise, it still won't boot. So I suspect it's some kind of flag that the hub controller sends back to he Pi.
It shouldn't be any flag. It is probably https://www.raspberrypi.org/forums/view ... 0#p1532221

aklimaj
Posts: 4
Joined: Thu Sep 12, 2019 5:19 pm

Re: Pi 4 fails to boot when active USB switch attached

Thu Sep 12, 2019 5:20 pm

I am seeing the same problem but with just a powered USB device connected.

Kansio
Posts: 1
Joined: Wed Sep 09, 2020 5:30 pm

Re: Pi 4 fails to boot when active USB switch attached

Wed Sep 09, 2020 5:59 pm

Hi,
I've configuration with two MC7304 LTE modems connectet to USB3.0 ports.
Modems have independent supply and stays powered when RP4 goes to reboot state.
Boot process fails due to some internal issue inside brigde LV805 (PCIexpress to 2xUSB3.0 from VIA).
In my application only ground, D+ and D- are routed toward modems, VBUS I left open.
Super speed wires are left open too.
I checked some test points on PR4 board and found that TP11 (+3.3V bus) is polarized (524mV on my board)
when main +5V supply is disconnected.
Every USB device has internal polarisation circuits inside, D+ and D- have about 1000mV forced by internall pull-up.
Those voltages leaks inside the brigde circuit into the +3.3V bus and breaks normal power down sequence.
On RP4 five output universal PMIC from Maxim MxL7704 is used, this ic provides requered sequence for voltages power up and down,
it is a programable unit (I2C interface to PR4 main cpu).
I assume, that unwanted voltage on TP11 breaks the normal power down sequence and RP4 can't reboot normally.
I checked configuration with one modem, TP11 has 438mV on my board and RP4 starts normaly, but I found in my staff old fashion USB2.0 self-powered hub form D-Link and this units can break reboot process when is connected to USB3.0 port.

There is no chance to play with this issue because every usb device have internal pull-up on D+ and D- and reverse polarisation occurs everytime, when USB3.0 port is used. If you are lucky, internal pull up is to week to break reboot process, but always some risk exists, when ambient temperature will change, voltages may change too.

I hope, it explains, why reboot problem occurs when self powered devices are connected to USB3.0 port.
Regards
Mark

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4111
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Pi 4 fails to boot when active USB switch attached

Thu Sep 10, 2020 2:01 pm

My understanding is that any USB device that pulls DP/DN when VBUS is off is violating the USB spec. The usual advice is put a USB 3.0 hub (one that doesn't violate the spec!) between the device and the Pi 4.

Amiga-Quantum52
Posts: 2
Joined: Wed Feb 12, 2020 5:45 pm

Re: Pi 4 fails to boot when active USB switch attached

Fri Sep 11, 2020 7:06 pm

I have found a solution to this problem, but isn't for the faint hearted!! :o :o

I currently have a Raspberry Pi 4 8GB with 2 USB 3 4 port hubs connected to 4 Hard Drives (18Tb total) as well as USB 3 SSD enclosure for USB booting. I am using it as an enhanced RAID system.

The problem is all these cheap 4 port USB 3 hubs that you find on both eBay and Amazon are very poorly designed. The external 5V is connected to both Upstream and Downstream VBUS which causes confusion in the Raspberry Pi USB controller and the back powering problems. It has been suggested to cut the red cable (VBUS Upstream) between the Pi and the USB hub, however this is only half the job. I have found that just cutting the red cable with my connected Hard Drives the Pi would randomly not recognised the attached Drives or not see the Drives after a reboot. I have also found that the Hard Drives would not reset or enter standby after a reboot leaving the Drives in a active state.

The only way was to send a software reset to the USB hub or disconnect and reconnect the Drive for the Pi to see the Drives which is a right pain.

:idea: The way round this problem is to disconnect the Pi Upstream VBUS Red Cable and connect it to the reset circuit of the USB Hub Controller chip. The USB Hubs I have been using have either a GL3510 or GL3520 Controller chip and both the external 5V rail and the Upstream VBUS are both connected to the reset circuit, so there is no way of resetting the Controller chip by lowering the Upstream VBUS. You need to lift one end of R1 disconnecting that end from the external 5V rail and solder the Pi Upstream VBUS cable to the other end of R1.
USB VBUS Mod.jpg
USB VBUS Mod.jpg (94.84 KiB) Viewed 5290 times
I have noticed that during boot the Pi raises and lowers VBUS causing the USB Hub to reset itself and any attached Drives once I performed this mod. This never happened with just cutting the red cable from the Pi. But by doing this mod everything works perfectly :D :D :D

Hope this helps :D

Regards

Lee

martinu
Posts: 20
Joined: Mon Oct 08, 2018 1:09 pm

Re: Pi 4 fails to boot when active USB switch attached

Sun Sep 13, 2020 5:02 pm

Does anyone have any recommendations for a powered USB3 hub which doesn't back-power the Pi - or how to determine from a spec on Amazon etc which hubs are safe and don't back-power? It's one thing for people to say "cheap hubs break the rules by back-powering" but I want to know what to buy to avoid the problem.My spinning HDD needs to be powered from a hub, rather than from the Pi which causes the Pi to run hot (about 65 deg C rather than the normal 50-55 deg C) and which fails to spin the disk at all if other USB devices are also plugged into the Pi (all this is using the certified Pi 4 PSU). So external power to HDD is definitely needed!

I have found that if the Pi is rebooted (as opposed to shutdown and power-cycled) it boots perfectly. If the power to the Pi is removed (either following shutdown, or after a power cut) and then reapplied, the Pi sits with no flashing of the green light and no output on the HDMI - nothing to give you a clue where the problem lies :-( Unplugging and then immediately plugging back in either the hub from the Pi or the hub's PSU from the hub allows booting to continue.

Is it right that one guaranteed solution is to interpose a non-powered hub between powered hub and Pi and/or to cut the +5V (red) wire between the hub and the Pi?

The Pi Hut sell https://thepihut.com/products/usb-2-0-p ... wer-supply, but is there an equivalent USB3 version?

Has the list https://elinux.org/RPi_Powered_USB_Hubs been updated so its information and recommendations is relevant to the Raspberry Pi 4?

HankB
Posts: 139
Joined: Fri Jan 01, 2016 2:45 pm

Re: Pi 4 fails to boot when active USB switch attached

Tue Sep 29, 2020 9:01 pm

Hi all,
I'm not clear if my configuration is susceptible to back-powering my Pi 4B. I have a powered hub (*) with 4 USB-3 type A ports. I connect the "input" of the hub to a USB-3 port on the Pi. That is the only USB port in use on the Pi. I connect an SSD, kepboard and unifying receiver to the hub. I connect a USB-A to USB-C cable to the power input port on the Pi.
Normal cold power on procedure is to make all connections and then apply power to the hub (which in turn provides power to Pi, SSD, keyboard and mouse.) The system comes up reliably.
I can warm boot ("sudo shutdown -r now") without any apparent issues.
I check "dmesg" output for undervolt and find none reported. I've also run stress tests and disk benchmarks with mo issues found.
(*) This works as reported with the Anker 7 port powered USB-3 hub as well as an Amazon basics powered USB-3 hub. A 4 port powered Sabrent USB-3 hub reports an undervoltage in at (IIRC) about 15 seconds in but otherwise seems to work OK. (I'm not using it, just noting the issue.)
Is this configuration susceptible to this (or other) problems?

Thanks!

martinu
Posts: 20
Joined: Mon Oct 08, 2018 1:09 pm

Re: Pi 4 fails to boot when active USB switch or hub attached

Wed Sep 30, 2020 12:47 pm

HankB wrote:
Tue Sep 29, 2020 9:01 pm
Hi all,
I'm not clear if my configuration is susceptible to back-powering my Pi 4B. I have a powered hub (*) with 4 USB-3 type A ports. I connect the "input" of the hub to a USB-3 port on the Pi. That is the only USB port in use on the Pi. I connect an SSD, kepboard and unifying receiver to the hub. I connect a USB-A to USB-C cable to the power input port on the Pi.
Normal cold power on procedure is to make all connections and then apply power to the hub (which in turn provides power to Pi, SSD, keyboard and mouse.) The system comes up reliably.
I can warm boot ("sudo shutdown -r now") without any apparent issues.
I check "dmesg" output for undervolt and find none reported. I've also run stress tests and disk benchmarks with mo issues found.
(*) This works as reported with the Anker 7 port powered USB-3 hub as well as an Amazon basics powered USB-3 hub. A 4 port powered Sabrent USB-3 hub reports an undervoltage in at (IIRC) about 15 seconds in but otherwise seems to work OK. (I'm not using it, just noting the issue.)
Is this configuration susceptible to this (or other) problems?

Thanks!
The critical thing that you do differently is "Normal cold power on procedure is to make all connections and then apply power to the hub" (my emphasis). The problem is that if there is a power cut and the power is then restored, you won't have the luxury of being able to turn on the hub after the Pi: all the power (Pi and hub) will come on at the same time when the power is restored.

I've made up a USB-A (plug) to USB-A (socket) lead with the red +5V line cut, and I put this between my hub and the Pi's USB3 port. But if there is a power cut, or the Pi is shutdown and then started (as opposed to a warm reboot) while the hub is powered, the Pi still sits there indefinitely until the hub is power-cycled or the USB lead is unplugged and then replugged.

So I think back-powering of the Pi from the hub might be a red herring - at least in terms of power on the +5V line. I've read other postings that suggest that if the data lines have any externally-supplied voltage on them at boot time, the Pi won't boot. This looks as if it's a design flaw in the Pi 4. My Pi 3, with the same hub and the same devices plugged in (TV tuners in Pi's USBs, HDD in hub) boots fine after a power cut or an intentional shutdown and power-up (eg when removing the card to make an image of it). It was after making an image of my newly-configured Pi 4 that I first experienced the lockup and realised that there was also the power-cut vulnerability. Since then we had a brief 2-second power cut during a storm and my fears were proved to be correct.

Have Pi hardware engineers investigated and found a solution, either in terms of firmware update or else a list of known-good hubs which allow power to be restored to Pi and hub simultaneously (after a power interruption) and for the Pi 4 to boot sucessfully.

When I get chance I'll try with a powered HDD (as opposed to an HDD which gets its power through USB) which removes the need for a hub altogether while still supplying more power to the HDD than the Pi can safely supply through USB without its core temperature rising dramatically.

HankB
Posts: 139
Joined: Fri Jan 01, 2016 2:45 pm

Re: Pi 4 fails to boot when active USB switch or hub attached

Wed Sep 30, 2020 7:42 pm

Thanks for the reply and for looking into this far more deeply than I have.
martinu wrote:
Wed Sep 30, 2020 12:47 pm
The critical thing that you do differently is "Normal cold power on procedure is to make all connections and then apply power to the hub" (my emphasis). The problem is that if there is a power cut and the power is then restored, you won't have the luxury of being able to turn on the hub after the Pi: all the power (Pi and hub) will come on at the same time when the power is restored.
I think my description was not clear on cold start. Everything is off and powered via the hub. I apply power to the hub and it powers the Pi, SSD, keyboard and unifying receiver.

I've tried out another hub and found some interesting results. Using the hub from Amazon, the Pi 4B does not shut down cleanly. It restarts. That makes shutdown a little tricky since I have to pull power after shutdown and before it mounts file systems. I can see activity on the SSD adapter so I pull power as soon as there is disk activity. Next time I do this I'll time it and be able to pull power before that, presumably when the firmware is still finding the boot device. I have another powered hub I'm trying, a Wavlink (WL-UH3042P1 Rev B.) It provides sufficient current to avoid undervoltage and has a separate fast charging port with no data lines. I'm using the charging port to power the Pi and it does not exhibit this issue.

Return to “Troubleshooting”