• Hardware
  • FFC-4P with two IMX378 hardware sync with FSYNC

Hello again ๐Ÿ™‚

I see the following in the docs

First, is that still true today for IMX378 ? (this documentation page seems to be 4 months old)

If it is, it means I need to trigger the FSYNC signal externally (using an arduino for example ?).

So I have to solder a wire there ?

Is that the correct way to proceed ?

Thanks !

EDIT

This seems to do something, indicating that the IMX378 can drive the FSYNC signal (?)

With this, I get about 60ms between the two frames

Without, it is more like 120ms

Am I understanding correctly ?

I am still far from sub-ms accuracy though ๐Ÿ™‚

Thanks !

New EDIT :

For some reason, switching which camera is input and output solved the issue ๐Ÿ˜ฎ

Sorry for using this forum as my journal ๐Ÿ™‚

    10 days later

    Ok, now I am trying to synchronize four IMX378 cameras.

    I followed the instructions on this page, specifically

    However, I am getting the following error

    [194430109153DF1200] [1.2] [4.790] [system] [critical] Fatal error. Please report to developers. Log: 'Fatal error on MSS CPU: trap: 00, address: 00000000' '0'
    Traceback (most recent call last):
      File "/home/antoine/Pollen/ReachyV2_vision/examples/example.py", line 78, in <module>
        data, latency, ts = ffcw.get_data()
      File "/home/antoine/Pollen/ReachyV2_vision/ffc_wrapper/ffc_wrapper.py", line 184, in get_data
        pkts[cam] = self.queue[cam].get()
    RuntimeError: Communication exception - possible device error/misconfiguration. Original message 'Couldn't read data from stream: 'CAM_A' (X_LINK_ERROR)'

    Here is a minimal example that yields that error

    import depthai as dai
    import cv2
    
    stringToCam = {
        "CAM_A": dai.CameraBoardSocket.CAM_A,
        "CAM_B": dai.CameraBoardSocket.CAM_B,
        "CAM_C": dai.CameraBoardSocket.CAM_C,
        "CAM_D": dai.CameraBoardSocket.CAM_D,
    }
    
    pipeline = dai.Pipeline()
    cams = {}
    for cam_id in stringToCam.keys():
        cam_node = pipeline.createColorCamera()
        cam_node.initialControl.setManualFocus(135)
        cam_node.setBoardSocket(stringToCam[cam_id])
        cam_node.setResolution(dai.ColorCameraProperties.SensorResolution.THE_1080_P)
        cam_node.setFps(30)
        cam_node.setIspScale(2, 3)  # 720p
        cam_node.setImageOrientation(dai.CameraImageOrientation.ROTATE_180_DEG)
        cam_node.setInterleaved(False)
    
        # If I remove this, it works
        if cam_id == "CAM_A":
            cam_node.initialControl.setFrameSyncMode(dai.CameraControl.FrameSyncMode.OUTPUT)
        else:
            cam_node.initialControl.setFrameSyncMode(dai.CameraControl.FrameSyncMode.INPUT)
    
        out = pipeline.createXLinkOut()
        out.setStreamName(cam_id)
    
        cam_node.isp.link(out.input)
    
        cams[cam_id] = cam_node
    
    
    config = dai.Device.Config()
    config.board.gpio[6] = dai.BoardConfig.GPIO(
        dai.BoardConfig.GPIO.OUTPUT, dai.BoardConfig.GPIO.Level.HIGH
    )
    device = dai.Device(config)
    device.startPipeline(pipeline)
    
    queue = {}
    for cam_id in cams.keys():
        queue[cam_id] = device.getOutputQueue(cam_id, maxSize=30, blocking=True)
    
    while True:
        for cam_id in cams.keys():
            frame = queue[cam_id].get().getCvFrame()
            cv2.imshow(cam_id, frame)
        if cv2.waitKey(1) == ord("q"):
            break

    Any thoughts ?

    Thanks !

      Hi apirrone
      Few thing that come to mind:

      • does changing the output socket have an effect on the issue?
      • try removing cam_node's manualfocus and orientation. Usually it is the camera configuration that causes the issue you are experiencing.

      Thanks,
      Jaka

      19 days later

      Hi @jakaskerl,

      It actually works if the socket that is driving the signal is CAM_C but only this one.

      Removing the manualfocus and orientation had no effect.

      I now have another issue, only the CAM_D socket is not synchronized with the others ๐Ÿ˜„

      (top left : A, top right : D, bottom left : B, bottom right : C)

      The code is the same as before except :

          if cam_id == "CAM_C": # Here
              cam_node.initialControl.setFrameSyncMode(dai.CameraControl.FrameSyncMode.OUTPUT)
          else:
              cam_node.initialControl.setFrameSyncMode(dai.CameraControl.FrameSyncMode.INPUT)

      Any idea of what's going on ?

      Thanks !

      Antoine

        Hi apirrone
        To my knowledge the A-D and C-B are hard synced together so it should be working... Could you try removing the code (GPIO setting):

        apirrone config = dai.Device.Config()
        config.board.gpio[6] = dai.BoardConfig.GPIO(
        dai.BoardConfig.GPIO.OUTPUT, dai.BoardConfig.GPIO.Level.HIGH
        )

        in case it makes a difference. Some newer devices have it the exact opposite so it might work.

        Thanks,
        Jaka

          5 days later

          jakaskerl

          If I remove the GPIO settings, nothing works :/

          There is no error, it just hangs never displaying any image

            Hi apirrone
            Referring to your reply above:

            apirrone For some reason, switching which camera is input and output solved the issue ๐Ÿ˜ฎ

            Have you perhaps tried the same thing? Might be that there is some hardware issue here... Try setting A, B or D as output.

            Thanks,
            Jaka

            14 days later

            Hi apirrone, were you able to come up with a solution to sync all 4 cameras?

            I have the same setup (IMX378 x 4 + OAK-FFC-4P) and am very interested in your setup and code.

            Thank you!

              2 months later

              Hi i4n

              We gave up on trying to synchronize 4 cameras like this. Sorry I can't help you

              • i4n likes this.