Segmentation fault using autofocus with Arducam 16MP IMX519 on Raspberry Pi 3

Hi everyone, hoping someone can help me with an Arducam 16MP autofocus camera module (imx519) on a Raspberry Pi 3. When I run the autofocus command I get a segmentation fault and it never shows or saves an image. I followed the “How to use Arducam 16MP camera on Raspberry Pi” guide online and it actually worked for a while, but somewhere along the line it just quit working on me. I’ve tried a few things already: lowering the resolution didn’t help, taking a plain still image works fine but the focus part doesn’t, and I tried installing the manual focus git package but it asked me for a username and password that I don’t have. Anyone seen this before?

Before we go any further, I’d like to grab a full diagnostic log from the camera so I can see what’s actually going on. Could you reboot the device first (fresh boot matters here), then run these commands in a terminal?

wget -O arducam-camera-bug-report https://github.com/ketai-dhr/arducam-camera-bug-report/releases/download/tools/arducam-camera-bug-report
chmod +x ./arducam-camera-bug-report
./arducam-camera-bug-report

That will produce an arducam-bug-report.txt in the current directory. Please attach that file here so I can take a look.

OK, I rebooted and ran the commands. Attached is arducam-bug-report.txt. One thing though — the report file itself doesn’t seem to show the segmentation fault, so I’m pasting the terminal output below.

So: first install the camera worked perfectly, now the autofocus command just segfaults. Still image capture works, focus doesn’t. Lower resolution didn’t help either.

Environment:

  • Raspberry Pi 3
  • Arducam 16MP autofocus camera module
  • Sensor: imx519 at /base/soc/i2c0mux/i2c@1/imx519@1a
  • libcamera v0.0.0+3730-67300b62

Command I’m running:

libcamera-still -t 0 --viewfinder-width 2328 --viewfinder-height 1748 --autofocus

Output:

Made X/EGL preview window
[0:09:27.887944878] [2399]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3730-67300b62
[0:09:27.897660010] [2412]  WARN CameraSensorProperties camera_sensor_properties.cpp:174 No static properties available for 'imx519'
[0:09:27.897775741] [2412]  WARN CameraSensorProperties camera_sensor_properties.cpp:176 Please consider updating the camera sensor properties database
[0:09:27.968759158] [2412]  WARN RPI raspberrypi.cpp:1274 Mismatch between Unicam and CamHelper for embedded data usage!
[0:09:27.969830579] [2412] ERROR DelayedControls delayed_controls.cpp:87 Delay request for control id 0x009a090a but control is not exposed by device /dev/v4l-subdev0
[0:09:27.970582725] [2412]  INFO RPI raspberrypi.cpp:1398 Registered camera /base/soc/i2c0mux/i2c@1/imx519@1a to Unicam device /dev/media3 and ISP device /dev/media0
[0:09:27.971657271] [2399]  INFO Camera camera.cpp:1029 configuring streams: (0) 2048x1536-YUV420
[0:09:27.972449261] [2412]  INFO RPI raspberrypi.cpp:763 Sensor: /base/soc/i2c0mux/i2c@1/imx519@1a - Selected sensor format: 2328x1748-SRGGB10_1X10 - Selected unicam format: 2328x1748-pRAA
Segmentation fault

Attachment: arducam-bug-report.txt (I’ve linked it in the attachment section).

Also just to confirm the version and prompt in case it matters:

pi@raspberrypi:~ $ libcamera-still -t 0 --viewfinder-width 2328 --viewfinder-height 1748 --autofocus

And yeah, the manual focus git package attempt is where it stopped and asked me for a username/password, so I couldn’t get any further with that route.

Thanks, that output is exactly what I needed. Based on what I’m seeing, the segmentation fault on autofocus is caused by the missing motor drive (motor driver) for the autofocus lens mechanism. Without it, the autofocus part of the pipeline can’t drive the lens and the process dies.

The fix is to install the low-speed imx519 kernel driver through the pivariety package install script:

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 imx519_kernel_driver_low_speed

Give that a go and then re-run your original autofocus command. To recap the current conclusion: the still-image path works fine, only autofocus fails, and that points squarely at the missing motor drive. Installing the imx519 low-speed kernel driver is the workaround for the segfault. Let me know how it goes and if there’s any residual error afterwards.