Libcamera Error V4L2

I tried again:

  1. Flashed OS with offical LITE 64-bit version from website
    pi@raspberrypi:~ $ uname -a
    Linux raspberrypi 5.15.84-v8+ #1613 SMP PREEMPT Thu Jan 5 12:03:08 GMT 2023 aarch64 GNU/Linux

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.sh
./install_pivariety_pkgs.sh -p libcamera_dev
./install_pivariety_pkgs.sh -p libcamera_apps
./install_pivariety_pkgs.sh -p 64mp_pi_hawk_eye_kernel_driver

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

# Run in 64-bit mode
arm_64bit=1

# 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
dtoverlay=arducam_64mp
dtoverlay=arducam_64mp,cam1

[all]
dtoverlay=vc4-kms-v3d,cma-512

[pi4]
# Run as fast as firmware / board allows
arm_boost=1

[all]
dtoverlay=arducam_64mp


sudo reboot

I hear motor sound

pi@raspberrypi:~ $ libcamera-still --list-cameras
Available cameras
-----------------
0 : arducam_64mp [9248x6944] (/base/soc/i2c0mux/i2c@1/arducam_64mp@1a)
    Modes: 'SRGGB10_CSI2P' : 1280x720 [120.03 fps - (2064, 2032)/5120x2880 crop]
                             1920x1080 [60.04 fps - (784, 1312)/7680x4320 crop]
                             2312x1736 [30.00 fps - (0, 0)/9248x6944 crop]
                             3840x2160 [20.00 fps - (784, 1312)/7680x4320 crop]
                             4624x3472 [10.00 fps - (0, 0)/9248x6944 crop]
                             9152x6944 [2.70 fps - (0, 0)/9152x6944 crop]

pi@raspberrypi:~ $ dmesg | grep 64mp
[    8.200165] arducam_64mp: loading out-of-tree module taints kernel.
[    8.246417] arducam_64mp 10-001a: Device found Arducam 64MP.
[    8.272681] arducam_64mp 10-001a: Consider updating driver arducam_64mp to match on endpoints


Now i make upgrade to 6.1x

sudo apt-get update
sudo apt-get upgrade
sudo reboot

No motor sound

pi@raspberrypi:~ $ dmesg | grep 64mp
[ 0.083713] platform fe801000.csi: Fixed dependency cycle(s) with /soc/i2c0mux/i2c@1/arducam_64mp@1a
[ 8.018960] arducam_64mp 10-001a: Device found Arducam 64MP.
[ 8.092411] arducam_64mp 10-001a: Consider updating driver arducam_64mp to match on endpoints

pi@raspberrypi:~ $ libcamera-still --list-cameras
Available cameras

0 : arducam_64mp [9248x6944] (/base/soc/i2c0mux/i2c@1/arducam_64mp@1a)
Modes: ‘SRGGB10_CSI2P’ : 1280x720 [120.03 fps - (2064, 2032)/5120x2880 crop]
1920x1080 [60.04 fps - (784, 1312)/7680x4320 crop]
2312x1736 [30.00 fps - (0, 0)/9248x6944 crop]
3840x2160 [20.00 fps - (784, 1312)/7680x4320 crop]
4624x3472 [10.00 fps - (0, 0)/9248x6944 crop]
9152x6944 [2.70 fps - (0, 0)/9248x6944 crop]

pi@raspberrypi:~ $ uname -a
Linux raspberrypi 6.1.19-v8+ #1637 SMP PREEMPT Tue Mar 14 11:11:47 GMT 2023 aarch64 GNU/Linux

Thats strange now it works maybe the problem yes was with building libcamera from source. With viewfinder i get some V4L2 error Invalid argument though. Lens initialization faield

I edit /boot/config.txt
changed the arducam_64mp to arducam-64mp everywhere

sudo reboot

no more of those v4l2 and lens errors.

Yes it seems the problem was with libcamera. Somewhy if i built gstreamer, libcamera and libcamera-apps from source it not detect cameras. Altough dmesg shows cameras.

Do you have any ideas why the libcamera-apps that i built from source does not detect the cameras?

@henri

libcamera is just an upstream application and does not affect detecting cameras.

