Speed of Quad 4 HAT 64 MP Autofocus

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

  2. Model number of the product(s)?
    UC-512

  3. What hardware/platform were you working on?
    RPi4

  4. Instructions you have followed. (link/manual/etc.)
    64MP Autofocus Quad Camera Kit Manual (arducam.com)

  5. Problems you were having?
    Speed of capture

  6. The dmesg log from your hardware?
    [ 551.036341] WARNING: CPU: 3 PID: 889 at mm/page_alloc.c:5380 __alloc_pages+0x2d0/0x330
    [ 551.036357] Modules linked in: cmac algif_hash aes_arm64 algif_skcipher af_alg bnep hci_uart btbcm bluetooth ecdh_generic ecc 8021q garp stp llc arducam_64mp(O) dw9807_vcm(O) snd_soc_hdmi_codec vc4 cec brcmfmac brcmutil drm_kms_helper raspberrypi_hwmon snd_soc_core bcm2835_unicam cfg80211 bcm2835_isp(C) bcm2835_codec(C) bcm2835_v4l2(C) v4l2_dv_timings snd_compress v3d v4l2_fwnode v4l2_mem2mem bcm2835_mmal_vchiq(C) snd_bcm2835(C) v4l2_async videobuf2_vmalloc i2c_mux_pinctrl videobuf2_dma_contig rfkill i2c_mux snd_pcm_dmaengine videobuf2_memops i2c_brcmstb gpu_sched videobuf2_v4l2 snd_pcm vc_sm_cma(C) videobuf2_common videodev snd_timer mc i2c_bcm2835 snd rpivid_mem syscopyarea nvmem_rmem sysfillrect sysimgblt fb_sys_fops uio_pdrv_genirq uio i2c_dev drm drm_panel_orientation_quirks fuse backlight ip_tables x_tables ipv6
    [ 551.036507] CPU: 3 PID: 889 Comm: libcamera-still Tainted: G C O 5.15.32-v8+ #1538
    [ 551.036514] Hardware name: Raspberry Pi 4 Model B Rev 1.2 (DT)
    [ 551.036518] pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=–)
    [ 551.036524] pc : __alloc_pages+0x2d0/0x330
    [ 551.036530] lr : __dma_direct_alloc_pages+0x168/0x1b0
    [ 551.036537] sp : ffffffc00a1ab880
    [ 551.036540] x29: ffffffc00a1ab880 x28: ffffff8043f07c60 x27: ffffffc00a1abb58
    [ 551.036549] x26: 0000000000000001 x25: ffffffc008115144 x24: 0000000000000000
    [ 551.036558] x23: 0000000004bde000 x22: 0000000000000cc1 x21: ffffffc008e8a9c8
    [ 551.036566] x20: ffffff80401dd010 x19: ffffffc008e8a9c8 x18: 0000000000000001
    [ 551.036574] x17: 202c736567617020 x16: 3232343931203a65 x15: 7a69732d71657220
    [ 551.036582] x14: 2c64656c69616620 x13: 32312d203a746572 x12: ffffffc0093a6670
    [ 551.036589] x11: 0000000000000003 x10: ffffffc00938e630 x9 : ffffffc008115788
    [ 551.036597] x8 : 0000000000017fe8 x7 : c0000000ffffefff x6 : ffffff80f7be6908
    [ 551.036605] x5 : 0000000000000001 x4 : 000000000000003f x3 : 0000000000000000
    [ 551.036613] x2 : 0000000000000000 x1 : 000000000000000f x0 : 0000000000000cc1
    [ 551.036621] Call trace:
    [ 551.036623] __alloc_pages+0x2d0/0x330
    [ 551.036629] __dma_direct_alloc_pages+0x168/0x1b0
    [ 551.036635] dma_direct_alloc+0x7c/0x330
    [ 551.036639] dma_alloc_attrs+0xac/0xc0
    [ 551.036644] vb2_dc_alloc+0x70/0x130 [videobuf2_dma_contig]
    [ 551.036656] __vb2_queue_alloc+0x220/0x488 [videobuf2_common]
    [ 551.036672] vb2_core_reqbufs+0x288/0x480 [videobuf2_common]
    [ 551.036685] vb2_ioctl_reqbufs+0x8c/0xc8 [videobuf2_v4l2]
    [ 551.036696] v4l_reqbufs+0x54/0x68 [videodev]
    [ 551.036734] __video_do_ioctl+0x188/0x410 [videodev]
    [ 551.036764] video_usercopy+0x310/0x7d0 [videodev]
    [ 551.036793] video_ioctl2+0x20/0x38 [videodev]
    [ 551.036823] v4l2_ioctl+0x48/0x68 [videodev]
    [ 551.036852] __arm64_sys_ioctl+0xb0/0xf0
    [ 551.036859] invoke_syscall+0x4c/0x110
    [ 551.036866] el0_svc_common.constprop.3+0xfc/0x120
    [ 551.036871] do_el0_svc+0x2c/0x90
    [ 551.036876] el0_svc+0x24/0x60
    [ 551.036882] el0t_64_sync_handler+0x90/0xb8
    [ 551.036888] el0t_64_sync+0x1a0/0x1a4
    [ 551.036893] —[ end trace b45d08f601eb9235 ]—
    [ 551.036900] unicam fe801000.csi: dma_alloc_coherent of size 79552512 failed

  7. Troubleshooting attempts you’ve made?
    Tested different time

  8. What help do you need?

