64MP with RPI 4b, Rev 1.4, failed to allocate capture buffers

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

    Ordered from arducam website
    
  2. Model number of the product(s)?

    [email protected]
    
  3. What hardware/platform were you working on?

     Raspberry Pi 4 Model B Rev 1.4
    
  4. Instructions you have followed. (link/manual/etc.)

    arducam_64mp_pi_camera_manual.pdf

4.5 System info

[email protected]:~ $ cat /etc/os-release
PRETTY_NAME=“Raspbian GNU/Linux 11 (bullseye)”
NAME=“Raspbian GNU/Linux”
VERSION_ID=“11”
VERSION=“11 (bullseye)”
VERSION_CODENAME=bullseye
ID=raspbian
ID_LIKE=debian

[email protected]:~ $ cat /proc/meminfo
MemTotal: 8132760 kB
MemFree: 6184972 kB
MemAvailable: 6588068 kB
Buffers: 29976 kB
Cached: 1142972 kB
SwapCached: 0 kB
Active: 157824 kB
Inactive: 1069780 kB
Active(anon): 1424 kB
Inactive(anon): 610816 kB
Active(file): 156400 kB
Inactive(file): 458964 kB
Unevictable: 485364 kB
Mlocked: 16 kB
HighTotal: 7503872 kB
HighFree: 5768516 kB
LowTotal: 628888 kB
LowFree: 416456 kB
SwapTotal: 102396 kB
SwapFree: 102396 kB
Dirty: 368 kB
Writeback: 0 kB
AnonPages: 540020 kB
Mapped: 402068 kB
Shmem: 557584 kB
KReclaimable: 19736 kB
Slab: 46268 kB
SReclaimable: 19736 kB
SUnreclaim: 26532 kB
KernelStack: 3048 kB
PageTables: 15700 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 4168776 kB
Committed_AS: 4170168 kB
VmallocTotal: 245760 kB
VmallocUsed: 6112 kB
VmallocChunk: 0 kB
Percpu: 448 kB
CmaTotal: 524288 kB
CmaFree: 387040 kB

[email protected]:~ $ cat /boot/config.txt

For more options and information see

Raspberry Pi Documentation - Configuration

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

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
dtoverlay=vc4-kms-v3d,cma-512

[all]
dtoverlay=imx519
dtoverlay=arducam_64mp
gpu_mem=32

  1. Problems you were having?

[email protected]:~ $ libcamera-still --timestamp
Made X/EGL preview window
[0:06:53.187749056] [1786] INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3572-e13ccdd5
[0:06:53.194168918] [1788] WARN CameraSensorProperties camera_sensor_properties.cpp:163 No static properties available for ‘arducam_64mp’
[0:06:53.194273084] [1788] WARN CameraSensorProperties camera_sensor_properties.cpp:165 Please consider updating the camera sensor properties database
[0:06:53.194691528] [1788] ERROR CameraSensor camera_sensor.cpp:591 ‘arducam_64mp 10-001a’: Camera sensor does not support test pattern modes.
[0:06:53.225667930] [1788] WARN RPI raspberrypi.cpp:1263 Mismatch between Unicam and CamHelper for embedded data usage!
[0:06:53.226438132] [1788] ERROR DelayedControls delayed_controls.cpp:87 Delay request for control id 0x009a090a but control is not exposed by device /dev/v4l-subdev0
[0:06:53.226751613] [1788] INFO RPI raspberrypi.cpp:1386 Registered camera /base/soc/i2c0mux/[email protected]/[email protected] to Unicam device /dev/media3 and ISP device /dev/media0
[0:06:53.227570334] [1786] INFO Camera camera.cpp:1029 configuring streams: (0) 4096x3074-YUV420
[0:06:53.228063537] [1788] INFO RPI raspberrypi.cpp:764 Sensor: /base/soc/i2c0mux/[email protected]/[email protected] - Selected sensor format: 4624x3472-SBGGR10_1X10 - Selected unicam format: 4624x3472-pBAA
[0:06:58.781821948] [1786] INFO Camera camera.cpp:1029 configuring streams: (0) 9152x6944-YUV420 (1) 9152x6944-SBGGR10_CSI2P
[0:06:58.794691912] [1788] INFO RPI raspberrypi.cpp:764 Sensor: /base/soc/i2c0mux/[email protected]/[email protected] - Selected sensor format: 9152x6944-SBGGR10_1X10 - Selected unicam format: 9152x6944-pBAA
[0:06:59.056315610] [1788] ERROR V4L2 v4l2_videodevice.cpp:1211 /dev/video0[18:cap]: Unable to request 1 buffers: Cannot allocate memory
ERROR: *** failed to allocate capture buffers ***

  1. The dmesg log from your hardware?

[ 419.024503] cma: cma_alloc: linux,cma: alloc failed, req-size: 19422 pages, ret: -12
[ 419.024520] unicam fe801000.csi: dma_alloc_coherent of size 79552512 failed

  1. Troubleshooting attempts you’ve made?

  2. What help do you need?

Please fix.

@lefsky I’m sorry you have this problem with your device, we see that there seems to be some problem with the information format you gave, please give the complete config.txt information again.

cat /boot/config.txt

Then we’ll test it soon.

Here is the new version:

[email protected]:~ $ cat /boot/config.txt

For more options and information see