The only reason that affects the detection of the camera is the device tree and the driver.

Ok, reflashed the image where i have gstreamer, libcamera and libcamera-apps built from source. In this build I did not install the driver before sudo apt get upgrade. The driver comes automatically with the upgrade right?

pi@raspberrypi:~ $ libcamera-still --list-cameras
No cameras available!
pi@raspberrypi:~ $ dmesg | grep 64mp
[    0.079870] platform fe801000.csi: Fixed dependency cycle(s) with /soc/i2c0mux/i2c@1/arducam_64mp@1a
[    7.147610] arducam_64mp 10-001a: Device found Arducam 64MP.
[    7.159263] arducam_64mp 10-001a: Consider updating driver arducam_64mp to match on endpoints

pi@raspberrypi:~ $ cat /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 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

# Run in 64-bit mode
arm_64bit=1

# 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
dtoverlay=arducam-64mp
dtoverlay=arducam-64mp,cam1

[all]
dtoverlay=vc4-kms-v3d,cma-512

[pi4]
# Run as fast as firmware / board allows
arm_boost=1

[all]
dtoverlay=arducam-64mp

How to explain that?

If i try to install the driver with the script now i get the following error:

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.sh
/install_pivariety_pkgs.sh -p 64mp_pi_hawk_eye_kernel_driver

Cannot find the corresponding package, please send the following information to [email protected]
Hardware Revision: b03140
Kernel Version: 6.1.19-v8+
Package: 64mp_pi_hawk_eye_kernel_driver – bullseye-arm64
You are using an unsupported kernel version, please install the official SD Card image(do not execute rpi-update):
Operating system images – Raspberry Pi

pi@raspberrypi:~ $ uname -a
Linux raspberrypi 6.1.19-v8+ #1637 SMP PREEMPT Tue Mar 14 11:11:47 GMT 2023 aarch64 GNU/Linux

@henri

dmesg | grep dw98
sudo lsmod arducam-64mp

pi@raspberrypi:/usr/include $ uname -a
Linux raspberrypi 6.1.19-v8+ #1637 SMP PREEMPT Tue Mar 14 11:11:47 GMT 2023 aarch64 GNU/Linux

pi@raspberrypi:/usr/include $ dmesg | grep dw98
pi@raspberrypi:/usr/include $ sudo lsmod arducam-64mp
Usage: lsmod
pi@raspberrypi:/usr/include $

