4

I am working on a project that involves Raspberry Pis which run 24/7, periodically fetch data from a server and display it on a screen.

We have a problem with the USB ports - they appear to stop working after about a week of uptime. This happens on five different units. Normally, the only device plugged into each RPi is a 3G/WiFi dongle through a powered USB hub.

I looked at server logs and found that a certain unit has stopped updating the data.
After driving to see the device, it was still running and looping the data on the screen but I couldn't connect a keyboard. I assumed that the USB controller or something related to it stopped working.
When I restarted the unit, everything was fine.

The Raspberry Pi is revision 000e (v1 model B, 512MB, PCB rev. 2).

I am in the process of updating the operating system image from Wheezy to Jessie.
It is possible that this problem was fixed in some kernel update or a similar thing.
With two extra units, I'd just do rpi-update on one and leave it
for a week while working on the upgrade using the other device.

It is possible that when I finish the new image and try running it for a few weeks, it works.
However I would appreciate any information about the cause of this problem
because a week is a long time to wait and I could find it still broken then.

EDIT: Unfortunately I couldn't allocate time for the testing. In the meantime I've worked around the issue by restarting the devices nightly during a quiet period.

varesa
  • 233
  • 1
  • 3
  • 8

3 Answers3

4

Here's a method about controlling the power to ports on a USB hub,
using software - the hub-ctrl.c app from a question that another
post above links to.
It can be used to wake up the USB ports (at a regular interval, a cron-job script
or over a SSH connection if only some devices attached to the bus have stopped).

Some useful information from a forum thread on the Raspberry Pi website:

mahjongg wrote:
the Pi model B+ has no hardware in place to disconnect power on the USB ports!

it can detect a short (USB power Fault) and then the USB power controller (P2553W6) will
automatically block the USB power, but it can't switch off the power to USB using software.
What it can do is bring the LAN9514 into sleep mode, but that doesn't turn the power off!

reply from a moderator & RPi engineer:
Yes it can. Issuing a USB Hub class request (CLEAR_FEATURE PORT_POWER) to port 2
on the LAN9514 will deactivate the USB output power switch.

There's an app for that:
https://github.com/codazoda/hub-ctrl.c

For the above application, the command you can use is sudo ./hub-ctrl -h 3 -P 1 -p 0
- h is the hub, P is the port, and p is to switch power on (1) or off (0).

The hub and port values for a device can be found with lsusb.

Some other details (from a 2016 reply, lsusb data could be more accurate):

Just tested this with the Pi 3 [...] The USB port numbering from the picture posted above:

Hub:Port -- Controlled port(s) 
0:1 -- Controls the Ethernet port
0:2 -- Controls all four USB ports (not the Ethernet)
0:3 -- Controls USB Port 4
0:4 -- Controls USB Port 2
0:5 -- Controls USB Port 3

As best I can tell, USB Port 1 cannot be controlled individually.

Edit: if you find the app doesn't work on your RPi
and you need to switch a USB WiFi device
back on, you could try:
• restart the WiFi connection or reboot your Raspberry Pi

• switch the Wireless LAN network interface on with a command like sudo ifup wlan0
When it stops working (goes to sleep) regularly, do that in a cron script as described above.

Edward
  • 162
  • 9
2

have similar problems with our set up. Some times the usb port stops without any reason. This is with our WIFI adapter. Just pressing enter on an attached keyboard or resetting the wifi adapter makes it work again (without resetting the Raspberry). Looks like the usb-port or controller goes to standby or to sleep.

Maarten
  • 21
  • 2
1

Here is something that may help. It is an app, called hub-ctrl, that allows you to turn individual USB ports of the Pi on and off.

If your Pi's are accessible through the internet or from your server, you can SSH into them and use this app to power-cycle the USB ports instead of power-cycling the entire device.

If your Pi's aren't accessible from the internet or your server, you will have to install this locally, and you could then setup a cron job to power-cycle the USB ports on a schedule that seems reasonable to you, possibly when you have a known quiet time where the Pi won't have any data to log.

tlhIngan
  • 3,372
  • 5
  • 21
  • 33