Guidance using Raspberry Pi Camera V2?

What is the problem?

I'm unable to use my Raspberry Pi Camera V2 (ribbon connected) with OctoPrint.

What did you already try to solve it?

Following guidance I found through various searches, I used rasp-config to enable "legacy camera" support, and after that I get this:

jgarbers@octopi:~ $ vcgencmd get_camera
supported=1 detected=1, libcamera interfaces=0

jgarbers@octopi:~ $ raspistill -o foo.jpg
mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
mmal: camera component couldn't be enabled
mmal: main: Failed to create camera component
mmal: Failed to run camera app. Please check for firmware updates

The output from vgencmd suggests (to me at least) that the hardware is detected, but "interfaces=0" and the failure of the raspistill command lead me to think that I've missed a configuration step.

Have you tried running in safe mode?

Sorry but I don't know what that is or how I'd use it.

Did running in safe mode solve the problem?

Nope

Systeminfo Bundle

You can download this in OctoPrint's System Information dialog ... no bundle, no support!)

octoprint-systeminfo-20231004133504.zip (20.7 KB)

Additional information about your setup

I'm on a RPi 3 Model B v1.2 . /etc/octopi_version reports 1.0.0, and the OctoPrint web UI reports v1.9.2 in the "Software Update" section. I haven't yet connected it to my Ender 3 V2 Neo printer, and I access the RPi from Safari on macOS 14.0.

From your Systeminfo bundle I see that you are running OctoPi (stable) 1.0.0-1.9.2-20230718111854 which is the version without the new camera-streamer.

If you don't have a lot of personal data on your RPi, then I would suggest that you use the Raspberry Pi Imager (1.7.5 or newer) and download the OctoPi (new camera stack) build 20320720144556, create an OctoPrint backup on your current install, reflash your SD card, and restore the backup.

There is a strong possibility that it will just work with your camera V2. I have the exact same configuration as you do and it worked for me.

The only downside is there will probably be another image in the (hopefully) not too distant future but if you prepare for it (i.e. take good notes on what you change after the above) then it shouldn't be too painful. I use a USB SD card adapter and rpi-clone to make a copy of my current image. You can also use the USB SD card adapter to move files from an old image to a new one if you use two micro SD cards or scp to move files from OctoPi to your Mac (I use Windows and WinSCP but I'm sure there is something similar for the Mac).

Finally, if you want to use the image you already have, let us know and maybe someone can help.

1 Like

Thanks so much for your help! I followed your instructions -- didn't have anything on the SD card so I just started from scratch with the RPi Imager and the new camera stack choice. The RPi came up nicely and connected to WiFi; I'm able to SSH to it and access the Web interface, but still no camera. I got the same results from the *vcgencmd" and raspistill commands as last time:

jgarbers@octopi:~ $ vcgencmd get_camera
supported=1 detected=1, libcamera interfaces=0
jgarbers@octopi:~ $ raspistill -o foo.jpg
mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
mmal: camera component couldn't be enabled
mmal: main: Failed to create camera component
mmal: Failed to run camera app. Please check for firmware updates

Am I correct that if the camera hardware failed, I would not be seeing "supported=1, detected=1" in the *vcgencmd" output? Is there anything else I can try by way of troubleshooting?

Much appreciated... thanks again!

octoprint-systeminfo-20231004202422.zip (14.9 KB)

