Raspberry Pi Camera Error: Unicam Has Timed Out - raspberry-pi

I have been trying to get my raspberry pi camera to work for a while now. Probably every 2 weeks or so I would fire up the raspberry pi to convince myself that something changed but whatever I try, libcamera-hello or libcamera-still always produces the same error:
ERROR RPI raspberrypi.cpp:1812 Unicam has timed out!
ERROR RPI raspberrypi.cpp:1813 Please check that your camera sensor connector is attached securedly.
ERROR RPI raspberrypi.cpp:1814 Alternatively, try another cable and/or sensor.
I have tested this on 2 Raspberry Pi 4 model Bs, 2 Cameras(the UC-873 and the UC291), 3 different cables, but only one SD card. I am using an official raspberry pi power supply. I have tried both Buster and the newest version of Bullseye hoping that it would be the software that is causing the problem. For some reason on my newest camera, the UC-783, instead of the Unicam error, it just says that there are no cameras detected and the code:
vcgencmd get_camera
results with
supported=1 detected=0
My config file looks like this:
# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details
# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1
# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16
# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720
# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1
# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1
# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2
# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4
# uncomment for composite PAL
#sdtv_mode=2
#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800
# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on
# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18
# Additional overlays and parameters are documented /boot/overlays/README
# Enable audio (loads snd_bcm2835)
dtparam=audio=on
# Automatically load overlays for detected cameras
camera_auto_detect=1
# Automatically load overlays for detected DSI displays
display_auto_detect=1
# Enable DRM VC4 V3D driver
dtoverlay=vc4-kms-v3d
max_framebuffers=2
# Disable compensation for displays with overscan
disable_overscan=1
[cm4]
# Enable host mode on the 2711 built-in XHCI USB controller.
# This line should be removed if the legacy DWC2 controller is required
# (e.g. for USB device mode) or if USB support is not required.
otg_mode=1
[all]
[pi4]
# Run as fast as firmware / board allows
arm_boost=1
[all]
gpu_mem=124
I feel like I have tried every possible solution. Could it be an option that I somehow damaged both cameras or all cables? I have made sure not to switch out a camera when the raspberry pi was on so the only way I think I could have done something is by static electricity.
Any suggestions?

Related

Enabling internal pullups when GPIO is configured as 1-wire on the Raspberry Pi 3B+

The state of some GPIO internal pullups appears to be UP by default when not configured for anything specific (for example GPIO5). However when I enable the 1-wire interface with dtoverlay=w1-gpio,gpiopin=5, the internal pullup appears to be disabled.
The /boot/overlays/README however says:
Name: w1-gpio
Info: Configures the w1-gpio Onewire interface module.
Use this overlay if you *don't* need a GPIO to drive an external pullup.
Load: dtoverlay=w1-gpio,<param>=<val>
Params: gpiopin GPIO for I/O (default "4")
pullup Now enabled by default (ignored)
which would suggest that the pullup is enabled by default. Any attempt to include the pullup parameter has not changed anything, so it seems it is ignored, but the pullup does not appear to be enabled.
The above just seems inconsistent to me, so I'm wondering if any experienced users have an explanation for why this is? Is it possibly a bug? Or a change in the docs required? It looks as though it is assumed the user will automatically connect an external pullup resistor when using 1-wire.
The only reliable way I have found that enables the pullup post-boot is to use sudo raspi-gpio set 5 pu.

VNC on Raspberry Pi shows Cannot Currently Show the Desktop

I am trying to use VNC in a headless install on my Raspberry Pi 4, running Raspberry Pi OS, installed via Raspberry Imager. The install is more or less vanilla, as the only changes I have made are for connecting (seting up SSH, wireless and VNC as noted in this guide: https://www.tomshardware.com/reviews/raspberry-pi-headless-setup-how-to,6028.html).
When I log in via VNC I get the "Cannot Currently Show the Desktop"-error. It should be possible to fix by changing the screen resolution via raspi-config, but that makes the pi unresponsive. Setting the pi to use "G3 legacy" should fix that issue either after a reboot or without (answers vary on that), but it doesn't seem to make a difference in either case.
Does anyone know how I can get to connect via VNC to my pi?
Thanks :)
According to the documentation:
If your Raspberry Pi is headless (i.e. not plugged into a monitor) or
controlling a robot, it is unlikely to be running a graphical desktop.
So the idea is to create a new virtual desktop via vncserver command and use the display number in VNC.
Basically should be sufficient to specify a HDMI mode. I have a Raspberry Pi4 headless, this is my configuration in /boot/config.txt
# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details
# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1
# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
disable_overscan=1
# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16
# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720
# uncomment if hdmi display is not detected and composite is being output
hdmi_force_hotplug=1
# uncomment to force a specific HDMI mode (this will force VGA)
hdmi_group=2
hdmi_mode=82
# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2
# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4
# uncomment for composite PAL
#sdtv_mode=2
#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800
# Uncomment some or all of these to enable the optional hardware interfaces
dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on
# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18
# Additional overlays and parameters are documented /boot/overlays/README
# Enable audio (loads snd_bcm2835)
dtparam=audio=on
[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2
[all]
#dtoverlay=vc4-fkms-v3d
gpu_mem=128
start_x=1
enable_uart=1
#hdmi_enable_4kp60=1
Then I disabled encryption and set a VNC password. In addition, if you to see the raspistill/raspivid preview through VNC you have to enable this: RealVNC Viewer > Menu > Options > Troubleshooting > Optimize screen capture - select 'Enable direct capture mode'
Raspbian Buster:
Launch command line and run:
sudo raspi-config
Display options -> Resolution. Then select a resolution mode, I recommend select 1280x720 but you can also choose the higher resolution (1920x1080). Save and finish.
Reboot and connect to raspberry again through VNC client.
Raspbian Bullseye:
Launch command line and run:
sudo raspi-config
Display options -> VNC Resolution. Then select a resolution mode, I recommend select 1280x720 but you can also choose the higher resolution (1920x1080). Save and finish.
Reboot and connect to raspberry again through VNC client.
This solved the problem for me: https://www.shellhacks.com/raspberry-pi-force-hdmi-hotplug/.
TL;DR
Setting the resolution of VNC in Raspberry Pi (RPi):
/usr/bin/xrandr --fb 1920x1080
Long answer
One can examine the code of raspi-config bash script, here
Look for the do_vnc_resolution function.
My Rpi4 Bullseye machine had set itself into safe mode … in /boot/config.txt the line
hdmi_safe=1
Was uncommented.
Commenting it out fixed my lo-resolution VNC display problem
Then had to reboot, then logout, and login for everything to be set ok

CodeSys killing eth0 on Raspberry Pi 4?

I'm running into a very strange issue attempting to run CodeSys on a 4GB RasPi-4. Long story short, the Pi works fine right up until I start running the CodeSys project. When I do, within 60sec, eth0 goes down and cannot be brought back up. Even rebooting the Pi has no effect. The only way I've found to recover eth0 is to re-burn RasPiOS from the source image from Raspberrypi.org (which I've done about 30 times over the past few days, trying to trial-and-error my way out of this).
Linux raspberrypi 5.4.79-v7l+ #1373 SMP Mon Nov 23 13:27:40 GMT 2020 armv7l GNU/Linux
I have eth0 set to a static IP using /etc/dhcpcd.conf. Whatever is causing this issue is not altering my settings there. Attempts to use ifconfig eth0 up/down have no effect -- no errors, no feedback, just nothing. Checking eth0's state shows "waiting for carrier," despite being connected to an active switch (I've also swapped out all the cables and the switch to eliminate them as the source of the problem).
When I re-burn the Pi and install CodeSys, eth0 stays up indefinitely (24hrs+ in my longest test). It's starting the CodeSys project that kills eth0. A reboot after etho "dies" gives a series of bcmgenet messages that appear to be related:
pi#raspberrypi:~ $ dmesg | grep bcmg
[ 1.033665] bcmgenet fd580000.ethernet: failed to get enet clock
[ 1.033685] bcmgenet fd580000.ethernet: GENET 5.0 EPHY: 0x0000
[ 1.033709] bcmgenet fd580000.ethernet: failed to get enet-wol clock
[ 1.033730] bcmgenet fd580000.ethernet: failed to get enet-eee clock
[ 1.044648] libphy: bcmgenet MII bus: probed
[ 9.528502] bcmgenet fd580000.ethernet: configuring instance for external RGMII
[ 9.535175] bcmgenet fd580000.ethernet eth0: Link is Down
I also tried creating a new CodeSys project from scratch that had no eth0 drivers (ModBus, Ethernet/IP) installed, only the GPIO driver. That didn't help either -- eth0 dies within 60sec.
The strangest part is, only eth0 seems to be affected. The GPIO pins keep cycling as controlled by the CodeSys project (I have a simple LED-blinking program running), and I can still SSH into the Pi using wifi. But since my main reason for setting this Pi up is to use Ethernet/IP and ModBus....
This thread: at GitHub is the only place I've found anyone describing anything similar to what I'm experiencing, but in that case CodeSys is not installed. I did try adding genet.skip_umac_reset=n to my cmdline.txt as suggested in the thread, but it had no effect.
So, it turned out this was an issue configuring the GPIO pins.
CodeSys has two difference "device" files for adding the GPIO pins to the project device tree. The default selection is for older Pi models, and the alternate choice (labelled only for B+ and Pi2) is the correct one for the Pi4.
As it turns out, the outdated GPIO device file will work on a Pi4, mostly. But using the wrong device file allows CodeSys to try configuring GPIO pins that shouldn't be tampered with. In this case, GPIO 28 and 29. Setting either of them to Output mode killed eth0.
Using the correct device file removes 28&29 from the list of configurable GPIO pins. It also gives the correct list of available GPIO pins for the newer Pi models, hopefully avoiding other potential config issues that I didn't trip over.
In CodeSys, right-clicking on the GPIOs element in the device tree offers the option to "Update the Device." Select this option to get the list of available device files, and select the correct one before using the "Update Device" button in the bottom of the window.

UV4L WebRTC demo seemingly not working, how to fix?

There is a demo which comes with UV4L demo OS for Raspberry PI, https://raspberry:8080/stream/webrtc. When i run it on a macOS computer (Firefox browser), and select that a screen is to be shared, it always says 'no suitable video device found!' and apparently doesn't connect anywhere. Same happens when i go there on a Chromium browser on a Raspberry PI itself. There doesn't seem to be any error messages anywhere - some deprecation warnings but no more than that:
onopen() webrtc:197:25
navigator.mozGetUserMedia has been replaced by navigator.mediaDevices.getUserMedia webrtc:251:32
WebRTC interfaces with the “moz” prefix (mozRTCPeerConnection, mozRTCSessionDescription, mozRTCIceCandidate) have been deprecated. webrtc:105:25
{"iceServers":[{"urls":["stun:stun.l.google.com:19302","stun:192.168.0.101:3478"]}]} webrtc:104:21
onaddstream is deprecated! Use peerConnection.ontrack instead. webrtc:107
peer connection successfully created! webrtc:110:21
URL.createObjectURL(MediaStream) is deprecated and will be removed soon. webrtc:255:60
call(), request={"what":"call","options":{"force_hw_vcodec":false,"vformat":"60"}} webrtc:193:25
message =message webrtc:281:25
Where shall i look into?
Clarification: i can see my desktop in a 'local' box, so sharing has been successful, same on Raspberry PI. But it never goes to the other side, i can't even use the data channel - it is greyed out - so apparently no connection happens, at all.
The following command runs an instance of UV4L that allows to mirror your desktop or window to the Raspberry Pi HDMI display. Note that you must pass the SSL certificates .key and .crt (see the UV4L installation instructions to know how to generate them):
uv4l --enable-server --driver dummy --server-option '--use-ssl=yes' --server-option '--ssl-private-key-file=/home/pi/selfsign.key' --server-option '--ssl-certificate-file=/home/pi/selfsign.crt' --verbosity=7 --server-option '--enable-webrtc-video=no' --server-option '--enable-webrtc-audio=no' --server-option '--webrtc-receive-video=yes' --server-option '--webrtc-renderer-fullscreen=yes' --server-option=--webrtc-renderer-window=0 0 1920 1080 --server-option '--webrtc-receive-datachannels=yes' --server-option '--webrtc-receive-audio=yes' --auto-video_nr --server-option '--webrtc-receive-audio=yes --server-option '--port=9000'
You can then access the WebRTC streaming page at:
https://raspberry:9000/stream/webrtc
You must explicitly enable screen sharing in firefox or chrome according to the instructions written in the the same page.
I would check if the camera module on the pi itself is attached correctly. Did you try to capture a test image using something likeraspistill -o test.jpg yet? I've seen the 'No Suitable devices found' problem come up when I either didn't enable the camera on raspi-config or I didn't insert the camera's ribbon cable correctly. You can also check if you've connected the GPIO corresponding pins right.

raspberry pi uvcdynctrl focus control missing for quickcam 9000 pro

I have a Logitech QuickCam 9000 Pro (V-UBM46) and I cannot control the focus from my RaspberryPi (all packages up to date).
When I list the available webcam controls with uvcdynctrl
uvcdynctrl -d /dev/video0 -c
Listing available controls for device /dev/video0:
Brightness
Contrast
Saturation
White Balance Temperature, Auto
Gain
Power Line Frequency
White Balance Temperature
Sharpness
Backlight Compensation
Exposure, Auto
Exposure (Absolute)
Exposure, Auto Priority
the focus control is missing. However, when I run the same command on my Ubuntu 13.04 machine, the focus command is present and I can use it.
uvcdynctrl -d /dev/video1 -c
[libwebcam] Unknown V4L2 private control ID encountered: 0x0A046D04 (V4L2_CID_PRIVATE_BASE + 33844484)
Listing available controls for device /dev/video1:
Brightness
Contrast
Saturation
White Balance Temperature, Auto
Gain
Power Line Frequency
White Balance Temperature
Sharpness
Backlight Compensation
Exposure, Auto
Exposure (Absolute)
Exposure, Auto Priority
Focus
Focus (absolute)
LED1 Mode
LED1 Frequency
Disable video processing
Raw bits per pixel
I have checked the versions for libwebcam0, uvcdynctrl, uvcdynctrl-data, libv4l-0 and they are all up to date to the same version on both the RaspberryPi and Ubuntu. The only difference is libv4l-0 where the version on Ubuntu is 0.8.9-4 and the RaspberryPi is 1.0.0-1.
Is there perhaps another package or driver that is missing or outdated on the RaspberryPi? How do I get the Raspbian to "see" the focus control?
I have the RaspberryPi Model B running Octopi on it.
I figured out an easy solution for our problem. It works flawlessly for my Pi.
Hope it works on yours too.
sudo apt-get install uvcdynctrl
sudo apt-get install guvcview
sudo guvcview
unplug and replug the webcam
After this four steps uvcdynctrl -c shows Focus, Led and more options available.