Arducam Pivariety 21MP IMX230 on Raspberry Pi 4B: width/height, autofocus, make fails in libcamera_cpp_demo

Hi all. I’ve got an Arducam Pivariety 21MP IMX230 Color Camera Module on a Raspberry Pi 4B, running libcamera on kernel 5.10.92. I’m trying to use the libcamera_cpp_demo but I can’t change the width and height - it just dumps a huge error at me. The camera is also way too sensitive to light (the image looks overexposed) and autofocus doesn’t do anything even when I press ‘f’ many times. On top of that, libcamera_cpp_demo-master fails at the make -j2 step. I’ve attached error.txt with the build output.

Welcome to the forum. That sounds like a few separate issues. Can you confirm which kernel/libcamera version you’re on and which demo package you’re building? If you can also attach the full make -j2 output and a screenshot or two of the overexposure and focus problems, that’ll help narrow it down.

Sure. The board is a Raspberry Pi 4B and I’m on libcamera with kernel 5.10.92. I have two packages: libcamera_cpp_demo and libcamera_cpp_demo-master. The regular demo runs, but changing width/height throws that big error, light sensitivity is too strong, and pressing ‘f’ repeatedly has no effect on autofocus. The master package fails when I run make -j2. Here are the files:
error.txt: https://cdn.arducam.com/forum/d6f2c0998ea2ef922811cc850c4e901d/error.txt
libcamera_cpp_demo.zip: https://cdn.arducam.com/forum/d6f2c0998ea2ef922811cc850c4e901d/libcamera_cpp_demo.zip
libcamera_cpp_demo-master.zip: https://cdn.arducam.com/forum/d6f2c0998ea2ef922811cc850c4e901d/libcamera_cpp_demo-master.zip
overexposure screenshot: https://cdn.arducam.com/forum/d6f2c0998ea2ef922811cc850c4e901d/2023-03-28-003735_2560x1080_scrot.png
autofocus screenshot: https://cdn.arducam.com/forum/d6f2c0998ea2ef922811cc850c4e901d/2023-03-28-003758_2560x1080_scrot.png

Thanks, that’s helpful. I looked at the screenshots - the first one clearly shows the overexposure/light issue and the second shows autofocus not engaging even with the ‘f’ key. The error.txt also shows the build failing for the master demo. This all points to the demo being built against an older libcamera API. The current libcamera on 5.10.92 has changed enough that the demo no longer behaves properly.

Ah, so it’s an incompatibility with the newer libcamera? Is there any way to keep using libcamera_cpp_demo, or do I need to switch to something else?

Right. After checking into it, Arducam is no longer supporting the libcamera_cpp demo because of the libcamera updates - that’s the root cause of the width/height errors and the master build failing. The recommended path is to move to the official libcamera source/apps repositories for continued development:

https://github.com/raspberrypi/libcamera-apps/blob/main/core/libcamera_app.cpp

So in short, the libcamera_cpp demo is deprecated. Migrating to libcamera-apps (or the src/apps under libcamera) is the way forward for the width/height, exposure, and focus work.