pi@raspberrypi:/usr/include $ lsmod
Module                  Size  Used by
cmac                   16384  3
algif_hash             16384  1
aes_arm64              16384  3
aes_generic            36864  1 aes_arm64
algif_skcipher         16384  1
af_alg                 28672  6 algif_hash,algif_skcipher
bnep                   24576  2
hci_uart               53248  1
btbcm                  24576  1 hci_uart
bluetooth             565248  26 hci_uart,btbcm,bnep
ecdh_generic           16384  2 bluetooth
ecc                    36864  1 ecdh_generic
libaes                 16384  3 aes_arm64,bluetooth,aes_generic
arducam_64mp           24576  1
dw9807_vcm             16384  1
8021q                  32768  0
garp                   16384  1 8021q
stp                    16384  1 garp
llc                    16384  2 stp,garp
brcmfmac              331776  0
brcmutil               24576  1 brcmfmac
cfg80211              925696  1 brcmfmac
v3d                    90112  0
joydev                 28672  0
gpu_sched              49152  1 v3d
drm_shmem_helper       24576  1 v3d
vc4                   331776  4
rfkill                 32768  6 bluetooth,cfg80211
snd_soc_hdmi_codec     20480  2
i2c_mux_pinctrl        16384  0
drm_display_helper     16384  1 vc4
bcm2835_unicam         53248  0
raspberrypi_hwmon      16384  0
v4l2_dv_timings        40960  1 bcm2835_unicam
v4l2_fwnode            24576  2 bcm2835_unicam,arducam_64mp
i2c_mux                16384  1 i2c_mux_pinctrl
cec                    53248  1 vc4
v4l2_async             24576  4 v4l2_fwnode,bcm2835_unicam,arducam_64mp,dw9807_vcm
drm_dma_helper         20480  1 vc4
i2c_brcmstb            16384  0
drm_kms_helper        204800  4 drm_dma_helper,vc4
snd_soc_core          274432  2 vc4,snd_soc_hdmi_codec
snd_compress           20480  1 snd_soc_core
snd_bcm2835            28672  0
snd_pcm_dmaengine      20480  1 snd_soc_core
snd_pcm               139264  5 snd_bcm2835,snd_soc_hdmi_codec,snd_compress,snd_soc_core,snd_pcm_dmaengine
bcm2835_isp            28672  0
i2c_bcm2835            16384  0
rpivid_hevc            53248  0
bcm2835_codec          49152  0
bcm2835_v4l2           45056  0
snd_timer              36864  1 snd_pcm
v4l2_mem2mem           45056  2 bcm2835_codec,rpivid_hevc
bcm2835_mmal_vchiq     36864  3 bcm2835_codec,bcm2835_v4l2,bcm2835_isp
videobuf2_dma_contig    20480  4 bcm2835_codec,bcm2835_unicam,rpivid_hevc,bcm2835_isp
videobuf2_vmalloc      16384  1 bcm2835_v4l2
videobuf2_memops       16384  2 videobuf2_vmalloc,videobuf2_dma_contig
videobuf2_v4l2         32768  6 bcm2835_codec,bcm2835_unicam,bcm2835_v4l2,rpivid_hevc,v4l2_mem2mem,bcm2835_isp
snd                   106496  6 snd_bcm2835,snd_soc_hdmi_codec,snd_timer,snd_compress,snd_soc_core,snd_pcm
videobuf2_common       69632  10 bcm2835_codec,videobuf2_vmalloc,videobuf2_dma_contig,videobuf2_v4l2,bcm2835_unicam,bcm2835_v4l2,rpivid_hevc,v4l2_mem2mem,videobuf2_memops,bcm2835_isp
vc_sm_cma              36864  2 bcm2835_mmal_vchiq,bcm2835_isp
videodev              274432  11 v4l2_async,bcm2835_codec,videobuf2_v4l2,bcm2835_unicam,bcm2835_v4l2,arducam_64mp,videobuf2_common,rpivid_hevc,dw9807_vcm,v4l2_mem2mem,bcm2835_isp
syscopyarea            16384  1 drm_kms_helper
mc                     61440  11 v4l2_async,videodev,bcm2835_codec,videobuf2_v4l2,bcm2835_unicam,arducam_64mp,videobuf2_common,rpivid_hevc,dw9807_vcm,v4l2_mem2mem,bcm2835_isp
sysfillrect            16384  1 drm_kms_helper
sysimgblt              16384  1 drm_kms_helper
fb_sys_fops            16384  1 drm_kms_helper
uio_pdrv_genirq        16384  0
nvmem_rmem             16384  0
uio                    24576  1 uio_pdrv_genirq
i2c_dev                20480  0
drm                   581632  8 gpu_sched,drm_kms_helper,drm_dma_helper,v3d,vc4,drm_shmem_helper,drm_display_helper
fuse                  135168  1
drm_panel_orientation_quirks    28672  1 drm
backlight              24576  1 drm
ip_tables              32768  0
x_tables               53248  1 ip_tables
ipv6                  557056  24

pi@raspberrypi:/usr/include $ sudo lsmod | grep arducam-64mp
pi@raspberrypi:/usr/include $ sudo lsmod | grep arducam-64mp
pi@raspberrypi:/usr/include $ dmesg | grep 64mp
[ 0.083701] platform fe801000.csi: Fixed dependency cycle(s) with /soc/i2c0mux/i2c@1/arducam_64mp@1a
[ 8.202530] arducam_64mp 10-001a: Device found Arducam 64MP.
[ 8.214144] arducam_64mp 10-001a: Consider updating driver arducam_64mp to match on endpoints
pi@raspberrypi:/usr/include $

I just built both libcamera and libcamera-apps from source again on a clean 5.15.x OS instead of installing from your script, then installed driver with your script and edited /boot/config.txt

Now when i ran libcamera-still --list-cameras I still get “No cameras” error message altough when running the command the motors make noise cause its 5.15.

