With Raspberry Pi, it’s all about power
My home heating project has been cranking along, and several weeks ago I abandoned all of the rip cords to use the old heating controls. That means if this system stops working, the 110 year old house (with original, breezy single-pane windows) gets to a very chilly Nor-cal mid 50’s degrees. I plugged in some more analog inputs to cover more of the house and suddenly the control system started failing.
You can see from the graph below that there were a number of points where the temperature either stopped recording or returned a constant value. Not good!
I first blamed the software (I wrote it). I pared it down to a very simple script with only monitoring—no controls, no fancy graphics, etc. It worked *longer* but still ended up failing. I could restart the app, and it would work for long stretches of time before failing. The pi was complaining about all sorts of stuff:
Dec 17 17:10:40 raspberrypi kernel: [849317.706875] INFO:: schedule_periodic: No host channel available for periodic transfer.
Dec 17 17:10:40 raspberrypi kernel: [849317.706887]
Dec 17 17:10:40 raspberrypi kernel: [849317.707382] ERROR::dwc_otg_hcd_urb_enqueue:518: DWC OTG HCD URB Enqueue failed adding QTD. Error status -4008
Dec 17 17:10:40 raspberrypi kernel: [849317.707397]
Dec 17 17:42:19 raspberrypi kernel: [851217.460533] INFO:: periodic_channel_available: Total channels: 8, Periodic: 5, Non-periodic: 3
Dec 17 17:42:19 raspberrypi kernel: [851217.460549]
Dec 17 17:42:19 raspberrypi kernel: [851217.460569] INFO:: schedule_periodic: No host channel available for periodic transfer.
Dec 17 17:42:19 raspberrypi kernel: [851217.460580]
Dec 17 17:42:19 raspberrypi kernel: [851217.460906] ERROR::dwc_otg_hcd_urb_enqueue:518: DWC OTG HCD URB Enqueue failed adding QTD. Error status -4008
Dec 17 17:42:19 raspberrypi kernel: [851217.460922]
Next, I looked into the phidgets USB driver, since it was clearly resolved upon restart of the app (not the device). I simply couldn’t find anything useful in the heap after using VisualVM, etc.
Also, quite curiously, when I plugged in my keyboard + trackpad, the network would slow down.
I now know this can be found all over the Pi community forums, but this was a symptom of overdrawing the power supply to the Pi. But wait! I have a self-powered USB hub! Well turns out that there’s quite a difference between “self powered” USB hubs beyond just fancy packaging and branding. The one I got, a D-Link DUB-H7 High Speed USB 2.0 7-Port Hub, does NOT insulate the PI from current draw over the USB, and isn’t sufficient to power the USB-connected sensors that I’m using.
So it’s back to Amazon, this time a Plugable 7 Port USB 3.0 Hub with 4A Power Adapter, which has had good reviews with the Pi community. I’ll post more when it arrives, and hopefully solves this issue.
I will say that the Phidgets driver *could* handle this better—it’s clearly being disconnected from the software and not in a graceful fashion but I consider this would be a pretty extreme use case for the driver.
Looking back, the only thing that changed the behavior of the Pi was the addition of another USB-powered analog input device, so it should have been obvious. What wasn’t, though, was that the USB hub was simply not powering the bus as advertised.