This post is used to explain some common problems with IMX519 and libcamera.
Question 1:
I get an error similar to the following when installing the kernel driver:
Cannot find the corresponding package, please send the following information to [email protected]
Hardware Revision: b03111
Kernel Version: 5.4.83-v7l+
Solution:
Need to install the latest Raspberry Pi system, and do not execute rpi-update
https://downloads.raspberrypi.org/raspios_full_armhf/images/raspios_full_armhf-2021-11-08/
https://downloads.raspberrypi.org/raspios_full_armhf/images/raspios_full_armhf-2022-01-28/
Question 2:
I get the following error when running libcamera:
....
[0:01:46.295273858] [631] INFO Camera camera.cpp:1028 configuring streams: (0) 4656x3496-YUV420 (1) 4656x3496-SRGGB10_CSI2P
[0:01:46.296042453] [632] INFO RPI raspberrypi.cpp:751 Sensor: /base/soc/i2c0mux/i2c@1/imx519@1a - Selected sensor format: 4656x3496-SRGGB10_1X10 - Selected unicam format: 4656x3496-pRAA
[0:01:46.351230171] [632] ERROR V4L2 v4l2_videodevice.cpp:1179 /dev/video0[12:cap]: Unable to request 1 buffers: Cannot allocate memory
ERROR: *** failed to allocate capture buffers ***
Solution:
Modify /boot/config.txt to add dtoverlay=vc4-kms-v3d,cma-<size>

Example:

Note: It is recommended to set to cma-128 or cma-96 on devices with smaller memory such as Pi Zero / Zero 2 W
Question 3:
I got an error similar to the following when I ran libcamera:
terminate called after throwing an instance of \'std::runtime_error\'
what(): failed to import fd 21
Aborted
Solution:
For Raspbian Buster users, please also:
- Open /boot/config.txt
- Add the following line under [all]:
dtoverlay=vc4-fkms-v3d - Save and reboot
For Raspbian Bullseye users running on Pi Zero ~ Pi 3:,
- Open a terminal
- Run sudo raspi-config
- Navigate to Advanced Options
- Enable Glamor graphic acceleration
- Reboot your Pi
For more details, please refer to the official forum guide on how to configure the camera module >>
Question 4:
I cannot install the corresponding package using a third-party system.
Solution:
Need to install the latest Raspberry Pi system, and do not execute rpi-update
https://downloads.raspberrypi.org/raspios_full_armhf/images/raspios_full_armhf-2021-11-08/
https://downloads.raspberrypi.org/raspios_full_armhf/images/raspios_full_armhf-2022-01-28/
About Octoprint:
Currently Octoprint’s mjpg-streamer plugin does not support libcamera, if you want to use a camera with a focus motor, you can try 5mp v1 camera, 8mp v2 camera, we are also trying to solve this problem (need to develop mjpg-streamer libcamera plugin), but Currently not supported.
Update:
A mjpg-streamer that works with libcamera:
Update2:
We have successfully run libcamera & imx519 on OctoPi Nightly build, please refer to:
Question 5:
How to use two camera ports on the CM4
Solution:
You need to install the latest Raspberry Pi system (after 2022/01/28), and do not execute rpi-update
https://downloads.raspberrypi.org/raspios_full_armhf/images/raspios_full_armhf-2022-01-28/
Refer to this documentation to install drivers and applications:
After installing the system and drivers, add the following information to /boot/config.txt:
[cm4]
dtoverlay=imx519
dtoverlay=imx519,cam0
Note 1: For pivariety series, please modify imx519 to arducam.
Note 2: Need to reboot after modifying /boot/config.txt
Usage:
List all cameras:
libcamera-still --list-cameras
Specify camera:
libcamera-still -t 0 --camera 0
libcamera-still -t 0 --camera 1
A post was split to a new topic: Quad-HAT outputs the wrong image
Question 6: Which driver should I install?
The 16MP Quad-Camera Kit(B0388), 15-Meter Cable Extension Kit (U6248) and Arducam Mini 16MP IMX519(B0389, B0391) require the “low speed” version of the driver:
wget -O install_pivariety_pkgs.sh https://github.com/ArduCAM/Arducam-Pivariety-V4L2-Driver/releases/download/install_script/install_pivariety_pkgs.sh
chmod +x install_pivariety_pkgs.s
./install_pivariety_pkgs.sh -p imx519_kernel_driver_low_speed
In fact, if you are not sure which driver to install, please install imx519_kernel_driver_low_speed, the only difference between the “low speed” version of the driver and the normal version is that the maximum resolution frame rate of the “low speed” version is 1-2 frames slower than the normal version.
Question 7: Open I2C bus error
Some systems do not have i2c enabled by default, and you will encounter the following errors when running libcamera-apps:
Solution:
sudo raspi-config
--> Interface Options
--> I2C
Question 8: An interesting project: Plug-and-play Raspberry Pi USB webcam
Project Introduction:
https://www.raspberrypi.com/tutorials/plug-and-play-raspberry-pi-usb-webcam/
More suggested reference:
can anyone help me with this?
libcamera-still -t 0
[0:37:15.192624998] [2887] INFO Camera camera_manager.cpp:313 libcamera v0.3.0+65-6ddd79b5
[0:37:15.200499537] [2888] INFO RPI pisp.cpp:695 libpisp version v1.0.6 b567f0455680 17-06-2024 (10:20:00)
[0:37:15.227481658] [2888] INFO RPI pisp.cpp:1154 Registered camera /base/axi/pcie@120000/rp1/i2c@80000/imx519@1a to CFE device /dev/media0 and ISP device /dev/media2 using PiSP variant BCM2712_C0
Made X/EGL preview window
Mode selection for 2328:1748:12:P
SRGGB10_CSI2P,1280x720/0 - Score: 5319.24
SRGGB10_CSI2P,1920x1080/0 - Score: 3319.24
SRGGB10_CSI2P,2328x1748/0 - Score: 1000
SRGGB10_CSI2P,3840x2160/0 - Score: 1648.24
SRGGB10_CSI2P,4656x3496/0 - Score: 2019
Stream configuration adjusted
[0:37:15.588092347] [2887] INFO Camera camera.cpp:1183 configuring streams: (0) 2328x1748-YUV420 (1) 2328x1748-RGGB_PISP_COMP1
[0:37:15.588254526] [2888] INFO RPI pisp.cpp:1450 Sensor: /base/axi/pcie@120000/rp1/i2c@80000/imx519@1a - Selected sensor format: 2328x1748-SRGGB10_1X10 - Selected CFE format: 2328x1748-PC1R
[0:37:15.598192210] [2893] WARN IPARPI ipa_base.cpp:732 Could not set AF_MODE - no AF algorithm
[0:37:15.598338779] [2893] WARN IPARPI ipa_base.cpp:1114 Could not set AF_SPEED - no focus algorithm
[0:37:15.598361445] [2893] WARN IPARPI ipa_base.cpp:1096 Could not set AF_RANGE - no focus algorithm
Hi
What’s the camera you are using? Besides, could you post the output of the command below?
dpkg -l | grep libcamera
Will not using the low speed version of the driver cause the cameras to not be detected? That is my current issue.