Arducam IMX519 camera autofocus not working after imx519 driver installation

Hi all, hoping someone can point me in the right direction. I’ve got an Arducam IMX519 autofocus camera. I followed the tutorial install steps and the camera itself enables fine, but after installing the imx519 driver the autofocus still doesn’t work. The image comes up, but the focus motor never moves. Anyone else run into this?

Thanks for posting. Just so I’m clear - you followed the official Arducam tutorial and the autofocus motor doesn’t respond at all? Can you double-check the “For Arducam 16MP/64MP Autofocus Camera” section of the Libcamera User Guide and confirm you’ve done those steps?

https://docs.arducam.com/Raspberry-Pi-Camera/Native-camera/Libcamera-User-Guide/#for-arducam-16mp64mp-autofocus-camera

Thanks. I installed the imx519 low-speed driver and the focus motor still won’t move, even though the camera displays an image normally. I tried:

./install_pivariety_pkgs.sh -p imx519_low_speed_driver
libcamera-still -t 0 --autofocus-mode continuous

and also picamera2. Here’s what comes up:

[0:00:54.989419817] [2041] ERROR V4L2 v4l2_device.cpp:93 'ak7375 6-000c': Failed to open V4L2 device '/dev/v4l-subdev3': Invalid argument
[0:00:54.989435595] [2041] ERROR CameraSensor camera_sensor.cpp:540 'imx519 6-001a': Lens initialisation failed, lens disabled
raise RuntimeError(f"Control {name} is not advertised by libcamera")
RuntimeError: Control AfMode is not advertised by libcamera

Not sure where to go from here.

Those errors are telling us the lens controller isn’t being initialised at all. The ak7375 subdevice fails to open, so libcamera disables the lens, and then picamera2 complains that AfMode isn’t advertised because there’s no focus control available. That’s why you get video but no autofocus.

To dig further, I’ve sent you a small bug report tool via private message. Download it, make it executable, and run it - it’ll produce an arducam-bug-report.txt file in the current directory. Please send that file back to me privately so I can look at the full picture.

Here’s my /boot/config.txt too, in case it helps:

pi@fbody78:~ $ cat /boot/config.txt
# For more options and information see
# http://rptl.io/configtxt
# Some settings may impact device functionality. See link above for details

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

# Additional overlays and parameters are documented
# /boot/firmware/overlays/README

# Automatically load overlays for detected cameras
#camera_auto_detect=1

# Automatically load overlays for detected DSI displays
display_auto_detect=1

# Automatically load initramfs files, if found
auto_initramfs=1

# Enable DRM VC4 V3D driver
dtoverlay=vc4-kms-v3d
max_framebuffers=2

# Don't have the firmware create an initial video= setting in cmdline.txt.
# Use the kernel's default instead.
disable_fw_kms_setup=1

# Run in 64-bit mode
arm_64bit=1

# Disable compensation for displays with overscan
disable_overscan=1

# Run as fast as firmware / board allows
arm_boost=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

[all]
dtoverlay=imx519,cam0
dtoverlay=imx519,cam1

I’ve also sent the bug report file over.

Thanks, got the report. I can see you’ve got two IMX519 cameras connected to a Raspberry Pi 5. Is autofocus dead on BOTH cameras, or just one of them?

Both. Autofocus doesn’t work on either camera. It really feels like the focus driver module isn’t being loaded or installed at all.

Understood. I’ve received the report and I need some time to try to reproduce this internally before I can give you a solid answer. In the meantime, can you tell me about the cable you’re using? Is it a single cable, and is it the official Raspberry Pi 22-15pin cable? If you can, post a photo of it - that would help narrow this down.

Sure. For the environment: the system I installed around 2024/2/7 worked with autofocus normally until 2/15. After I re-flashed the Raspberry Pi 64-bit system on 2024/02/21, I couldn’t get the autofocus driver installed successfully anymore. The cable is a Raspberry Pi Camera Cable - Standard-Mini - 300mm. I’ve attached a couple of photos of the cable below.

