Webcam stops working after few minutes


#1

Hello!

I successfully managed to get my webcam (Papalook 720p webcam from amazon) to work just fine with Octoprint 1.3.8 on a RPi 3B. It works in multiple resolutions and framerates. CPU usage of haproxy is between 3-6%, mjpg_streamer 2-3%. Steady stream, very little delay after I dropped wifi on the RPi and plugged an ethernet cable.

What is the problem?
After ~10-15 minutes the stream stops. I'm having trouble pinning down the reason.

What did you already try to solve it?
Looking through google I suspected a powersupply issue. I'm using the original Raspberry PSU and measured 4.5V, so I added a powered USB-Hub and now measure 4.83V steady on the hub, I also placed the multimeter in the frame and on the last frame it was still 4.83. I guess this is not the issue. I have also tried to look through all sorts of logs but being rather new to Linux makes it a bit difficult to pin down the problem, so I figured it might be best to ask here.

Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, octoprint.log, serial.log or output on terminal tab, ...)

Octoprint 1.3.8
OctoPi 0.14.0
Anet A8 on Ramps 1.4 and Marlin 1.1.8 Bugfix
PAPALOOK PA150 Webcam

lsusb output:

pi@octopi:~ $ lsusb
Bus 001 Device 006: ID 0c45:6340 Microdia 
Bus 001 Device 005: ID 05e3:0605 Genesys Logic, Inc. USB 2.0 Hub
Bus 001 Device 004: ID 2341:0042 Arduino SA Mega 2560 R3 (CDC ACM)
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

dmesg output camera related:

...
[    3.425573] media: Linux media interface: v0.10
[    3.477084] usbcore: registered new interface driver brcmfmac
[    3.482706] Linux video capture interface: v2.00
[    3.507173] usb 1-1.5.1: 3:1: cannot get freq at ep 0x84
[    3.523981] usbcore: registered new interface driver snd-usb-audio
[    3.616050] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[    3.660492] uvcvideo: Found UVC 1.00 device USB 2.0 Camera (0c45:6340)
[    3.674738] uvcvideo 1-1.5.1:1.0: Entity type for entity Extension 4 was not initialized!
[    3.674760] uvcvideo 1-1.5.1:1.0: Entity type for entity Processing 3 was not initialized!
[    3.674772] uvcvideo 1-1.5.1:1.0: Entity type for entity Camera 1 was not initialized!
[    3.675364] input: USB 2.0 Camera as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5.1/1-1.5.1:1.0/input/input0
[    3.675517] usbcore: registered new interface driver uvcvideo
[    3.675522] USB Video Class driver (1.1.1)
...

/var/log/haproxy.log:

Apr 16 09:41:09 octopi haproxy-systemd-wrapper[799]: haproxy-systemd-wrapper: SIGINT -> 801
Apr 16 09:41:09 octopi haproxy-systemd-wrapper[799]: haproxy-systemd-wrapper: exit, haproxy RC=0
Apr 16 09:41:24 octopi haproxy-systemd-wrapper[810]: haproxy-systemd-wrapper: executing /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -Ds
Apr 16 09:41:24 octopi haproxy-systemd-wrapper[810]: [WARNING] 105/094124 (812) : Setting tune.ssl.default-dh-param to 1024 by default, if your workload permits it you should set it to$
Apr 16 09:44:44 octopi haproxy-systemd-wrapper[810]: haproxy-systemd-wrapper: SIGINT -> 813
Apr 16 09:44:44 octopi haproxy-systemd-wrapper[810]: haproxy-systemd-wrapper: exit, haproxy RC=0
Apr 16 09:44:59 octopi haproxy-systemd-wrapper[804]: haproxy-systemd-wrapper: executing /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -Ds
Apr 16 09:44:59 octopi haproxy-systemd-wrapper[804]: [WARNING] 105/094459 (807) : Setting tune.ssl.default-dh-param to 1024 by default, if your workload permits it you should set it to$

output of: v4l2-ctl --list-devices

USB 2.0 Camera (usb-3f980000.usb-1.5.1):
	/dev/video0

I did not find a logfile for mjpg-streamer ...

Also here the octoprint log:
octoprint.log (379.9 KB)

I would be super thankfull if somebody could guide me through where else I could look to pin down why it stops.

Thank you very much!


#2

I was on a completely wrong path. Seems the problem was solved by adding max_usb_current=1 into /boot/config.txt. I did that before adding the powered hub, but only restarted Octoprint, not the System, and was disappointed it would still crash (as the setting is only in effect after a system restart). I then added an old powered USB hub, where it seems the HUB itself already dropped 0.2-0.5V off a strong 5V supply so it did not work either. I only later started measuring USB-Voltage, and when I decided to measure the internal USB-Voltage and plugged the Webcam back into the main USB the max_usb_current=1 setting finally was in effect and the cam works fine with a steady 5V supply. Another Afternoon spent haunting a non existing problem, at least it is fixed :slight_smile:


#3

Ahh I was a little bit too quick to assume its working. Yesterday it ran fine for hours, today it is not working anymore. If anyone has an idea on where to look for logs or other hints of what could go wrong, I would be very thankful. Otherwise I guess I will return the camera.