Autofocus not working pi5

  1. Where did you get the camera module(s)?
    Antratek

  2. Model number of the product(s)?
    Arducam IMX519 16MP Autofocus Camera Module for Raspberry Pi, NVIDIA Jetson

  3. What hardware/platform were you working on?

  4. Raspberry Pi 5 with HAILO AI module

  5. Instructions you have followed. (link/manual/etc.)

  6. Problems you were having?
    can not set focus

  7. The dmesg log from your hardware?

  8. Troubleshooting attempts you’ve made?

  9. What help do you need?

Hardware:

  • Raspberry Pi 5
  • Arducam IMX519 16MP Autofocus camera module
  • Raspberry Pi OS (Trixie-based), rpicam-apps 1.12.0-2, kernel 6.18.39+rpt-rpi-2712 (arm64)
  • Camera connected via dtoverlay=imx519,cam0 in /boot/firmware/config.txt

Problem:
The sensor is detected correctly and image capture works fine, but autofocus never engages — --lens-position has zero effect regardless of value. rpicam-still logs:

WARN IPARPI ipa_base.cpp:812  Could not set AF_MODE - no AF algorithm
WARN IPARPI ipa_base.cpp:1424 Could not set LENS_POSITION - no AF algorithm
WARN IPARPI ipa_base.cpp:1331 Could not set AF_RANGE - no focus algorithm
WARN IPARPI ipa_base.cpp:1349 Could not set AF_SPEED - no focus algorithm

sudo dmesg | grep -iE "lens|dw9|vcm|ak73" returns nothing at all — not even a failed I2C probe/attempt for a VCM device, only the sensor itself is registered:

imx519 10-001a: Device found is imx519
rp1-cfe 1f00110000.csi: Using sensor imx519 10-001a for capture

Steps already taken, no change in any case:

  1. Replaced the camera module with a second, separate IMX519 AF unit — identical symptoms on both.
  2. Replaced the CSI ribbon cable (original was pinched between a lid and enclosure) — camera detection was briefly lost after reconnecting, restored after a reboot, but AF behavior unchanged.
  3. Rebooted multiple times.
  4. Ran your official install script: install_pivariety_pkgs.sh -p libcamera_dev and -p libcamera_apps, followed by a reboot — no change, dmesg still shows zero lens/VCM activity.

Given that two separate physical units show identical behavior, this doesn’t look like an individual hardware defect. Could you advise on the specific dtoverlay/kernel driver requirements for VCM detection on Pi 5 with this module, or let me know if this is a known compatibility issue?

Hi there,
It appears that you didn’t install the Arducam-forked libcamera on your Raspberry Pi 5. Please run the following commands to install it to get autofocus working on your IMX519 camera module.

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

Let us know if that works for you.

Thanks for the quick reply! I had actually already run exactly those commands (libcamera_dev + libcamera_apps via install_pivariety_pkgs.sh) before posting, and unfortunately it made no difference at that point — dmesg still showed zero lens/VCM activity at all (not even a failed I2C probe), and rpicam-still --autofocus-mode manual --lens-position X still produced identically blurred images regardless of the value.

What actually fixed it was also upgrading rpicam-apps itself to version 1.13.0-2 (was 1.12.0-2). After that, continuous autofocus started working properly — sharp images with clear depth-of-field falloff, confirmed both visually and via Laplacian-variance sharpness scoring (jumped from ~2.6 to ~16.8 on the same test scene).

One remaining oddity, in case it’s useful for you or others hitting this: --autofocus-mode continuous --autofocus-on-capture 1 now works great, but --autofocus-mode manual --lens-position X still produces the same blur as before the fix, regardless of the lens-position value — so manual/fixed-position focus still seems broken on this setup even though continuous AF works fine. I’ve worked around it by switching my application to continuous AF instead of manual, but wanted to flag it in case it points to a separate bug.

Setup for reference: Raspberry Pi 5, Arducam IMX519 16MP Autofocus module, Raspberry Pi OS Trixie, kernel 6.18.39+rpt-rpi-2712, rpicam-apps 1.13.0-2.