Arducam 16MP Autofocus camera not working after Raspberry Pi update - dmaHeap allocation failure

Hi all,

I’ve got an Arducam 16MP Autofocus (IMX519) on a Raspberry Pi 4B 1GB running Raspberry Pi OS Bookworm. The camera was working fine before, but after I did a full package update it completely stopped working. Any capture attempt now fails.

The main errors I’m seeing:

  • ‘ak7375 10-000c’: Failed to open V4L2 device ‘/dev/v4l-subdev1’: Invalid argument
  • ‘imx519 10-001a’: Lens initialisation failed, lens disabled
  • dmaHeap allocation failure for rpicam-apps
  • ERROR: *** failed to allocate capture buffers for stream ***
  • /dev/video0[13:cap]: Unable to request 2 buffers: Cannot allocate memory
  • ERROR: *** failed to start camera ***

Some diagnostics I’ve gathered so far:
vcgencmd get_camera → supported=1 detected=0, libcamera interfaces=1
dmesg shows ‘imx519 10-001a: Device found is imx519’
/dev/dma_heap/ contains reserved and system
CmaTotal 409600 kB, CmaFree 108348 kB

I’ve already tried adding cma=400M and cma=512M to cmdline.txt, but neither one resolved the errors. Any ideas?

Thanks for the detailed info. The interesting part is that the imx519 sensor is being detected, but the autofocus lens driver (ak7375) can’t open /dev/v4l-subdev1, and then the dmaHeap buffer allocation fails right after. That combination usually points to a memory/overlay configuration problem rather than a dead camera.

Before I dig further, can you grab a full diagnostic report? I’ve sent you our bug report tool via private message. Reboot the Pi first, then run the tool - it will generate an arducam-bug-report.txt file in the current directory. Send me that file so I can look at the full overlay and memory setup.

Here’s the detailed environment info, and I’ve attached the bug report file.

Product: Arducam 16MP Autofocus
Platform: Raspberry Pi 4B 1GB, Raspbian GNU/Linux 12 (bookworm)
Kernel: 6.6.51+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.51-1+rpt3 (2024-10-08) aarch64 GNU/Linux
libcamera v0.3.2+51-28bff115-dirty (2024-10-08T07:32:37BST)

From libcamera-still -t 3000 --autofocus-range normal --autofocus-mode continuous -n -o test.jpg:
Could not open any dmaHeap device
[0:00:36.661966458] [1515] INFO Camera camera_manager.cpp:325 libcamera v0.3.2+51-28bff115-dirty (2024-10-08T07:32:37BST)
[0:00:36.682443273] [1540] ERROR V4L2 v4l2_device.cpp:91 ‘ak7375 10-000c’: Failed to open V4L2 device ‘/dev/v4l-subdev1’: Invalid argument
[0:00:36.682839458] [1540] ERROR CameraSensor camera_sensor.cpp:554 ‘imx519 10-001a’: Lens initialisation failed, lens disabled
[0:00:36.713308902] [1540] WARN RPiSdn sdn.cpp:40 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[0:00:36.716583143] [1540] INFO RPI vc4.cpp:455 Registered camera /base/soc/i2c0mux/i2c@1/imx519@1a to Unicam device /dev/media4 and ISP device /dev/media0
[0:00:36.717538606] [1540] INFO RPI pipeline_base.cpp:1151 Using configuration file ‘/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml’
Mode selection for 2328:1748:12:P
SRGGB10_CSI2P,1280x720/0 - Score: 5319.24
SRGGB10_CSI2P,1920x1080/0 - Score: 3319.24
SRGGB10_CSI2P,2328x1748/0 - Score: 1000
SRGGB10_CSI2P,3840x2160/0 - Score: 1648.24
SRGGB10_CSI2P,4656x3496/0 - Score: 2019
Stream configuration adjusted
[0:00:36.723411810] [1515] INFO Camera camera.cpp:1197 configuring streams: (0) 2328x1748-YUV420 (1) 2328x1748-SRGGB10_CSI2P
[0:00:36.723998976] [1540] INFO RPI vc4.cpp:630 Sensor: /base/soc/i2c0mux/i2c@1/imx519@1a - Selected sensor format: 2328x1748-SRGGB10_1X10 - Selected unicam format: 2328x1748-pRAA
dmaHeap allocation failure for rpicam-apps0
ERROR: *** failed to allocate capture buffers for stream ***

