CM4 with 2x Cameras 16MP/16MP and 16MP/64MP

I am testing these 2 cameras in parallel to determine cameras suitable for a larger project.
I am using CM4 2RAM / 8EMMC.

In general I am very happy with the camera picture quality. Especially the 64MP is incredible. Well done ArduCam!

Manual and autofocus works nicely and is very controllable via software.

The following questions are to iron out some kinks I have encountered. I read the docs, the forum post here and here.

RAW in 64MP
It is possible to capture a DNG file with this command in full resolution:
libcamera-still --camera 0 -t 2000 --verbose 2 --rawfull --encoding png -o 64mp.png --raw --shutter 100000 --autofocus-on-capture

My goal would be to be able to do this as RAW, but at full resolution. There seems to be a known problem, but none of the linked pages lead to a success:

This command works, with a little warning:
libcamera-raw -t 1100 --camera 0 --segment 1 -o test%05d.raw --width 4656 --height 3496

WARNING
[0:22:50.348974573] [7727] INFO Camera camera_manager.cpp:299 libcamera v0.0.0+4225-74d023d8
[0:22:50.372090248] [7728] WARN CameraSensorProperties camera_sensor_properties.cpp:243 No static properties available for ‘arducam_64mp’
[0:22:50.372193284] [7728] WARN CameraSensorProperties camera_sensor_properties.cpp:245 Please consider updating the camera sensor properties database
[0:22:50.477673572] [7728] WARN RPI raspberrypi.cpp:1357 Mismatch between Unicam and CamHelper for embedded data usage!
[0:22:50.478737206] [7728] INFO RPI raspberrypi.cpp:1476 Registered camera /base/soc/i2c0mux/i2c@1/arducam_64mp@1a to Unicam device /dev/media4 and ISP device /dev/media1

writes a raw file, but this one fails:

libcamera-raw -t 1100 --camera 0 --segment 1 -o test%05d.raw --width 9152 --height 6944
INFO Camera camera_manager.cpp:299 libcamera v0.0.0+4225-74d023d8
WARN CameraSensorProperties camera_sensor_properties.cpp:243 No static properties available for ‘arducam_64mp’
WARN CameraSensorProperties camera_sensor_properties.cpp:245 Please consider updating the camera sensor properties database

WARN RPI raspberrypi.cpp:1357 Mismatch between Unicam and CamHelper for embedded data usage!
INFO RPI raspberrypi.cpp:1476 Registered camera /base/soc/i2c0mux/i2c@1/arducam_64mp@1a to Unicam device /dev/media4 and ISP device /dev/media1
INFO Camera camera.cpp:1028 configuring streams: (0) 9152x6944-YUV420 (1) 9152x6944-SRGGB10_CSI2P
INFO RPI raspberrypi.cpp:851 Sensor: /base/soc/i2c0mux/i2c@1/arducam_64mp@1a - Selected sensor format: 9152x6944-SRGGB10_1X10 - Selected unicam format: 9152x6944-pRAA
ERROR V4L2 v4l2_videodevice.cpp:1248 /dev/video14[15:cap]: Not enough buffers provided by V4L2VideoDevice

ERROR: *** failed to allocate capture buffers ***

My config.txt settings should be ok - I tried to pull all info from the linked posts.

DUAL CAMERA OPERATION
When I connect 16MP/16MP there are no issues. Both can be controlled as advertised.
When I connect 64MP/16MP there are no issues. Both can be controlled as advertised.

I had on of the 5 16MP experience a hardware issue that has been since replaced.

Please advise.

@jonasrejman

For this issue, the recommended solution is to use the headless version of the image.

If you have the capability, we encourage you to give it a try.

However, please note that currently it may be difficult to save two 64mp images simultaneously

Thank you for the advise.

I am using the headless image as suggested in the docs,
however the issue remains.

Conducting more tests with simultaneous triggering.

2x 16MP works when the cameras are first armed with:
libcamera-still --camera 0 -t 0 --verbose 2 --rawfull --encoding png -o CAM0.png --raw --shutter 100000 --lens-position 5.69 --metadata CAM0.txt --signal
libcamera-still --camera 1 -t 0 --verbose 2 --rawfull --encoding png -o CAM1.png --raw --shutter 100000 --lens-position 5.69 --metadata CAM1.txt --signal

and then triggered via a signal with this script:

import subprocess
import concurrent.futures

def send_signal(pid):
    try:
        subprocess.run(["kill", "-s", "SIGUSR1", str(pid)], check=True)
        print(f"Sent SIGUSR1 to PID {pid}")
    except subprocess.CalledProcessError as e:
        print(f"Error sending signal to PID {pid}: {e}")

def main():
    # Find the PIDs of the running libcamera-still processes
    find_pids = subprocess.run(["pgrep", "libcamera-still"], capture_output=True, text=True)

    if find_pids.returncode == 0:
        pids = list(map(int, find_pids.stdout.strip().split("\n")))

        # Execute the kill command simultaneously using multithreading
        with concurrent.futures.ThreadPoolExecutor() as executor:
            executor.map(send_signal, pids)
    else:
        print("No libcamera-still processes found")

if __name__ == "__main__":
    main()

However when using 64MP and 16MP in this way, I get again the buffer error.
I am using the headless version of raspi, updated to last kernel.

config.txt:

dtparam=audio=on
max_framebuffers=2
arm_64bit=1
disable_overscan=1

[cm4]
otg_mode=1
dtoverlay=vc4-kms-v3d,cma-1024
alloc_in_cma_threshold=16

[all]

[pi4]
arm_boost=1

[all]
dtoverlay=arducam-64mp,cam1
dtoverlay=imx519,cam0

This is on CM4 - 2GB RAM and 8GB emmc. We really would like to use the 64MP cameras for a very exciting project, but this seems to make it impossible. Is there any way around this?
Would the CM4 need more RAM, for example?

@jonasrejman

I’m not sure if cma-1024 is enabled. Could you please check?

cat /proc/meminfo | grep Cma

image

You can use cma-512 instead. 512 is sufficient for our verification purposes.