Arducam 64mp random *** failed to allocate capture buffers *** with added cma-512

Hi!

Pi 4 with 2G here.

I’m getting random errors with memory allocation. Sometimes command needs to be executed several times to capture an image.

dtoverlay=vc4-kms-v3d,cma-512 was added.

CmaTotal: 524288 kB
CmaFree: 426756 kB

Shooting in JPG usually works fine. Adding -r for Raw output crashes randomly. Will post logs in next post

  • repeating command after it fails without changing anything eventually works. I guess this is software problem. Lets fix it.
1 Like

test.sh:
libcamera-still -r --nopreview --timestamp --denoise cdn_off --gain 0 --shutter 2000000
libcamera-still -r --nopreview --timestamp --denoise cdn_off --gain 0 --shutter 4000000
libcamera-still -r --nopreview --timestamp --denoise cdn_off --gain 0 --shutter 8000000
libcamera-still -r --nopreview --timestamp --denoise cdn_off --gain 0 --shutter 16000000
libcamera-still -r --nopreview --timestamp --denoise cdn_off --gain 0 --shutter 32000000
libcamera-still -r --nopreview --timestamp --denoise cdn_off --gain 0 --shutter 64000000

results:

[0:17:37.260168844] [1533] INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3729-5f595cca
[0:17:37.263527085] [1535] WARN CameraSensorProperties camera_sensor_properties.cpp:174 No static properties available for ‘arducam_64mp’
[0:17:37.263572974] [1535] WARN CameraSensorProperties camera_sensor_properties.cpp:176 Please consider updating the camera sensor properties database
[0:17:37.287776360] [1535] WARN RPI raspberrypi.cpp:1274 Mismatch between Unicam and CamHelper for embedded data usage!
[0:17:37.288414190] [1535] ERROR DelayedControls delayed_controls.cpp:87 Delay request for control id 0x009a090a but control is not exposed by device /dev/v4l-subdev0
[0:17:37.288726077] [1535] INFO RPI raspberrypi.cpp:1398 Registered camera /base/soc/i2c0mux/i2c@1/arducam_64mp@1a to Unicam device /dev/media3 and ISP device /dev/media0
[0:17:37.289635942] [1533] INFO Camera camera.cpp:1029 configuring streams: (0) 4624x3472-YUV420
[0:17:37.290606030] [1535] INFO RPI raspberrypi.cpp:763 Sensor: /base/soc/i2c0mux/i2c@1/arducam_64mp@1a - Selected sensor format: 4624x3472-SBGGR10_1X10 - Selected unicam format: 4624x3472-pBAA
[0:17:42.805166284] [1533] INFO Camera camera.cpp:1029 configuring streams: (0) 9152x6944-YUV420 (1) 9152x6944-SBGGR10_CSI2P
[0:17:42.807135755] [1535] INFO RPI raspberrypi.cpp:763 Sensor: /base/soc/i2c0mux/i2c@1/arducam_64mp@1a - Selected sensor format: 9152x6944-SBGGR10_1X10 - Selected unicam format: 9152x6944-pBAA
[0:17:43.169754100] [1535] ERROR V4L2 v4l2_videodevice.cpp:1211 /dev/video0[14:cap]: Unable to request 1 buffers: Cannot allocate memory
[0:17:43.169881896] [1535] ERROR RPI raspberrypi.cpp:1023 Failed to allocate buffers
ERROR: *** failed to start camera ***
[0:17:43.281702931] [1542] INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3729-5f595cca
[0:17:43.285011079] [1544] WARN CameraSensorProperties camera_sensor_properties.cpp:174 No static properties available for ‘arducam_64mp’
[0:17:43.285056783] [1544] WARN CameraSensorProperties camera_sensor_properties.cpp:176 Please consider updating the camera sensor properties database
[0:17:43.310167700] [1544] WARN RPI raspberrypi.cpp:1274 Mismatch between Unicam and CamHelper for embedded data usage!
[0:17:43.310811197] [1544] ERROR DelayedControls delayed_controls.cpp:87 Delay request for control id 0x009a090a but control is not exposed by device /dev/v4l-subdev0
[0:17:43.311111066] [1544] INFO RPI raspberrypi.cpp:1398 Registered camera /base/soc/i2c0mux/i2c@1/arducam_64mp@1a to Unicam device /dev/media3 and ISP device /dev/media0
[0:17:43.311919709] [1542] INFO Camera camera.cpp:1029 configuring streams: (0) 4624x3472-YUV420
[0:17:43.312425262] [1544] INFO RPI raspberrypi.cpp:763 Sensor: /base/soc/i2c0mux/i2c@1/arducam_64mp@1a - Selected sensor format: 4624x3472-SBGGR10_1X10 - Selected unicam format: 4624x3472-pBAA
[0:17:48.917361874] [1542] INFO Camera camera.cpp:1029 configuring streams: (0) 9152x6944-YUV420 (1) 9152x6944-SBGGR10_CSI2P
[0:17:48.919230085] [1544] INFO RPI raspberrypi.cpp:763 Sensor: /base/soc/i2c0mux/i2c@1/arducam_64mp@1a - Selected sensor format: 9152x6944-SBGGR10_1X10 - Selected unicam format: 9152x6944-pBAA
[0:17:49.285087872] [1544] ERROR V4L2 v4l2_videodevice.cpp:1211 /dev/video0[14:cap]: Unable to request 1 buffers: Cannot allocate memory
[0:17:49.285223242] [1544] ERROR RPI raspberrypi.cpp:1023 Failed to allocate buffers
ERROR: *** failed to start camera ***
[0:17:49.395875134] [1552] INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3729-5f595cca
[0:17:49.399098005] [1554] WARN CameraSensorProperties camera_sensor_properties.cpp:174 No static properties available for ‘arducam_64mp’
[0:17:49.399141486] [1554] WARN CameraSensorProperties camera_sensor_properties.cpp:176 Please consider updating the camera sensor properties database
[0:17:49.423837739] [1554] WARN RPI raspberrypi.cpp:1274 Mismatch between Unicam and CamHelper for embedded data usage!
[0:17:49.424491199] [1554] ERROR DelayedControls delayed_controls.cpp:87 Delay request for control id 0x009a090a but control is not exposed by device /dev/v4l-subdev0
[0:17:49.426388392] [1554] INFO RPI raspberrypi.cpp:1398 Registered camera /base/soc/i2c0mux/i2c@1/arducam_64mp@1a to Unicam device /dev/media3 and ISP device /dev/media0
[0:17:49.427448609] [1552] INFO Camera camera.cpp:1029 configuring streams: (0) 4624x3472-YUV420
[0:17:49.427914402] [1554] INFO RPI raspberrypi.cpp:763 Sensor: /base/soc/i2c0mux/i2c@1/arducam_64mp@1a - Selected sensor format: 4624x3472-SBGGR10_1X10 - Selected unicam format: 4624x3472-pBAA
[0:17:55.019481311] [1552] INFO Camera camera.cpp:1029 configuring streams: (0) 9152x6944-YUV420 (1) 9152x6944-SBGGR10_CSI2P
[0:17:55.039423461] [1554] INFO RPI raspberrypi.cpp:763 Sensor: /base/soc/i2c0mux/i2c@1/arducam_64mp@1a - Selected sensor format: 9152x6944-SBGGR10_1X10 - Selected unicam format: 9152x6944-pBAA
Still capture image received
Bayer format is BGGR-10
[0:18:37.203907737] [1567] INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3729-5f595cca
[0:18:37.207403791] [1569] WARN CameraSensorProperties camera_sensor_properties.cpp:174 No static properties available for ‘arducam_64mp’
[0:18:37.207454272] [1569] WARN CameraSensorProperties camera_sensor_properties.cpp:176 Please consider updating the camera sensor properties database
[0:18:37.237229959] [1569] WARN RPI raspberrypi.cpp:1274 Mismatch between Unicam and CamHelper for embedded data usage!
[0:18:37.237958807] [1569] ERROR DelayedControls delayed_controls.cpp:87 Delay request for control id 0x009a090a but control is not exposed by device /dev/v4l-subdev0
[0:18:37.238379082] [1569] INFO RPI raspberrypi.cpp:1398 Registered camera /base/soc/i2c0mux/i2c@1/arducam_64mp@1a to Unicam device /dev/media3 and ISP device /dev/media0
[0:18:37.239415039] [1567] INFO Camera camera.cpp:1029 configuring streams: (0) 4624x3472-YUV420
[0:18:37.240107461] [1569] INFO RPI raspberrypi.cpp:763 Sensor: /base/soc/i2c0mux/i2c@1/arducam_64mp@1a - Selected sensor format: 4624x3472-SBGGR10_1X10 - Selected unicam format: 4624x3472-pBAA
[0:18:42.787567238] [1567] INFO Camera camera.cpp:1029 configuring streams: (0) 9152x6944-YUV420 (1) 9152x6944-SBGGR10_CSI2P
[0:18:42.789894799] [1569] INFO RPI raspberrypi.cpp:763 Sensor: /base/soc/i2c0mux/i2c@1/arducam_64mp@1a - Selected sensor format: 9152x6944-SBGGR10_1X10 - Selected unicam format: 9152x6944-pBAA
Still capture image received
Bayer format is BGGR-10
[0:19:57.718518115] [1583] INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3729-5f595cca
[0:19:57.723332588] [1586] WARN CameraSensorProperties camera_sensor_properties.cpp:174 No static properties available for ‘arducam_64mp’
[0:19:57.723400735] [1586] WARN CameraSensorProperties camera_sensor_properties.cpp:176 Please consider updating the camera sensor properties database
[0:19:57.758172151] [1586] WARN RPI raspberrypi.cpp:1274 Mismatch between Unicam and CamHelper for embedded data usage!
[0:19:57.759209775] [1586] ERROR DelayedControls delayed_controls.cpp:87 Delay request for control id 0x009a090a but control is not exposed by device /dev/v4l-subdev0
[0:19:57.759579477] [1586] INFO RPI raspberrypi.cpp:1398 Registered camera /base/soc/i2c0mux/i2c@1/arducam_64mp@1a to Unicam device /dev/media3 and ISP device /dev/media0
[0:19:57.760740952] [1583] INFO Camera camera.cpp:1029 configuring streams: (0) 4624x3472-YUV420
[0:19:57.761407411] [1586] INFO RPI raspberrypi.cpp:763 Sensor: /base/soc/i2c0mux/i2c@1/arducam_64mp@1a - Selected sensor format: 4624x3472-SBGGR10_1X10 - Selected unicam format: 4624x3472-pBAA
[0:20:03.304766158] [1583] INFO Camera camera.cpp:1029 configuring streams: (0) 9152x6944-YUV420 (1) 9152x6944-SBGGR10_CSI2P
[0:20:03.323918125] [1586] INFO RPI raspberrypi.cpp:763 Sensor: /base/soc/i2c0mux/i2c@1/arducam_64mp@1a - Selected sensor format: 9152x6944-SBGGR10_1X10 - Selected unicam format: 9152x6944-pBAA
Still capture image received
Bayer format is BGGR-10
[0:22:22.196690431] [1606] INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3729-5f595cca
[0:22:22.200133838] [1608] WARN CameraSensorProperties camera_sensor_properties.cpp:174 No static properties available for ‘arducam_64mp’
[0:22:22.200176708] [1608] WARN CameraSensorProperties camera_sensor_properties.cpp:176 Please consider updating the camera sensor properties database
[0:22:22.223662815] [1608] WARN RPI raspberrypi.cpp:1274 Mismatch between Unicam and CamHelper for embedded data usage!
[0:22:22.224273664] [1608] ERROR DelayedControls delayed_controls.cpp:87 Delay request for control id 0x009a090a but control is not exposed by device /dev/v4l-subdev0
[0:22:22.224600329] [1608] INFO RPI raspberrypi.cpp:1398 Registered camera /base/soc/i2c0mux/i2c@1/arducam_64mp@1a to Unicam device /dev/media3 and ISP device /dev/media0
[0:22:22.225554545] [1606] INFO Camera camera.cpp:1029 configuring streams: (0) 4624x3472-YUV420
[0:22:22.226158431] [1608] INFO RPI raspberrypi.cpp:763 Sensor: /base/soc/i2c0mux/i2c@1/arducam_64mp@1a - Selected sensor format: 4624x3472-SBGGR10_1X10 - Selected unicam format: 4624x3472-pBAA
[0:22:27.798820096] [1606] INFO Camera camera.cpp:1029 configuring streams: (0) 9152x6944-YUV420 (1) 9152x6944-SBGGR10_CSI2P
[0:22:27.817379121] [1608] INFO RPI raspberrypi.cpp:763 Sensor: /base/soc/i2c0mux/i2c@1/arducam_64mp@1a - Selected sensor format: 9152x6944-SBGGR10_1X10 - Selected unicam format: 9152x6944-pBAA
[0:22:28.237925588] [1608] ERROR V4L2 v4l2_videodevice.cpp:1211 /dev/video0[14:cap]: Unable to request 1 buffers: Cannot allocate memory
[0:22:28.238052365] [1608] ERROR RPI raspberrypi.cpp:1023 Failed to allocate buffers
ERROR: *** failed to start camera ***

