Friday, October 04, 2013

eGalax USB touchscreen power consumption problem on Raspberry pi

I have deployed my eGalax touchscreen in production now, but I encountered a problem where very rarely the touchscreen would stop responding to touch input. I noticed errors like this in the logs:

/var/log/messages
lots of lines like:
Sep 20 09:42:42 hall-heat kernel: [759582.629937] usb 1-1.3: Manufacturer: eGalax Inc.

Sep 20 09:42:42 hall-heat kernel: [759582.641175] usbtouchscreen: probe of 1-1.3:1.0 failed with error -32
... [and ]...
Sep 20 09:42:44 hall-heat kernel: [759584.833718] usb 1-1.3: USB disconnect, device number 90
Sep 20 09:42:44 hall-heat kernel: [759585.070521] usb 1-1.3: new low-speed USB device number 91 using dwc_otg
Sep 20 09:42:45 hall-heat kernel: [759585.530595] usb 1-1.3: new low-speed USB device number 92 using dwc_otg
Sep 20 09:42:45 hall-heat kernel: [759585.990652] usb 1-1.3: new low-speed USB device number 93 using dwc_otg
...

and in /var/log/syslog
Sep 20 09:39:55 hall-heat kernel: [759416.317257] usb 1-1.3: new low-speed USB device number 18 using dwc_otg
Sep 20 09:39:56 hall-heat kernel: [759416.426528] usb 1-1.3: New USB device found, idVendor=0eef, idProduct=0001
Sep 20 09:39:56 hall-heat kernel: [759416.426558] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Sep 20 09:39:56 hall-heat kernel: [759416.426577] usb 1-1.3: Product: USB TouchController
Sep 20 09:39:56 hall-heat kernel: [759416.426592] usb 1-1.3: Manufacturer: eGalax Inc.
Sep 20 09:39:56 hall-heat kernel: [759416.435420] input: eGalax Inc. USB TouchController as /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3:1.0/input/input115
Sep 20 09:40:04 hall-heat kernel: [759424.789468] usb 1-1.3: USB disconnect, device number 18
Sep 20 09:40:11 hall-heat kernel: [759431.427539] usb 1-1.3: new low-speed USB device number 21 using dwc_otg
Sep 20 09:40:11 hall-heat kernel: [759431.767454] usb 1-1.3: new low-speed USB device number 22 using dwc_otg
Sep 20 09:40:11 hall-heat kernel: [759431.847452] usb 1-1.3: device descriptor read/64, error -32
Sep 20 09:40:11 hall-heat kernel: [759432.217494] usb 1-1.3: new low-speed USB device number 23 using dwc_otg
Sep 20 09:40:12 hall-heat kernel: [759432.597579] usb 1-1.3: new low-speed USB device number 24 using dwc_otg
Sep 20 09:40:12 hall-heat kernel: [759432.677575] usb 1-1.3: device descriptor read/64, error -32
Sep 20 09:40:13 hall-heat kernel: [759433.477560] usb 1-1.3: new low-speed USB device number 25 using dwc_otg
Sep 20 09:40:13 hall-heat kernel: [759433.557573] usb 1-1.3: device descriptor read/64, error -32
Sep 20 09:40:13 hall-heat kernel: [759433.747461] usb 1-1.3: device descriptor read/64, error -32
Sep 20 09:40:49 hall-heat kernel: [759469.502121] ERROR::dwc_otg_hcd_urb_enqueue:514: Not connected
Sep 20 09:40:49 hall-heat kernel: [759469.502121] 
Sep 20 09:40:49 hall-heat kernel: [759469.502160] phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x06 failed for offset 0x131c with error -19.
Sep 20 09:40:49 hall-heat kernel: [759469.738105] usb 1-1: USB disconnect, device number 2
Sep 20 09:40:49 hall-heat kernel: [759469.738135] usb 1-1.1: USB disconnect, device number 3
Sep 20 09:40:49 hall-heat kernel: [759469.738457] smsc95xx 1-1.1:1.0: eth0: unregister 'smsc95xx' usb-bcm2708_usb-1.1, smsc95xx USB 2.0 Ethernet
Sep 20 09:40:49 hall-heat kernel: [759469.750967] usb 1-1.2: USB disconnect, device number 4
Sep 20 09:40:49 hall-heat kernel: [759470.278132] Indeed it is in host mode hprt0 = 00021501
Sep 20 09:40:50 hall-heat kernel: [759470.738290] usb 1-1: new high-speed USB device number 28 using dwc_otg
Sep 20 09:40:50 hall-heat kernel: [759470.738792] Indeed it is in host mode hprt0 = 00001101
Sep 20 09:40:50 hall-heat ifplugd(eth0)[1701]: Exiting.


As my main pi was now in production, I am using a really old Model B as my development environment. I noticed that if I power it up with the USB plugged in that it fails to boot with an error and corrupts the SD card, so that no further boots are possible

From a lot of googling I pieced together that it was a power issue - the USB touch controller, although it's only a tiny board, it seems to draw quite a lot of current from the USB port of the pi, which has occasional problems with my new pi, and very regular problems with the older model.

I bought one of these cables from linitx (http://linitx.com/product/5v-power-injector-for-usb-on-rb411uahr-and-rb493g) which allows power to be injected through the USB.
5V Power Injector for USB on RB411UAHR and RB493G
After receiving it I got my tester out and was disappointed to find that it still had the 5V line connected through. So I stripped off the insulation, and began to cut wires, thinking it would be a red one, however in this cable it turned out to be the black one. Coincidentally I ordered another one, and it turned out to be the red wire, so do some testing before you do any cutting.

I installed my new cable in my old Model B test system, and booted it up - perfect! This instantly solved the problems.

So, if you see problems at boot, or have problems with USB devices failing after some time, think power.

No comments: