Hi @VisiCon-Philip ,
My bad, I was wrong - in my case (linked above), I2C is shared between CAM_B and CAM_C, so both sensors get the "start frame" command via I2C at the exact same time, and therefor are "synced". With 2 OAK-FFCs this wouldn't work.
You can toggle FSYNC manually within script node on one FFC-4P, and then all AR0234 cams should have FSYNC to input.
Demo script:
from depthai_sdk import OakCamera
import depthai as dai
FPS = 30
with OakCamera() as oak:
left = oak.create_camera('CAM_B', fps=FPS)
right = oak.create_camera('CAM_C', fps=FPS)
# Set colorCameras FSYNC mode
left.node.initialControl.setFrameSyncMode(dai.CameraControl.FrameSyncMode.INPUT)
right.node.initialControl.setFrameSyncMode(dai.CameraControl.FrameSyncMode.INPUT)
script = oak.pipeline.createScript()
script.setProcessor(dai.ProcessorType.LEON_CSS)
script.setScript("""
import time
import GPIO
# Script static arguments
fps = %f
calib = Device.readCalibration2().getEepromData()
prodName = calib.productName
boardName = calib.boardName
boardRev = calib.boardRev
node.warn(f'Product name : {prodName}')
node.warn(f'Board name : {boardName}')
node.warn(f'Board revision: {boardRev}')
revision = -1
# Very basic parsing here, TODO improve
if len(boardRev) >= 2 and boardRev[0] == 'R':
revision = int(boardRev[1])
node.warn(f'Parsed revision number: {revision}')
# Defaults for OAK-FFC-4P older revisions (<= R5)
GPIO_FSIN_2LANE = 41 # COM_AUX_IO2
GPIO_FSIN_4LANE = 40
GPIO_FSIN_MODE_SELECT = 6 # Drive 1 to tie together FSIN_2LANE and FSIN_4LANE
if revision >= 6:
GPIO_FSIN_2LANE = 41 # still COM_AUX_IO2, not PWM capable
GPIO_FSIN_4LANE = 42 # also not PWM capable
GPIO_FSIN_MODE_SELECT = 38 # Drive 1 to tie together FSIN_2LANE and FSIN_4LANE
# Note: on R7 GPIO_FSIN_MODE_SELECT is pulled up, driving high isn't necessary (but fine to do)
# GPIO initialization
GPIO.setup(GPIO_FSIN_2LANE, GPIO.OUT)
GPIO.write(GPIO_FSIN_2LANE, 0)
GPIO.setup(GPIO_FSIN_4LANE, GPIO.IN)
GPIO.setup(GPIO_FSIN_MODE_SELECT, GPIO.OUT)
GPIO.write(GPIO_FSIN_MODE_SELECT, 1)
period = 1 / fps
active = 0.001
node.warn(f'FPS: {fps} Period: {period}')
withInterrupts = False
if withInterrupts:
node.critical(f'[TODO] FSYNC with timer interrupts (more precise) not implemented')
else:
overhead = 0.003 # Empirical, TODO add thread priority option!
while True:
GPIO.write(GPIO_FSIN_2LANE, 1)
time.sleep(active)
GPIO.write(GPIO_FSIN_2LANE, 0)
time.sleep(period - active - overhead)
""" % (FPS))
oak.callback([left, right], lambda packets:
print(f"Left {packets['CAM_B_video'].msg.getTimestamp()}, Right {packets['CAM_C_video'].msg.getTimestamp()}")
).configure_syncing(enable_sync=True)
oak.start(blocking=True)
Script above running on FFC-4P with 2x FFC-AR0234 connected and I'm measuring FSYNC via PSRBS connector: