64mp: Duplicate images on non-successive captures

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

  2. Model number of the product(s)?
    hawkeye 64mp

  3. What hardware/platform were you working on?
    rpi4 4gb

  4. Instructions you have followed. (link/manual/etc.)
    Followed the PDF manual provided by Arducam

  5. Problems you were having?
    I’m capturing large datasets by successively setting the manual focus and calling libcamera-still -n -o tmp.jpg --width 9152 --height 6944. Every so often, an image is showing a duplicate of a previous image in a set, but not the most recent previous image. Duplicates confirmed both visually and by md5.
    As an example, I might capture 5 images, with the first 4 being unique, and the 5th image being a duplicate of the 1st image.
    This is also periodically happening in cycles. In a segment of 60 captures, images 1 through 20 are unique, images 21-40 are copy of images 1-20, and images 41-60 are also a duplicate of images 1-20.

Notably, this issue does not occur with a 16mp camera (also from Arducam), and it also doesn’t occur when running this 64mp camera at 16mp resolution.

  1. The dmesg log from your hardware?
    I did not think to capture this at the time, and these take a while to generate, as the dataset capture takes multiple hours. I will start another capture and make sure to grab it this time.

  2. Troubleshooting attempts you’ve made?
    Increasing gpu-mem (didn’t help), adding a significant delay between image captures (didn’t help), adding dispmanx_offline=1 to /boot/config.txt (made the problem less frequent, but not entirely solved)

  3. What help do you need?
    Someone with a better understanding of how low-level memory management works on the rpi to help narrow down which buffers are being incorrectly recycled.

Relevant (changed) parts of /boot/config.txt:
[all]
camera_auto_detect=0
gpu_mem=256
dtoverlay=vc4-kms-v3d,cma-512
dtoverlay=imx519,media-controller=1
dtoverlay=arducam_64mp,media-controller=0
dispmanx_offline=1

Run completed. The dmesg shows many sets of messages such as those that follow. They do not occur on every image taken, and they do not seem to be grouped in any meaningful way (not all of the last images, not all of the first images, not at regular intervals, not in groups of regular sizes). Of the 1000 images taken, these errors show up around 50 times:

[ 5700.364962] cma: cma_alloc: alloc failed, req-size: 23274 pages, ret: -16
[ 5700.364977] bcm2835-isp bcm2835-isp: dma_alloc_coherent of size 95330304 failed

and

[ 6587.953672] cma: cma_alloc: alloc failed, req-size: 19422 pages, ret: -16
[ 6587.953689] unicam fe801000.csi: dma_alloc_coherent of size 79552512 failed