Not sure how helpful or even relevant this might be, but I found the camera-streamer command and ran it with verbose logging. It looks like it gets pretty far into its process (can't tell which messages are hard errors vs. just warnings) but eventually fails.

jgarbers@octopi:/boot/camera-streamer $ camera-streamer --log-verbose=1
camera-streamer Version: 0.2.5 (41d8dfd)
util/http/http.c: ?: HTTP listening on 127.0.0.1:8080.
device/v4l2/device_list.c: bcm2835-isp: Device (/dev/video23) does not support capture (skipping)
device/v4l2/device_list.c: bcm2835-isp: Device (/dev/video20) does not support capture (skipping)
device/v4l2/device_list.c: bcm2835-isp: Device (/dev/video16) does not support capture (skipping)
device/v4l2/device_list.c: bcm2835-isp: Device (/dev/video13) does not support capture (skipping)
device/v4l2/device.c: CAMERA: Device path=/dev/video0 fd=14 opened
device/v4l2/device_media.c: CAMERA: Cannot scan: /sys/dev/char/81:13/device
device/v4l2/device_media.c: CAMERA: Cannot find media controller
device/v4l2/device_options.c: CAMERA: The 'User Controls' is read-only
device/v4l2/device_options.c: CAMERA: Available control: 'Brightness' (00980900, type=1)
device/v4l2/device_options.c: CAMERA: Available control: 'Contrast' (00980901, type=1)
device/v4l2/device_options.c: CAMERA: Available control: 'Saturation' (00980902, type=1)
device/v4l2/device_options.c: CAMERA: Available control: 'Red Balance' (0098090e, type=1)
device/v4l2/device_options.c: CAMERA: Available control: 'Blue Balance' (0098090f, type=1)
device/v4l2/device_options.c: CAMERA: Available control: 'Horizontal Flip' (00980914, type=2)
device/v4l2/device_options.c: CAMERA: Available control: 'Vertical Flip' (00980915, type=2)
device/v4l2/device_options.c: CAMERA: Available control: 'Power Line Frequency' (00980918, type=3)
device/v4l2/device_options.c: CAMERA: Available control: 'Sharpness' (0098091b, type=1)
device/v4l2/device_options.c: CAMERA: Available control: 'Color Effects' (0098091f, type=3)
device/v4l2/device_options.c: CAMERA: Available control: 'Rotate' (00980922, type=1)
device/v4l2/device_options.c: CAMERA: Available control: 'Color Effects, CbCr' (0098092a, type=1)
device/v4l2/device_options.c: CAMERA: The 'Codec Controls' is read-only
device/v4l2/device_options.c: CAMERA: Available control: 'Video Bitrate Mode' (009909ce, type=3)
device/v4l2/device_options.c: CAMERA: Available control: 'Video Bitrate' (009909cf, type=1)
device/v4l2/device_options.c: CAMERA: Available control: 'Repeat Sequence Header' (009909e2, type=2)
device/v4l2/device_options.c: CAMERA: Available control: 'Force Key Frame' (009909e5, type=4)
device/v4l2/device_options.c: CAMERA: Available control: 'H264 Minimum QP Value' (00990a61, type=1)
device/v4l2/device_options.c: CAMERA: Available control: 'H264 Maximum QP Value' (00990a62, type=1)
device/v4l2/device_options.c: CAMERA: Available control: 'H264 I-Frame Period' (00990a66, type=1)
device/v4l2/device_options.c: CAMERA: Available control: 'H264 Level' (00990a67, type=3)
device/v4l2/device_options.c: CAMERA: Available control: 'H264 Profile' (00990a6b, type=3)
device/v4l2/device_options.c: CAMERA: The 'Camera Controls' is read-only
device/v4l2/device_options.c: CAMERA: Available control: 'Auto Exposure' (009a0901, type=3)
device/v4l2/device_options.c: CAMERA: Available control: 'Exposure Time, Absolute' (009a0902, type=1)
device/v4l2/device_options.c: CAMERA: Available control: 'Exposure, Dynamic Framerate' (009a0903, type=2)
device/v4l2/device_options.c: CAMERA: Available control: 'Auto Exposure, Bias' (009a0913, type=9)
device/v4l2/device_options.c: CAMERA: Available control: 'White Balance, Auto & Preset' (009a0914, type=3)
device/v4l2/device_options.c: CAMERA: Available control: 'Image Stabilization' (009a0916, type=2)
device/v4l2/device_options.c: CAMERA: Available control: 'ISO Sensitivity' (009a0917, type=9)
device/v4l2/device_options.c: CAMERA: Available control: 'ISO Sensitivity, Auto' (009a0918, type=3)
device/v4l2/device_options.c: CAMERA: Available control: 'Exposure, Metering Mode' (009a0919, type=3)
device/v4l2/device_options.c: CAMERA: Available control: 'Scene Mode' (009a091a, type=3)
device/v4l2/device_options.c: CAMERA: The 'JPEG Compression Controls' is read-only
device/v4l2/device_options.c: CAMERA: Available control: 'Compression Quality' (009d0903, type=1)
device/v4l2/device_options.c: CAMERA: Configuring option 'Horizontal Flip' (00980914) = 0
device/v4l2/device_options.c: CAMERA: Configuring option 'Vertical Flip' (00980915) = 0
device/buffer_list.c: CAMERA:capture: Using: 1920x1080/JPEG, buffers=3, bytesperline=0, sizeimage=2.0MiB
device/buffer_list.c: CAMERA:capture: Opened 3 buffers. Memory used: 6.0 MiB
device/camera/camera_output.c: CAMERA: Cannot find source for 'VIDEO' for one of the formats 'H264'.

I'm not a camera expert but as I understand it, in the new camera stack image camera-streamer uses libcamera to access the camera. In your new system info bundle, the camerastack-libcamera.log contains 1 line "No cameras available!".

My "production" OS on my RPi 3B is still OctoPi 0.18 because I have a hat on it that controls some extra fans connected to my LulzBot TAZ 6. I need to port the code that controls the hat over to OctoPi 1.0.0 before I can switch permanently. I'll fire up the image I burned yesterday in a bit and collect a bundle so we can see what is different.

In the meantime, perhaps someone with more camera expertise that myself can chime in here.

Okay, and thank you for your help! I'll look forward to hearing about whatever you learn as you update your OS. It's odd that camerastack-libcamera.log says "no cameras available" when vcgencmd get_camera seems to suggest that there are cameras present - although no libcamera interfaces are found.

Here is my system info bundle from a fresh install of build 20320720144556.
octoprint-systeminfo-20231006064259.zip (10.2 KB)
As you can see, the camerastack-libcamera.log contains:

Available cameras
-----------------
0 : imx219 [3280x2464] (/base/soc/i2c0mux/i2c@1/imx219@10)
    Modes: 'SBGGR10_CSI2P' : 640x480 [30.00 fps - (0, 0)/0x0 crop]
                             1640x1232 [30.00 fps - (0, 0)/0x0 crop]
                             1920x1080 [30.00 fps - (0, 0)/0x0 crop]
                             3280x2464 [30.00 fps - (0, 0)/0x0 crop]
           'SBGGR8' : 640x480 [30.00 fps - (0, 0)/0x0 crop]
                      1640x1232 [30.00 fps - (0, 0)/0x0 crop]
                      1920x1080 [30.00 fps - (0, 0)/0x0 crop]
                      3280x2464 [30.00 fps - (0, 0)/0x0 crop]

and

pi@octopi:~ $ vcgencmd get_camera
supported=1 detected=0, libcamera interfaces=1
pi@octopi:~ $pi@octopi:~ $ raspistill -o foo.jpg
ERROR: the system should be configured for the legacy camera stack
pi@octopi:~ $

As to how to fix your system, I have no clue other than make sure the ribbon cable is plugged in correctly.

Thank you! I'm wondering if I have. hardware issues too; possible I'm being misled by the vcgencmd results. The fact that your working config gives an error with raspistill is also useful information.

My plan is to use a second SD card with a desktop Raspbian image and see if I can get my camera working with that, just to try to split up the problem space.

Again, I sure appreciate your time and help!

I was hoping that @jneilliii or @Charlie_Powell or one of the other camera experts would jump in here with some better advice.

1 Like

I've only recently experimented with the new camera stack and my arducam ov5647 based sensor. One thing I think I had to do if I remember correctly is to run sudo raspi-config and enable legacy camera mode.

I've set a reminder to look at this tomorrow - I have read the above but don't have time to fully write out a reply just now

1 Like

I'd use the new camera stack image, would probably be my preferred option unless you know the old stack is your only option.

On the new camera stack, the cameras are managed by libcamera. In normal operation, vcgencmd get_camera would not be expected to return both supported=1 and detected=1 (this is legacy info), but it must show libcamera_interfaces=1. The legacy camera mode must not be enabled on the new stack image, or it will not work.

Likewise, the legacy raspistill commands will not work on the new stack image. The alternative commands would be libcamera-still for example.

libcamera-hello --list-cameras is the new way of working out if you have a camera connected. If this shows nothing, then we either have a software problem/conflict with the legacy stack still being enabled, or a hardware issue.

According to your systeminfo bundle further up in the chain, no cameras are connected so the streamer is not trying to start.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.