I’ve just got the 4 * 64MP autofocus module and set it up. I’ve been testing capturing at different viewfinder resolutions and timing how long it takes without writing the image to the filsystem using:

time libcamera-still -e yuv420 --viewfinder-width 4624 --viewfinder-height 3472

I’ve tested this all the way down to 1280x720 and all captures give a similar time result:

pi@fourcampi:~ $ time libcamera-still -e yuv420 --viewfinder-width 4624 --viewfinder-height 3472
Preview window unavailable
[0:15:02.500669193] [936]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3572-e13ccdd5
[0:15:02.513532953] [937]  WARN CameraSensorProperties camera_sensor_properties.cpp:163 No static properties available for 'arducam_64mp'
[0:15:02.513710804] [937]  WARN CameraSensorProperties camera_sensor_properties.cpp:165 Please consider updating the camera sensor properties database
[0:15:02.514600296] [937] ERROR CameraSensor camera_sensor.cpp:591 'arducam_64mp 10-001a': Camera sensor does not support test pattern modes.
[0:15:02.557602595] [937]  WARN RPI raspberrypi.cpp:1263 Mismatch between Unicam and CamHelper for embedded data usage!
[0:15:02.558297015] [937] ERROR DelayedControls delayed_controls.cpp:87 Delay request for control id 0x009a090a but control is not exposed by device /dev/v4l-subdev0
[0:15:02.558540365] [937]  INFO RPI raspberrypi.cpp:1386 Registered camera /base/soc/i2c0mux/i2c@1/arducam_64mp@1a to Unicam device /dev/media0 and ISP device /dev/media3
[0:15:02.559304728] [936]  INFO Camera camera.cpp:1029 configuring streams: (0) 4624x3472-YUV420
[0:15:02.559718762] [937]  INFO RPI raspberrypi.cpp:764 Sensor: /base/soc/i2c0mux/i2c@1/arducam_64mp@1a - Selected sensor format: 4624x3472-SBGGR10_1X10 - Selected unicam format: 4624x3472-pBAA

real    0m5.618s
user    0m0.116s
sys     0m0.142s

It seems to always take ~5.5 seconds which is a bit too slow. Is there anything I can do to speed this up; I’ve tried with jpeg, yuv420 and raw but all seem to be 5.5 seconds. The device is great but the capture speed is too slow for my application. Can I do anything to speed it up?

Cheers,

Neil

I second this, I would like to know if there is anyway to accelerate capture times or perhaps even take a burst at highest/high resolution