Hi, @itsskin

You need to set timeout in the command.

libcamera-still -t 10000 -r --nopreview --timestamp --denoise cdn_off --gain 0 --shutter 2000000

thank you! will give it a try. what is the reason for this?

This may be a bug, we need to check it.

-t 10000 and -t 15000 do not solve the problem. Still getting random crashes

1 Like

I am also seeing random failures to capture jpegs - with the failure to allocate a buffer. I’m on a 8GB Raspberry Pi 4 so there should be plenty of memory. I haven’t kept statistics, but it seems the frequency of random failures for jpegs depends on the display connected - a larger display 1920x1200 produces more failures than 1920x1080. The frequency seems to drop when the GPU memory is lowered to 40. That may be a coincidence – not tried anything systematic, but it just seems that there is something like a bug preventing the memory from being allocated. It may take 5 times of repeatedly trying to capture before it finally works, and at other times it works perfectly over and over.

Exactly same here. It’s statistics :slight_smile:

Hi, @itsskin

You could try testing just saving the image without setting the controls. Is it possible to save the image multiple times.

Same here. Seems only libcamera-jpeg is somewhat stable. Any use of libcamera-still with keypress and other options throws random errors.

Model:

  • RPI 4 4GB
  • Latest debian bullseye
  • Proc/meminfo
MemTotal:        3885548 kB
MemFree:         2010584 kB
MemAvailable:    2581564 kB
Buffers:           41172 kB
Cached:           808168 kB
SwapCached:            0 kB
Active:           302120 kB
Inactive:        1194280 kB
Active(anon):       1652 kB
Inactive(anon):   886912 kB
Active(file):     300468 kB
Inactive(file):   307368 kB
Unevictable:      182352 kB
Mlocked:              16 kB
SwapTotal:        102396 kB
SwapFree:         102396 kB
Dirty:               108 kB
Writeback:             0 kB
AnonPages:        829556 kB
Mapped:           316152 kB
Shmem:            241504 kB
KReclaimable:      39780 kB
Slab:              80032 kB
SReclaimable:      39780 kB
SUnreclaim:        40252 kB
KernelStack:        6784 kB
PageTables:        17604 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     2045168 kB
Committed_AS:    4355092 kB
VmallocTotal:   259653632 kB
VmallocUsed:       13936 kB
VmallocChunk:          0 kB
Percpu:              688 kB
CmaTotal:         524288 kB
CmaFree:          452048 kB

Boot/config.txt:

# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

# Automatically load overlays for detected cameras
camera_auto_detect=1

# Automatically load overlays for detected DSI displays
display_auto_detect=1

