analogdevicesinc / aditof_sdk

Analog Devices 3D ToF software suite
https://analogdevicesinc.github.io/aditof_sdk/
BSD 3-Clause "New" or "Revised" License
72 stars 49 forks source link

Multi FXTOF system #815

Closed KamelAbdelouahab closed 11 months ago

KamelAbdelouahab commented 11 months ago

Hi all,

We are currently developing a multi-tof system based on :

For now, device tree has been updated to support this configuration as the following : dtb_view (1)

For now, i'm experimenting with two devices. Both get correctly registered. I can read their EEPROM content as well as their temperature sensors). I can also provide the following media-ctl output: Screenshot from 2023-08-03 13-12-44

The problem occurs when I try to capture data from devices using aditof demo:

  1. I can only read depth data from video0, IR stream looks corrupt. I have discarded frames

    [ 1341.594923] tegra194-vi5 15c10000.vi: corr_err: discarding frame 192, flags: 32, err_data 544
    [ 1341.615313] tegra194-vi5 15c10000.vi: corr_err: discarding frame 0, flags: 0, err_data 131072
    [ 1341.615320] tegra194-vi5 15c10000.vi: corr_err: discarding frame 0, flags: 0, err_data 131072
  2. Captures hangs when reading other cameras (video2, video4 ...). I get the following logs:

    I20230803 13:52:53.577834  9371 system_impl.cpp:116] SDK version: 3.1.0 | branch: master | commit: 9054d22
    I20230803 13:52:53.578744  9371 system_impl.cpp:121] SDK built with websockets version:3.2.3
    I20230803 13:52:53.956687  9371 sensor_enumerator_xaviernx.cpp:138] Looking for devices on the target: Xavier NX
    I20230803 13:52:53.958127  9371 sensor_enumerator_xaviernx.cpp:166] Device paths found: /dev/video2|/dev/video3 - /dev/v4l-subdev4|/dev/v4l-subdev6
    I20230803 13:52:53.958324  9371 sensor_enumerator_xaviernx.cpp:167] EEPROM paths: 24c1024 - /sys/bus/i2c/devices/31-0056/eeprom
    I20230803 13:52:53.960965  9371 camera_fxtof1.cpp:133] Initializing camera
    I20230803 13:52:53.961053  9371 addi9036_sensor.cpp:149] Opening device
    I20230803 13:52:53.961143  9371 addi9036_sensor.cpp:167] Looking for the following cards:
    I20230803 13:52:53.961198  9371 addi9036_sensor.cpp:169] vi-output, addi9036 31-0064
    I20230803 13:52:53.961246  9371 addi9036_sensor.cpp:169] vi-output, addi9036 35-0064
    I20230803 13:52:54.113633  9371 camera_fxtof1.cpp:189] Camera ID: A1VD99140100
    I20230803 13:52:54.121539  9371 camera_fxtof1.cpp:197] Camera initialized
    I20230803 13:52:54.127676  9371 addi9036_sensor.cpp:266] Starting device 0
    I20230803 13:52:54.155730  9371 addi9036_sensor.cpp:266] Starting device 1
    I20230803 13:52:54.157851  9371 camera_fxtof1.cpp:222] Chosen mode: near
    I20230803 13:52:54.157945  9371 camera_fxtof1.cpp:235] Camera range for mode: near is: 250 mm and 800 mm
    I20230803 13:52:54.158079  9371 camera_fxtof1.cpp:246] Found firmware for mode: near
    I20230803 13:52:54.158125  9371 camera_fxtof1.cpp:249] Firmware size: 14404 bytes
    I20230803 13:52:55.432426  9371 calibration_fxtof1.cpp:296] Camera intrinsic parameters:
    fx: 373.08
    fy: 372.923
    cx: 318.112
    cy: 232.63
    ...
    [  499.288363] tegra194-vi5 15c10000.vi: no reply from camera processor
    [  499.288538] tegra194-vi5 15c10000.vi: no reply from camera processor
    [  499.288545] tegra194-vi5 15c10000.vi: uncorr_err: request timed out after 2500 ms

    Nvidia's VI logs seems to show that there is no data in the CSI buffer. I can't understand why ...

Do you have any idea on what might be going on ?

PS: I temporarily hard-coded some values on the target_definitions.h and sensor_enumerator_xaviernx.cpp. It looks something like the following:

// Camera 1 - J10
static const char *EEPROM_DEV_PATH      = "/sys/bus/i2c/devices/31-0056/eeprom";
static const char *TEMP_SENSOR_DEV_PATH = "/sys/class/hwmon/hwmon1/temp1_input";
static const char *CAPTURE_DEVICE_NAME  = "vi-output, addi9036 31-0064|vi-output, addi9036 35-0064";
static const char *DRIVER_PATH          = "/dev/video2|/dev/video3";
static const char *SUBDEV_PATH          = "/dev/v4l-subdev5|/dev/v4l-subdev7";

Edit: Typos

Thanks for your help, Kamel

KamelAbdelouahab commented 11 months ago

Found the issue:

I was badly affecting the subDevPath:

static const char *SUBDEV_PATH          = "/dev/v4l-subdev4|/dev/v4l-subdev6";

It is static for now as the findDevicePathsAtMedia(std::string &dev_name, std::string &subdev_name) functions fails in my case.

Now trying to figure-out how to open multiple instances of FXTOFs, initialized to different device paths, in a single app. I might open another issue related to this. For now, I'm closing this