I think the issue is me building libcamera and libcamera apps form source? Could it be that when i install libcamera and libcamera-apps with your script then something gets installed that doesent when i build and install from source?

@henri

It seems that some state is messed up.

Did you use the libcamera and libcamera-apps we released

I want you to confirm that the video0 node is mapped out

ls /dev/video*

According to your print information, the camera driver is loaded smoothly. It stands to reason that it should be possible to map out the video0 node, unless there is a problem with the motor driver.

If the video0 node has it and libcamera cannot be used, then there may be a compilation problem.

No i got the source from libcamera/libcamera.git - libcamera official repository and GitHub - raspberrypi/libcamera-apps

:man_facepalming:

@henri

The official libcamera lacks the json file for 64mp.

Later we will merge this file into libcamera, at that time, everything will be unified.

1 Like

just noticed that in your GitHub - ArduCAM/libcamera
README file there is:

git clone https://git.libcamera.org/libcamera/libcamera.git

should be:

https://github.com/ArduCAM/libcamera.git

this wasnt though the reason why i checked out libcamera initially from official website. i just probably googled libcamera and went to the official site

1 Like

now i get this error

src/ipa/raspberrypi/meson.build:5:0: ERROR: Dependency “arducam_pivariety” not found, tried pkgconfig and cmake

do u know how to fix this?

I flashed with 32-bit bullseye 5.15.somethign version
sudo apt-get update
sudo apt-get upgrade
pi@pi:~/libcamera $ uname -a
Linux pi 6.1.19-v8+ #1637 SMP PREEMPT Tue Mar 14 11:11:47 GMT 2023 aarch64 GNU/Linux

before i tried to build ArduCam/libcamera from source I uninstalled libcamera and gstreamer via.
sudo apt remove libcamera*
and
sudo apt remove libgstreamer*
Is it possible the driver just got uninstalled?

ok i went to the arducam libcamera README.md :man_facepalming:

for the Arducam Pivariety module: [required]

arducam-pivariety-sdk-dev

You can refer to the following command to install arducam-pivariety-sdk-dev.

curl -s --compressed "https://arducam.github.io/arducam_ppa/KEY.gpg" | sudo apt-key add -
sudo curl -s --compressed -o /etc/apt/sources.list.d/arducam_list_files.list "https://arducam.github.io/arducam_ppa/arducam_list_files.list"
sudo apt update
sudo apt install arducam-pivariety-sdk-dev

If arducam-pivariety-sdk-dev is not installed, compilation will fail.
1 Like

@henri

Have you resolved your issue now?

yes, i needed to install arducam-pivariety-sdk-dev by following instructions on arducam libcamera github

1 Like

@henri

I’m glad to hear that news

Following the README from the repo helped me out as well!

However i have an issue. Despite being able to detect the camera, i cannot do that by using OpenCV VideoCapture…

import cv2

cap = cv2.VideoCapture(1)

# Capture frame
ret, frame = cap.read()
if ret:
        print("capturing")
        cv2.imwrite('image.jpg', frame)

cap.release()

It returns the following message:

pi@raspberrypi:~/Desktop/tests/test_camera $ python camera_capture_test.py 
[ WARN:[email protected]] global cap_v4l.cpp:982 open VIDEOIO(V4L2:/dev/video1): can't open camera by index
[ WARN:[email protected]] global obsensor_stream_channel_v4l2.cpp:82 xioctl ioctl: fd=3, req=-2140645888
[ WARN:[email protected]] global obsensor_stream_channel_v4l2.cpp:138 queryUvcDeviceInfoList ioctl error return: 25
[ WARN:[email protected]] global obsensor_stream_channel_v4l2.cpp:82 xioctl ioctl: fd=3, req=-2140645888
[ WARN:[email protected]] global obsensor_stream_channel_v4l2.cpp:138 queryUvcDeviceInfoList ioctl error return: 25
[ERROR:[email protected]] global obsensor_uvc_stream_channel.cpp:156 getStreamChannelGroup Camera index out of range

Note that in the moment i have plugged 2 cameras, the one in index 0 is an usb camera working, the one in index 1 is the arducam which is not working…

@jeandupond

Raspberry Pi does not directly fetch data from video0.

You need to use picamera2.

Pls try these examples: