-
Where did you get the camera module(s)?
-
Model number of the product(s)?
https://ca.robotshop.com/products/arducam-64mp-camera-pan-tilt-kit -
What hardware/platform were you working on?
Raspberry Pi 4 - 8gb (Raspberry Pi reference 2023-05-03) -
Instructions you have followed. (link/manual/etc.)
How to use arducam_64mp & arducam_64mp FAQ -
Problems you were having?
libcamera apps work fine but python’s picamera2 fails for full resolution snaps
$ libcamera-still -n -t 30000 -o test.jpg # works fine, captures with full resolution
# https://github.com/ArduCAM/picamera2_examples/blob/main/64mpSavePng.py
$ python3 64mpSavePng.py
[0:28:40.696614330] [2500] ERROR V4L2 v4l2_videodevice.cpp:1241 /dev/video0[25:cap]: Unable to request 1 buffers: Cannot allocate memory
[0:28:40.696768330] [2500] ERROR RPI pipeline_base.cpp:681 Failed to allocate buffers
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-8-9ff3e5cf19dc> in <module>
----> 1 pc.start()
/usr/lib/python3/dist-packages/picamera2/picamera2.py in start(self, config, show_preview)
1053 if show_preview is not None and not self._event_loop_running:
1054 self.start_preview(show_preview)
-> 1055 self.start_()
1056
1057 def stop_(self, request=None) -> None:
/usr/lib/python3/dist-packages/picamera2/picamera2.py in start_(self)
1021 self.controls = Controls(self)
1022 # camera.start() now throws an error if it fails.
-> 1023 self.camera.start(controls)
1024 for request in self._make_requests():
1025 self.camera.queue_request(request)
RuntimeError: Failed to start camera: Cannot allocate memory
after fresh install and following arducam driver install instructions:
cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
$ cat /boot/cmdline.txt
console=serial0,115200 console=tty1 root=PARTUUID=06ae9812-02 rootfstype=ext4 fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles cma=512M
$ cat /boot/config.txt
...
# Enable DRM VC4 V3D driver
dtoverlay=vc4-kms-v3d,cma-512
max_framebuffers=2
[all]
gpu_mem=128
dtoverlay=arducam-64mp
$ cat /proc/meminfo
...
CmaTotal: 524288 kB
CmaFree: 483596 k
$ xranrd
Screen 0: minimum 320 x 200, current 1280 x 720, maximum 7680 x 7680
$ dpkg -l | grep libcamera
ii libcamera-apps 1.2.1-1 arm64 libcamera-apps
ii libcamera-dev:arm64 0~git20230724+ad9428b4-1 arm64 complex camera support library (development files)
ii libcamera-tools 0~git20230720+bde9b04f-1 arm64 complex camera support library (tools)
ii libcamera0:arm64 0~git20230724+ad9428b4-1 arm64 complex camera support library
ii python3-libcamera 0~git20230720+bde9b04f-1 arm64 complex camera support library (Python 3 bindings)
$ dpkg -l | grep picamera2
ii python3-picamera2 0.3.12-2 all Libcamera based python library
- The dmesg log from your hardware?
$ dmesg
[ 71.221577] cma: cma_alloc: reserved: alloc failed, req-size: 19422 pages, ret: -12
[ 71.221616] ------------[ cut here ]------------
[ 71.221619] WARNING: CPU: 0 PID: 1561 at mm/page_alloc.c:5556 __alloc_pages+0x274/0x318
[ 71.221632] Modules linked in: rfcomm cmac algif_hash aes_arm64 aes_generic algif_skcipher af_alg bnep hci_uart btbcm bluetooth ecdh_generic ecc libaes 8021q garp stp llc arducam_64mp(O) dw9807_vcm joydev brcmfmac brcmutil vc4 v3d snd_soc_hdmi_codec cfg80211 drm_display_helper gpu_sched drm_shmem_helper cec rfkill drm_dma_helper bcm2835_v4l2(C) drm_kms_helper bcm2835_unicam bcm2835_codec(C) raspberrypi_hwmon rpivid_hevc(C) videobuf2_vmalloc v4l2_dv_timings i2c_mux_pinctrl v4l2_fwnode bcm2835_isp(C) v4l2_mem2mem i2c_mux bcm2835_mmal_vchiq(C) v4l2_async videobuf2_dma_contig videobuf2_memops videobuf2_v4l2 videobuf2_common i2c_brcmstb snd_soc_core videodev i2c_bcm2835 vc_sm_cma(C) snd_bcm2835(C) mc snd_compress snd_pcm_dmaengine snd_pcm snd_timer snd syscopyarea sysfillrect sysimgblt fb_sys_fops uio_pdrv_genirq nvmem_rmem uio drm i2c_dev fuse drm_panel_orientation_quirks backlight ip_tables x_tables ipv6
[ 71.221775] CPU: 0 PID: 1561 Comm: ipython3 Tainted: G C O 6.1.21-v8+ #1642
[ 71.221780] Hardware name: Raspberry Pi 4 Model B Rev 1.5 (DT)
[ 71.221784] pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 71.221788] pc : __alloc_pages+0x274/0x318
[ 71.221792] lr : __dma_direct_alloc_pages.isra.31+0x168/0x1b0
[ 71.221799] sp : ffffffc0094bb860
[ 71.221801] x29: ffffffc0094bb860 x28: ffffff8122d54460 x27: ffffff8106a0a538
[ 71.221809] x26: 0000000000000001 x25: 000000000000000f x24: 0000000000000000
[ 71.221816] x23: 0000000000000000 x22: 0000000000000cc1 x21: ffffffe923ead858
[ 71.221823] x20: ffffff8100247010 x19: ffffffe923ead858 x18: 0000000000000001
[ 71.221830] x17: 72202c7365676170 x16: 203232343931203a x15: 657a69732d716572
[ 71.221837] x14: 202c64656c696166 x13: 32312d203a746572 x12: ffffffe9243e73b0
[ 71.221844] x11: 0000000000000003 x10: 0000000000000001 x9 : ffffffe92311bee8
[ 71.221850] x8 : 0000000000017fe8 x7 : c0000000ffffefff x6 : ffffff81fef87950
[ 71.221857] x5 : 0000000000000001 x4 : 000000000000003f x3 : 0000000000000000
[ 71.221872] x2 : 0000000000000000 x1 : 0000000000000001 x0 : ffffffe924528925
[ 71.221890] Call trace:
[ 71.221902] __alloc_pages+0x274/0x318
[ 71.221906] __dma_direct_alloc_pages.isra.31+0x168/0x1b0
[ 71.221911] dma_direct_alloc+0x104/0x318
[ 71.221915] dma_alloc_attrs+0xac/0xc0
[ 71.221919] vb2_dc_alloc+0xa8/0x180 [videobuf2_dma_contig]
[ 71.221931] __vb2_queue_alloc+0x238/0x4a0 [videobuf2_common]
[ 71.221951] vb2_core_reqbufs+0x280/0x4e8 [videobuf2_common]
[ 71.221965] vb2_ioctl_reqbufs+0xc0/0x100 [videobuf2_v4l2]
[ 71.221978] v4l_reqbufs+0x58/0x70 [videodev]
[ 71.222028] __video_do_ioctl+0x184/0x3d8 [videodev]
[ 71.222057] video_usercopy+0x2d8/0x740 [videodev]
[ 71.222085] video_ioctl2+0x20/0x38 [videodev]
[ 71.222114] v4l2_ioctl+0x48/0x68 [videodev]
[ 71.222143] __arm64_sys_ioctl+0xb0/0xf0
[ 71.222149] invoke_syscall+0x4c/0x110
[ 71.222156] el0_svc_common.constprop.3+0xfc/0x120
[ 71.222161] do_el0_svc+0x34/0xd0
[ 71.222166] el0_svc+0x30/0x88
[ 71.222172] el0t_64_sync_handler+0x98/0xc0
[ 71.222177] el0t_64_sync+0x18c/0x190
[ 71.222182] ---[ end trace 0000000000000000 ]---
[ 71.222189] unicam fe801000.csi: dma alloc of size 79552512 failed
[ 113.298149] cma: cma_alloc: reserved: alloc failed, req-size: 19422 pages, ret: -12
[ 113.298176] unicam fe801000.csi: dma alloc of size 79552512 failed
[ 202.351940] cma: cma_alloc: reserved: alloc failed, req-size: 19422 pages, ret: -12
[ 202.351967] unicam fe801000.csi: dma alloc of size 79552512 failed
[ 226.782373] v3d fec00000.v3d: MMU error from client CLE (4) at 0x26a1000, pte invalid
[ 340.071354] cma: cma_alloc: reserved: alloc failed, req-size: 19422 pages, ret: -12
[ 340.071380] unicam fe801000.csi: dma alloc of size 79552512 failed
[ 644.016874] cma: cma_alloc: reserved: alloc failed, req-size: 19422 pages, ret: -12
[ 644.016902] unicam fe801000.csi: dma alloc of size 79552512 failed
[ 1720.681640] cma: cma_alloc: reserved: alloc failed, req-size: 19422 pages, ret: -12
[ 1720.681693] unicam fe801000.csi: dma alloc of size 79552512 failed
Please let me know if anything further is required.
My goal is to capture a full resolution image with picamera2 which is failing with an error now (while libcamera-still app works fine)