Raspberry Pi Documentation - Configuration

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
dtoverlay=vc4-kms-v3d,cma-512

[all]
dtoverlay=arducam_64mp

@lefsky
We need some more detailed information,

camera-bug-report -t 5 -o bug.txt -c "libcamera-still -t 1000 -o test.jpg"

it will generate a bug.txt file, please put the information in the code block reply, otherwise there will be unnecessary problems with the display.

The bug.txt file is too large to put into the body of this email. Here is the stdout output

[email protected]:~ $ camera-bug-report -t 5 -o bug.txt -c "libcamera-still -t 1000 -o test.jpg"
Made X/EGL preview window
[12:00:54.210757469] [7305]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3572-e13ccdd5
[12:00:54.218821997] [7307]  WARN CameraSensorProperties camera_sensor_properties.cpp:163 No static properties available for 'arducam_64mp'
[12:00:54.218893738] [7307]  WARN CameraSensorProperties camera_sensor_properties.cpp:165 Please consider updating the camera sensor properties database
[12:00:54.219364828] [7307] ERROR CameraSensor camera_sensor.cpp:591 'arducam_64mp 10-001a': Camera sensor does not support test pattern modes.
[12:00:54.264439792] [7307]  WARN RPI raspberrypi.cpp:1263 Mismatch between Unicam and CamHelper for embedded data usage!
[12:00:54.265415509] [7307] ERROR DelayedControls delayed_controls.cpp:87 Delay request for control id 0x009a090a but control is not exposed by device /dev/v4l-subdev0
[12:00:54.265714470] [7307]  INFO RPI raspberrypi.cpp:1386 Registered camera /base/soc/i2c0mux/[email protected]/[email protected] to Unicam device /dev/media2 and ISP device /dev/media0
[12:00:54.266512447] [7305]  INFO Camera camera.cpp:1029 configuring streams: (0) 4096x3074-YUV420
[12:00:54.267035426] [7307]  INFO RPI raspberrypi.cpp:764 Sensor: /base/soc/i2c0mux/[email protected]/[email protected] - Selected sensor format: 4624x3472-SBGGR10_1X10 - Selected unicam format: 4624x3472-pBAA
[12:00:54.355162107] [7307] ERROR V4L2 v4l2_videodevice.cpp:1211 /dev/video0[18:cap]: Unable to request 4 buffers: Cannot allocate memory
[12:00:54.355236218] [7307] ERROR RPI raspberrypi.cpp:1012 Failed to allocate buffers
ERROR: *** failed to start camera ***

Bug report generated to bug.txt
Please upload this file when you create a new bug report at:
https://github.com/raspberrypi/libcamera-apps/issues/

A link to the bug.txt file
[rpi4_64mp_bug.txt - Google Docs]
(rpi4_64mp_bug.txt - Google Docs)

I found that the camera will work with a GPU ram allocation of 40 Mb, but not with less than that, or with 76Mb.

@lefsky
You can try to modify your config.txt

sudo vi /boot/config.txt

dtoverlay=vc4-kms-v3d,cma-256 become dtoverlay=vc4-kms-v3d,cma-512
Restart after changing and try again

I was using cma-512 already. And it was the GPU memory change that did it for me.

I’m running into same issue with “Failed to allocate buffers” what exact change did solve your issue? Is it setting GPU allocation through raspi-config?

Same issue, any solution? I also updated cmdline.txt with cma=400, tried to assign 128 to GPU, same error.

@nack
please give me some detail

cat /proc/cpuinfo
cat /etc/os-release
cat /boot/config.txt

cat /proc/cpuinfo
processor : 0
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 324.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3

processor : 1
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 324.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3

processor : 2
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 324.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3

processor : 3
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 324.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3

Hardware : BCM2711
Revision : d03114
Serial : 10000000e4273f4b
Model : Raspberry Pi 4 Model B Rev 1.4

cat /etc/os-release
PRETTY_NAME=“Raspbian GNU/Linux 11 (bullseye)”
NAME=“Raspbian GNU/Linux”
VERSION_ID=“11”
VERSION=“11 (bullseye)”
VERSION_CODENAME=bullseye
ID=raspbian
ID_LIKE=debian
HOME_URL=“http://www.raspbian.org/
SUPPORT_URL=“RaspbianForums - Raspbian
BUG_REPORT_URL=“RaspbianBugs - Raspbian

cat /boot/config.txt

For more options and information see

Raspberry Pi Documentation - Configuration

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

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]
dtoverlay=vc4-kms-v3d,cma-512

[pi4]

Run as fast as firmware / board allows

arm_boost=1

[all]
dtoverlay=arducam_64mp

Okey,I see nothing wrong with your configuration information.

We can’t reproduce your problem, everything seems to be fine with us. I have some suggestions here:

  1. cat /proc/meminfo CmaTotal and CmaFree should be around 500000kB
  2. Retry a few times, because sometimes it doesn’t work well
  3. Reduce the resolution to ensure that the camera is OK

If you still have problems, send me the following information
dmesg

CmaTotal: 524288 kB
CmaFree: 351144 kB

Reduce screen resolution to 600x800, now it works.

CmaTotal: 524288 kB
CmaFree: 484732 kB

@nack
ok, did you lower the resolution of the monitor?
Someone has also reduced the resolution of the screen before, I think this is a solution that can temporarily solve this problem

@nack
Is the maximum resolution available now?