Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 6814

Camera board • Sync 6 HQ cameras (RPi4)

$
0
0
Hi everyone,

After many attempts, I am reaching out to this great community to seek help :D any advice, hint, documentation is appreciated.

Cheers,
Mitch

Background
My colleagues and I are academic researchers interested in understanding great ape communication, in particular chimpanzee. We are currently trying to build a camera setup to record synchronized videos from 6 different viewpoints in a zoo.

Hardware
- 6 Raspberry Pis 4B each powered by PoE (i.e. PoE hats)
- 6 HQ cameras

Electrical circuit
Each camera are connected to one circuit in parallel (each XVS pins are connected together and each GND are connected together)

Software

Code:

cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"

Code:

rpicam-vid --version
rpicam-apps build: v1.6.0 025ca84648c9 03-02-2025 (16:21:04)
rpicam-apps capabilites: egl:1 qt:1 drm:1 libav:1
libcamera build: v0.4.0+53-29156679

Firmware config

Code:

cat /boot/firmware/config.txt
# For more options and information see
# http://rptl.io/configtxt
# Some settings may impact device functionality. See link above for details

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

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

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

# Automatically load overlays for detected cameras
camera_auto_detect=0
dtoverlay=imx477,always-on

# Automatically load overlays for detected DSI displays
display_auto_detect=1

# Automatically load initramfs files, if found
auto_initramfs=1

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

# Don't have the firmware create an initial video= setting in cmdline.txt.
# Use the kernel's default instead.
disable_fw_kms_setup=1

# Run in 64-bit mode
arm_64bit=1

# Disable compensation for displays with overscan
disable_overscan=1

# Run as fast as firmware / board allows
arm_boost=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

[cm5]
dtoverlay=dwc2,dr_mode=host

[all]
rpi_app pipeline config

Code:

cat /usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml
{
"version": 1.0,
"target": "bcm2835",

"pipeline_handler":
{
# The minimum number of internal buffers to be allocated for
# Unicam. This value must be greater than 0, but less than or
# equal to min_total_unicam_buffers.
#
# A larger number of internal buffers can reduce the occurrence
# of frame drops during high CPU loads, but might also cause
# additional latency in the system.
#
# Note that the pipeline handler might override this value and
# not allocate any internal buffers if it knows they will never
# be used. For example if the RAW stream is marked as mandatory
# and there are no dropped frames signalled for algorithm
# convergence.
#
"min_unicam_buffers": 2,

# The minimum total (internal + external) buffer count used for
# Unicam. The number of internal buffers allocated for Unicam is
# given by:
#
# internal buffer count = max(min_unicam_buffers,
# min_total_unicam_buffers - external buffer count)
#
"min_total_unicam_buffers": 4,

# Override any request from the IPA to drop a number of startup
# frames.
#
# "disable_startup_frame_drops": false,

# The application will always provide a request buffer for the
# RAW stream, if it has been configured.
"raw_mandatory_stream": true,

# The application will always provide a request buffer for the
# Output 0 stream, if it has been configured.
"output0_mandatory_stream": true,
"camera_timeout_value_ms": 10000,
}
}
Scenario
Testing capturing frames synchronously on 2 devices (i.e. one source and one sink)
  • 1) setting up trigger_mode on devices
    • on source

      Code:

      sudo suecho 1 > /sys/module/imx477/parameters/trigger_modeexit
    • on sink

      Code:

      sudo suecho 2 > /sys/module/imx477/parameters/trigger_modeexit
  • 2) starting rpicam-vid on sink and then on source (within a second)
    • on source

      Code:

      rpicam-vid --frames 10 -n -o source.h264
    • on sink

      Code:

      rpicam-vid --frames 10 -n -o sink.h264


Terminal Output
  • on source
    [9:52:29.777345864] [2623] INFO Camera camera_manager.cpp:327 libcamera v0.4.0+53-29156679
    [9:52:29.818050272] [2626] WARN RPiSdn sdn.cpp:40 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
    [9:52:29.820306735] [2626] INFO RPI vc4.cpp:447 Registered camera /base/soc/i2c0mux/i2c@1/imx477@1a to Unicam device /dev/media4 and ISP device /dev/media1
    [9:52:29.820374031] [2626] INFO RPI pipeline_base.cpp:1121 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
    Mode selection for 640:480:12:P
    SRGGB10_CSI2P,1332x990/0 - Score: 1305.05
    SRGGB12_CSI2P,2028x1080/0 - Score: 701.167
    SRGGB12_CSI2P,2028x1520/0 - Score: 607.329
    SRGGB12_CSI2P,4056x3040/0 - Score: 1494.33
    [9:52:29.821617772] [2623] INFO Camera camera.cpp:1202 configuring streams: (0) 640x480-YUV420 (1) 2028x1520-SBGGR12_CSI2P
    [9:52:29.822024086] [2626] INFO RPI vc4.cpp:622 Sensor: /base/soc/i2c0mux/i2c@1/imx477@1a - Selected sensor format: 2028x1520-SBGGR12_1X12 - Selected unicam format: 2028x1520-pBCC
  • on sink
    [9:52:52.878544573] [2604] INFO Camera camera_manager.cpp:327 libcamera v0.4.0+53-29156679
    [9:52:52.920511777] [2607] WARN RPiSdn sdn.cpp:40 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
    [9:52:52.922695573] [2607] INFO RPI vc4.cpp:447 Registered camera /base/soc/i2c0mux/i2c@1/imx477@1a to Unicam device /dev/media3 and ISP device /dev/media0
    [9:52:52.922811592] [2607] INFO RPI pipeline_base.cpp:1121 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
    Mode selection for 640:480:12:P
    SRGGB10_CSI2P,1332x990/0 - Score: 1305.05
    SRGGB12_CSI2P,2028x1080/0 - Score: 701.167
    SRGGB12_CSI2P,2028x1520/0 - Score: 607.329
    SRGGB12_CSI2P,4056x3040/0 - Score: 1494.33
    [9:52:52.924096240] [2604] INFO Camera camera.cpp:1202 configuring streams: (0) 640x480-YUV420 (1) 2028x1520-SBGGR12_CSI2P
    [9:52:52.924499666] [2607] INFO RPI vc4.cpp:622 Sensor: /base/soc/i2c0mux/i2c@1/imx477@1a - Selected sensor format: 2028x1520-SBGGR12_1X12 - Selected unicam format: 2028x1520-pBCC
    [9:53:02.970295956] [2607] WARN V4L2 v4l2_videodevice.cpp:2150 /dev/video0[13:cap]: Dequeue timer of 10000000.00us has expired!
    [9:53:02.970453993] [2607] ERROR RPI pipeline_base.cpp:1367 Camera frontend has timed out!
    [9:53:02.970494716] [2607] ERROR RPI pipeline_base.cpp:1368 Please check that your camera sensor connector is attached securely.
    [9:53:02.970534549] [2607] ERROR RPI pipeline_base.cpp:1369 Alternatively, try another cable and/or sensor.
    ERROR: Device timeout detected, attempting a restart!!!
Result
source.h264 is created on source device but not sink.h264 on sink.

Statistics: Posted by MitchF — Thu Mar 13, 2025 9:43 am — Replies 0 — Views 27



Viewing all articles
Browse latest Browse all 6814

Trending Articles