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
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:
More suggested reference: