Speed of capture on 4*64mp board

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

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

  3. What hardware/platform were you working on?
    RPi 4 w/ Raspberry Pi OS

  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.036337] ------------[ cut here ]------------
[  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
  1. Troubleshooting attempts you’ve made?
    Read manuals and changed resolution
  2. What help do you need?

I’ve got the 4 * 6MP autofocus and compiled it and everything is working fine. I can execute to get the image however it is quite slow. The output from a time command is below:

pi@fourcampi:~ $ time libcamera-still -n --viewfinder-width 2312 --viewfinder-height 1736
[43:24:44.179766890] [3078]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3572-e13ccdd5
[43:24:44.189743458] [3079]  WARN CameraSensorProperties camera_sensor_properties.cpp:163 No static properties available for 'arducam_64mp'
[43:24:44.189825031] [3079]  WARN CameraSensorProperties camera_sensor_properties.cpp:165 Please consider updating the camera sensor properties database
[43:24:44.190445134] [3079] ERROR CameraSensor camera_sensor.cpp:591 'arducam_64mp 10-001a': Camera sensor does not support test pattern modes.
[43:24:44.231074619] [3079]  WARN RPI raspberrypi.cpp:1263 Mismatch between Unicam and CamHelper for embedded data usage!
[43:24:44.232156752] [3079] ERROR DelayedControls delayed_controls.cpp:87 Delay request for control id 0x009a090a but control is not exposed by device /dev/v4l-subdev0
[43:24:44.232487600] [3079]  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
[43:24:44.233734860] [3078]  INFO Camera camera.cpp:1029 configuring streams: (0) 2312x1736-YUV420
[43:24:44.234426462] [3079]  INFO RPI raspberrypi.cpp:764 Sensor: /base/soc/i2c0mux/i2c@1/arducam_64mp@1a - Selected sensor format: 2312x1736-SBGGR10_1X10 - Selected unicam format: 2312x1736-pBAA

real    0m5.494s
user    0m0.162s
sys     0m0.127s

It seems to be a consistent ~5.5 seconds regardless of the resolution; note that I’m not writing the image to disk. I’m trying to understand where the time is taken up here; is it transferring the image to the RPi from the quad HAT or is it the Quad HAT? When running for real I’ll just be setting the camera up once and then leaving it open - would that be quicker? I’m looking for a capture rate of ~1 second, is that realistic from this device?

Thanks for your help - the device itself is great; I just need a bit more speed on the capture.

Cheers,

Neil

Hi,
Due to the RPI CSI interface data bandwidth limit. the sensor’s source framerate is very slow in order to make sure the CSI controller can receive normally. But the 5s is too long. I want to know how do you measure the time? Which command you are using?

Hello,

At first I just used a stop watch but as you can see above I used the bash ‘time’ command. Note that I’m not running libcamera-vid but using libcamera-still.

Cheers,

Neil

Hi,
It seems if you have not set the -t parameter, the default time is 5s, Have you tried to add -t 1000 to retry?

Hello,

Please accept my apologies on this; I’ve been pulled to another project but I’m back on this now. Please see the results of the tests below:

pi@camhat:~ $ time libcamera-still --nopreview -t 5000 --viewfinder-width 2312 --viewfinder-height 1736 -o pi_hawk_eye.jpg
[0:46:33.860652183] [843]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3729-5f595cca
[0:46:33.866828042] [845]  WARN CameraSensorProperties camera_sensor_properties.cpp:174 No static properties available for 'arducam_64mp'
[0:46:33.866921301] [845]  WARN CameraSensorProperties camera_sensor_properties.cpp:176 Please consider updating the camera sensor properties database
Open i2c bus error: No such file or directory
[0:46:33.884256114] [845]  WARN RPI raspberrypi.cpp:1274 Mismatch between Unicam and CamHelper for embedded data usage!
[0:46:33.884822219] [845] ERROR DelayedControls delayed_controls.cpp:87 Delay request for control id 0x009a090a but control is not exposed by device /dev/v4l-subdev0
[0:46:33.885038142] [845]  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:46:33.885765745] [843]  INFO Camera camera.cpp:1029 configuring streams: (0) 2312x1736-YUV420
[0:46:33.886163278] [845]  INFO RPI raspberrypi.cpp:763 Sensor: /base/soc/i2c0mux/i2c@1/arducam_64mp@1a - Selected sensor format: 2312x1736-SBGGR10_1X10 - Selected unicam format: 2312x1736-pBAA
[0:46:39.258146779] [843]  INFO Camera camera.cpp:1029 configuring streams: (0) 9152x6944-YUV420 (1) 9152x6944-SBGGR10_CSI2P
[0:46:39.269348547] [845]  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:46:42.579948690] [845]  WARN V4L2 v4l2_videodevice.cpp:1780 /dev/video0[14:cap]: Zero sequence expected for first frame (got 1)
Still capture image received

real    0m15.503s
user    0m1.427s

So we have 15 seconds to capture, trying again with 1 second:

pi@camhat:~ $ time libcamera-still --nopreview -t 1000 --viewfinder-width 2312 --viewfinder-height 1736 -o pi_hawk_eye.jpg
[0:50:01.978116321] [858]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3729-5f595cca
[0:50:01.984625917] [860]  WARN CameraSensorProperties camera_sensor_properties.cpp:174 No static properties available for 'arducam_64mp'
[0:50:01.984719304] [860]  WARN CameraSensorProperties camera_sensor_properties.cpp:176 Please consider updating the camera sensor properties database
Open i2c bus error: No such file or directory
[0:50:02.002033733] [860]  WARN RPI raspberrypi.cpp:1274 Mismatch between Unicam and CamHelper for embedded data usage!
[0:50:02.002597651] [860] ERROR DelayedControls delayed_controls.cpp:87 Delay request for control id 0x009a090a but control is not exposed by device /dev/v4l-subdev0
[0:50:02.002813352] [860]  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:50:02.003575545] [858]  INFO Camera camera.cpp:1029 configuring streams: (0) 2312x1736-YUV420
[0:50:02.004042039] [860]  INFO RPI raspberrypi.cpp:763 Sensor: /base/soc/i2c0mux/i2c@1/arducam_64mp@1a - Selected sensor format: 2312x1736-SBGGR10_1X10 - Selected unicam format: 2312x1736-pBAA
[0:50:02.598026157] [860]  WARN V4L2 v4l2_videodevice.cpp:1780 /dev/video0[14:cap]: Zero sequence expected for first frame (got 2)
[0:50:03.360853925] [858]  INFO Camera camera.cpp:1029 configuring streams: (0) 9152x6944-YUV420 (1) 9152x6944-SBGGR10_CSI2P
[0:50:03.363935697] [860]  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:50:06.604820446] [860]  WARN V4L2 v4l2_videodevice.cpp:1780 /dev/video0[14:cap]: Zero sequence expected for first frame (got 1)
Still capture image received

real    0m12.139s
user    0m1.304s
sys     0m0.499s

We are at 12.1 seconds so we reduced the -t parameter by 4000 and we are about 3500 lower. Maybe writing the image to disk takes time so let’s no have an output:

pi@camhat:~ $ time libcamera-still --nopreview -t 1000 --viewfinder-width 2312 --viewfinder-height 1736
[0:52:08.637692821] [917]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3729-5f595cca
[0:52:08.643989039] [919]  WARN CameraSensorProperties camera_sensor_properties.cpp:174 No static properties available for 'arducam_64mp'
[0:52:08.644066556] [919]  WARN CameraSensorProperties camera_sensor_properties.cpp:176 Please consider updating the camera sensor properties database
Open i2c bus error: No such file or directory
[0:52:08.661232674] [919]  WARN RPI raspberrypi.cpp:1274 Mismatch between Unicam and CamHelper for embedded data usage!
[0:52:08.661758223] [919] ERROR DelayedControls delayed_controls.cpp:87 Delay request for control id 0x009a090a but control is not exposed by device /dev/v4l-subdev0
[0:52:08.661942295] [919]  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:52:08.662735341] [917]  INFO Camera camera.cpp:1029 configuring streams: (0) 2312x1736-YUV420
[0:52:08.663167706] [919]  INFO RPI raspberrypi.cpp:763 Sensor: /base/soc/i2c0mux/i2c@1/arducam_64mp@1a - Selected sensor format: 2312x1736-SBGGR10_1X10 - Selected unicam format: 2312x1736-pBAA
[0:52:09.257292762] [919]  WARN V4L2 v4l2_videodevice.cpp:1780 /dev/video0[14:cap]: Zero sequence expected for first frame (got 2)

real    0m1.462s
user    0m0.113s
sys     0m0.081s

That looks good, we are down to 1.5 seconds; what happens if we drop the delay to 100ms:

pi@camhat:~ $ time libcamera-still --nopreview -t 100 --viewfinder-width 2312 --viewfinder-height 1736
[0:53:02.844739009] [926]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3729-5f595cca
[0:53:02.854157430] [928]  WARN CameraSensorProperties camera_sensor_properties.cpp:174 No static properties available for 'arducam_64mp'
[0:53:02.854233985] [928]  WARN CameraSensorProperties camera_sensor_properties.cpp:176 Please consider updating the camera sensor properties database
Open i2c bus error: No such file or directory
[0:53:02.882180512] [928]  WARN RPI raspberrypi.cpp:1274 Mismatch between Unicam and CamHelper for embedded data usage!
[0:53:02.882964113] [928] ERROR DelayedControls delayed_controls.cpp:87 Delay request for control id 0x009a090a but control is not exposed by device /dev/v4l-subdev0
[0:53:02.883243499] [928]  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:53:02.884497039] [926]  INFO Camera camera.cpp:1029 configuring streams: (0) 2312x1736-YUV420
[0:53:02.885130698] [928]  INFO RPI raspberrypi.cpp:763 Sensor: /base/soc/i2c0mux/i2c@1/arducam_64mp@1a - Selected sensor format: 2312x1736-SBGGR10_1X10 - Selected unicam format: 2312x1736-pBAA
[0:53:03.482975950] [928]  WARN V4L2 v4l2_videodevice.cpp:1780 /dev/video0[14:cap]: Zero sequence expected for first frame (got 2)

real    0m1.299s
user    0m0.107s
sys     0m0.095s

OK we are about 1.3 seconds which ties in means that the camera probably has a startup time of ~1 second. We will need to see if we can connect, keep that open and run a grab in C - which is what I’ll do next. Thanks for your help I think I can move forward here.

Cheers,

Neil

Ok,
Let me know your new progress.