# Enable DRM VC4 V3D driver
dtoverlay=vc4-kms-v3d
max_framebuffers=2

# Run in 64-bit mode
arm_64bit=1

# Disable compensation for displays with overscan
disable_overscan=1

[cm4]
# Enable host mode on the 2711 built-in XHCI USB controller.
# This line should be removed if the legacy DWC2 controller is required
# (e.g. for USB device mode) or if USB support is not required.
otg_mode=1

[all]

[pi4]
# Run as fast as firmware / board allows
arm_boost=1

[all]
dtoverlay=arducam_64mp
dtoverlay=vc4-kms-v3d,cma-512

Command:

libcamera-still -t 0 --viewfinder-width 2312 --viewfinder-height 1736  -k -o test.jpg

Dump:

[0:32:34.123619396] [2642]  INFO Camera camera.cpp:1029 configuring streams: (0) 9152x6944-YUV420 (1) 9152x6944-SBGGR10_CSI2P
[0:32:34.124979470] [2644]  INFO RPI raspberrypi.cpp:764 Sensor: /base/soc/i2c0mux/i2c@1/arducam_64mp@1a - Selected sensor format: 9152x6944-SBGGR10_1X10 - Selected unicam format: 9152x6944-pBAA
[0:32:34.431115404] [2644] ERROR V4L2 v4l2_videodevice.cpp:1211 /dev/video0[18:cap]: Unable to request 1 buffers: Cannot allocate memory
[0:32:34.431321308] [2644] ERROR RPI raspberrypi.cpp:1012 Failed to allocate buffers
ERROR: *** failed to start camera ***

I’m experiencing the same issue. Did this ever get solved?

Hi, @AnotherDredd

Sorry to reply you so late.

After allocating 512M memory, the buffer allocation error still occurs when saving the maximum resolution image. We are consulting the Raspberry Pi official, once there is a new solution, we will notify you in time.

1 Like

What’s the ETA?

Camera is unstable and unusable in this state.

Not what you want to hear but you can lower the resolution.
libcamera-still -t 5000 -n --width 600 --height 400 -o image.jpg

I bought this camera for 64MP dng output. Lovering is not an option.

1 Like

SupportTeam, any news?

@yang Any news?

This is a very dissapointing issue, makes the 64mp camera useless, and honestly, makes me reasonably doubt to invest in higher spec cameras of the Pivariety branch.

Q&A should have been testing the camera with RPI models thorouhgly, as was just a plug and test error on my first day with the camera.

Lowering resolutions of RPI is a poor paliative for using it, not a solution.
Makes any test for discrete application just worthless.

Should need at least tested solutions to use the camera outside RPI enviroment, like an USB or PCI adapter **that supports the 64MP/108MP+ **, has full control, and lossless compression.

Hoping to see further progress, and thanks for your effort.

1 Like

@AnotherDredd

Please take a look at the other link first

Thanks I will check it out.

Seems no real solution. There’s a memory leak that makes it fail after half a dozen captures.