Thanks. Let’s try to isolate this. First, if you have a Raspberry Pi 4 available, test the camera + SD card on it. Second, use the white 15-15pin cable that came in the camera packaging instead of the 22-15pin one. The goal is to verify whether the focus motors on these two cameras can still work at all.

I moved the camera over to a Raspberry Pi 3B+, but the focus motor still doesn’t work there either. Any other ideas?

Did you move the SD card over to the Pi 3 as well, or was that a fresh install? And when you run libcamera on the Pi 3, does it report the same ak7375 error?

I’m starting to suspect the focus motor itself is damaged. We’ve seen a situation where a Pi 5 with Raspberry Pi’s own 22-15pin cable can stop the focus motor from working. Before we call it, though, I’d suggest trying Arducam’s own 22-15pin FFC cable to connect the IMX519:

The SD card from the Pi 5 wouldn’t boot on the Pi 3, so I re-flashed a fresh one. On the Pi 3 the camera runs without those errors, but focus still can’t be controlled. I’ll test the Arducam 22-15pin FFC cable tomorrow and report back.

Pi 3 output:

Made X/EGL preview window
[0:07:02.282030660] [1459]  INFO Camera camera_manager.cpp:297 libcamera v0.0.0+4367-ad9428b4
[0:07:02.521494365] [1461]  INFO RPI vc4.cpp:444 Registered camera /base/soc/i2c0mux/i2c@1/imx519@1a to Unicam device /dev/media3 and ISP device /dev/media1
[0:07:02.522328894] [1461]  INFO RPI pipeline_base.cpp:1101 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
[0:07:02.525424563] [1459]  INFO Camera camera.cpp:1033 configuring streams: (0) 2048x1536-YUV420
[0:07:02.527214351] [1461]  INFO RPI vc4.cpp:572 Sensor: /base/soc/i2c0mux/i2c@1/imx519@1a - Selected sensor format: 2328x1748-SRGGB10_1X10 - Selected unicam format: 2328x1748-pRAA

On the Pi 3, can you check dmesg for motor driver errors? Run your libcamera command, then immediately run dmesg and look for any ak7375 lines. That’ll tell us whether the lens driver is still failing on the other board.

Yep, the error shows up in dmesg too. Here’s the relevant part:

[   14.399529] Registered IR keymap rc-cec
[   14.399836] rc rc0: vc4 as /devices/platform/soc/3f902000.hdmi/rc/rc0
[   14.400194] input: vc4 as /devices/platform/soc/3f902000.hdmi/rc/rc0/input5
[   14.534974] vc4-drm soc:gpu: bound 3f400000.hvs (ops vc4_hvs_ops [vc4])
[   14.557135] ak7375 10-000c: ak7375_active I2C failure: -121
[   14.571918] imx519 10-001a: Device found is imx519
[   14.574762] imx519 10-001a: Consider updating driver imx519 to match on endpoints

So the lens driver is definitely failing on the Pi 3 as well.

That ak7375_active I2C failure: -121 line is the smoking gun. The ak7375 is the lens/focus controller, and that error means it isn’t responding over I2C at all. In other words, the Pi can’t talk to the focus motor/lens controller - which is why focus is completely unresponsive even though the sensor streams video fine. If the Arducam FFC cable doesn’t change that, then this is pointing at a hardware fault on the camera module itself, not a driver or config problem.

I just tested with the Arducam connection cable and the focus motor still doesn’t work. So it’s not the cable either. What’s the next step here?

At this point everything points to a hardware fault on the camera module. Even with the Arducam 22-15pin cable, the ak7375 lens driver still reports I2C failure: -121, so the focus motor/lens controller isn’t communicating over I2C. The image sensor works, which is why you still get a normal preview, but autofocus can’t function without that I2C link. Software-wise there’s nothing more to try - the lens controller needs to respond before libcamera will expose any focus controls. You’d need to take this up with Arducam directly for a hardware-level check.