Hi all, I’ve been setting up an Arducam IMX519 Multi-Camera Kit on a Raspberry Pi 4B. I’m using the CSI-to-HDMI adaptors to get a longer 3m cable run, following the CamArray extension solution in the docs. Video capture works fine with libcamera-vid and a few other tools, but autofocus won’t work at all - the driver can’t access /dev/v4l-subdev1. Is focus even supported on the CamArray + IMX519 kit? And should I be installing imx519_kernel_driver_low_speed for this?
Hi, autofocus should be supported on the IMX519. Before we jump to drivers, could you post your environment details (Pi hardware revision, kernel version, OS, libcamera package versions)? And if you can run a short capture with --autofocus-mode manual and --lens-position 0, that will show us the exact failure.
Here’s the environment:
Hardware Revision: c03115
uname -a: Linux picam 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux
OS: bullseye (Debian GNU/Linux 11)
ARCH: aarch64
libcamera: v0.0.0+4367-ad9428b4
libcamera-dev: 0~git20230724+ad9428b4-1
libcamera-apps: 1.2.1-1
Supported packages from ./install_pivariety_pkgs.sh -l:
imx519_kernel_driver_low_speed, imx708_kernel_driver, libcamera, 64mp_pi_hawk_eye_kernel_driver, libcamera_apps, imx708_b0311_kernel_driver, libcamera_dev, imx519_kernel_driver, kernel_driver
Thanks, that all looks reasonable. Can you run this and paste the output?
libcamera-vid --level 4.2 --framerate 30 --width 1920 --height 1080 --save-pts timestamp.pts -o video.264 -t 10000 --denoise cdn_off -n --autofocus-mode manual --lens-position 0
Sure, here’s the output. It fails right at the start:
[20:29:59.153176027] [11657] INFO Camera camera_manager.cpp:297 libcamera v0.0.0+4367-ad9428b4
[20:29:59.173464013] [11659] ERROR V4L2 v4l2_device.cpp:93 ‘ak7375 10-000c’: Failed to open V4L2 device ‘/dev/v4l-subdev1’: Invalid argument
[20:29:59.173523846] [11659] ERROR CameraSensor camera_sensor.cpp:527 ‘imx519 10-001a’: Lens initialisation failed, lens disabled
[20:29:59.196330269] [11659] INFO RPI vc4.cpp:444 Registered camera /base/soc/i2c0mux/i2c@1/imx519@1a to Unicam device /dev/media1 and ISP device /dev/media0
[20:29:59.196693028] [11659] INFO RPI pipeline_base.cpp:1101 Using configuration file ‘/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml’
Mode selection:
SRGGB10_CSI2P 1280x720 - Score: 5000
SRGGB10_CSI2P 1920x1080 - Score: 3000
SRGGB10_CSI2P 2328x1748 - Score: 4606.91
SRGGB10_CSI2P 3840x2160 - Score: 27741.9
SRGGB10_CSI2P 4656x3496 - Score: 47622.8
Stream configuration adjusted
[20:29:59.205650005] [11657] INFO Camera camera.cpp:1033 configuring streams: (0) 1920x1080-YUV420 (1) 1920x1080-SRGGB10_CSI2P
[20:29:59.206135133] [11659] INFO RPI vc4.cpp:572 Sensor: /base/soc/i2c0mux/i2c@1/imx519@1a - Selected sensor format: 1920x1080-SRGGB10_1X10 - Selected unicam format: 1920x1080-pRAA
[20:29:59.502875098] [11659] INFO V4L2 v4l2_videodevice.cpp:1820 /dev/video0[14:cap]: Zero sequence expected for first frame (got 1)
[20:29:59.503014950] [11659] INFO V4L2 v4l2_videodevice.cpp:1820 /dev/video1[15:cap]: Zero sequence expected for first frame (got 1)
Halting: reached timeout of 10000 milliseconds.
Thanks. The key lines are the ak7375 failing to open /dev/v4l-subdev1 and ‘Lens initialisation failed, lens disabled’. The ak7375 is the focus (VCM) controller, so it’s not just a missing subdev - the lens is being disabled entirely. Can you check dmesg for ak7375 messages and the i2c bus status? Try:
cat /sys/bus/i2c/devices/10-000c/modalias
cat /sys/bus/i2c/devices/10-000c/name
i2cdetect -y 10
Here’s what I see in dmesg from boot:
[ 4.129289] ak7375 10-000c: supply vio not found, using dummy regulator
[ 4.146762] imx519 10-001a: Device found is imx519
[ 4.147415] imx519 10-001a: Consider updating driver imx519 to match on endpoints
[ 4.207322] ak7375 10-000c: ak7375_vcm_resume I2C failure: -121
And the i2c slave info:
cat /sys/bus/i2c/devices/10-000c/modalias
of:Nak7375T(null)Casahi-kasei,ak7375
cat /sys/bus/i2c/devices/10-000c/name
ak7375
i2cdetect -y 10:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – – – – UU – – –
10: – – – – – – – – – – UU – – – – –
20: – – – – 24 – – – – – – – – – – –
Interesting - ‘ak7375_vcm_resume I2C failure: -121’ is an I2C communication failure, not just a missing device node. Since you’re running through CSI-to-HDMI adaptors with a 3m cable run, the long cable path could be affecting the I2C to the focus controller. Can you test the kit connected directly to the Pi 4B without the CSI-to-HDMI adaptors, using the short CSI cables that came with it? That will tell us whether the adaptor/long run is the problem.
Tried that. I removed each HDMI cable and the CSI/HDMI adaptors and used the furnished CSI cable for each camera. Result is exactly the same - still getting the i2c failure with the ak7375 focus controller. So it doesn’t look like the adaptors or the cable length.
I also found this Arducam forum thread with the same issue: No Autofocus working IMX519 - #17 by vbuser (‘No Autofocus working IMX519’). Another user posted very similar errors:
libcamera-hello Preview window unavailable
[0:00:53.775789152] [707] INFO Camera camera_manager.cpp:299 libcamera v0.0.0+4226-8689dd6b
[0:00:53.805391429] [709] ERROR V4L2 v4l2_device.cpp:92 ‘ak7375 10-000c’: Failed to open V4L2 device ‘/dev/v4l-subdev1’: Invalid argument
[0:00:53.805466503] [709] ERROR CameraSensor camera_sensor.cpp:517 ‘imx519 10-001a’: Lens initialisation failed,…
Has a fix for this been found?
Thanks for confirming the direct-connection test - that rules out the CSI-to-HDMI adaptors and the 3m cabling. This is a known conflict. The existing ‘dtoverlay=imx519’ entry in the config file conflicts with the correct driver setup needed for IMX519 PDAF/autofocus. Do the following:
- Comment out or delete the line ‘dtoverlay=imx519’ in the config file if it’s present.
- I’ve sent you the low-speed PDAF kernel driver package via private message (imx519_kernel_driver_low_speed_pdaf_6.1.21.tar.gz). Please check your messages and download it to the Pi.
- Extract and install:
tar avxf imx519_kernel_driver_low_speed_pdaf_6.1.21.tar.gz
cd Release/
./install_driver.sh - Reboot the Pi.
Then rerun your autofocus test and let us know.
To summarize where this landed: video capture works, but autofocus fails because the ak7375 lens controller can’t initialize. In libcamera you’ll see ‘ak7375 10-000c’: Failed to open V4L2 device ‘/dev/v4l-subdev1’ and ‘Lens initialisation failed, lens disabled’, and in dmesg ‘ak7375_vcm_resume I2C failure: -121’. We ruled out the CSI-to-HDMI adaptors and the 3m cabling since a direct connection with the furnished cables produced the same failure. The working fix is to remove/comment the conflicting ‘dtoverlay=imx519’ overlay and install the imx519 low-speed PDAF kernel driver (imx519_kernel_driver_low_speed_pdaf_6.1.21.tar.gz) via ./install_driver.sh from the Release directory, then reboot. Please report back after testing so we can confirm.