From libcamera-still -t 0:
[0:09:11.984494610] [3368] INFO Camera camera_manager.cpp:325 libcamera v0.3.2+51-28bff115-dirty (2024-10-08T07:32:37BST)
[0:09:12.005886037] [3374] ERROR V4L2 v4l2_device.cpp:91 ‘ak7375 10-000c’: Failed to open V4L2 device ‘/dev/v4l-subdev1’: Invalid argument
[0:09:12.005996518] [3374] ERROR CameraSensor camera_sensor.cpp:554 ‘imx519 10-001a’: Lens initialisation failed, lens disabled
Preview window unavailable
[0:09:12.329509724] [3374] ERROR V4L2 v4l2_videodevice.cpp:1266 /dev/video0[13:cap]: Unable to request 2 buffers: Cannot allocate memory
[0:09:12.329905221] [3374] ERROR RPI pipeline_base.cpp:700 Failed to allocate buffers
ERROR: *** failed to start camera ***

dmesg | grep -E “imx477|imx519|arducam”:
[0.047262] platform fe801000.csi: Fixed dependency cycle(s) with /soc/i2c0mux/i2c@1/imx519@1a
[2.609263] platform fe801000.csi: Fixed dependency cycle(s) with /soc/i2c0mux/i2c@1/imx519@1a
[7.692154] imx519 10-001a: Device found is imx519

vcgencmd get_camera → supported=1 detected=0, libcamera interfaces=1
ls /dev/video0 → /dev/video0
vcgencmd get_mem arm && vcgencmd get_mem gpu → arm=896M, gpu=128M

config.txt key lines:
dtparam=i2c_arm=on
dtparam=spi=on
dtparam=audio=on
start_x=1
display_auto_detect=1
auto_initramfs=1
#dtoverlay=vc4-kms-v3d,cma-512
max_framebuffers=2
disable_overscan=1
arm_boost=1
[all]
dtoverlay=imx519
gpu_mem=128
otg_mode=1

/proc/meminfo key values:
MemTotal: 877792 kB
MemFree: 165224 kB
MemAvailable: 561680 kB
SwapTotal: 204796 kB
SwapFree: 204796 kB
CommitLimit: 643692 kB
Committed_AS: 863192 kB
CmaTotal: 409600 kB
CmaFree: 108348 kB

As mentioned, I already tried cma=400M and cma=512M in cmdline.txt and still got the same errors. Bug report is attached.

Thanks, I got the report. Looking at your config, I want you to change two lines in /boot/firmware/config.txt.

Change from:
[all]
dtoverlay=imx519,arducam
gpu_mem=32

To:
[all]
dtoverlay=imx519
gpu_mem=128

Make sure the arducam parameter is removed from the overlay line and that gpu_mem is set to 128. That combination can cause exactly the lens-init and buffer allocation errors you’re seeing. Reboot after saving and test again.

Still getting the same error after making that change and rebooting. I modified config.txt to dtoverlay=imx519 and gpu_mem=128, rebooted, and the error persists.

I also double-checked permissions - my user is in the video group, and the video group does have access to the dma_heap devices:
ls -l /dev/dma_heap/*
crw-rw---- 1 root video 253, 1 Nov 19 09:24 /dev/dma_heap/reserved
crw-rw---- 1 root video 253, 0 Nov 19 09:24 /dev/dma_heap/system

Second bug report is attached.

Thanks, I’ve gone through the second bug report and your current config. The /dev/dma_heap permissions are correct (root:video with rw for the video group), so this is not a permissions problem. The buffer allocation keeps failing even after the overlay fix, and on a 1GB Pi 4 that usually points to not having enough contiguous memory headroom left for the camera pipeline.

Two suggestions at this point:

  1. Do a fresh install - flash a clean Raspberry Pi OS Bookworm image to the SD card and follow the official Arducam 16MP setup guide step by step: 16MP IMX519 - Arducam Wiki - this eliminates any leftover conflicts from previous configurations.
  2. If it still fails after a clean install, consider moving to a Raspberry Pi 4 with more RAM (4GB or 8GB). The 1GB model has very little headroom for this sensor plus the memory-intensive capture path.

I don’t have a definitive fix yet, but that’s where the evidence is pointing right now.

Thanks. I actually still have a backup SD card from before the update, so I’m going to revert to that for now and see if the camera comes back on the old setup. I’ll update the thread once I’ve tested it.