aditof_sdk icon indicating copy to clipboard operation
aditof_sdk copied to clipboard

Failed to get frame from device [AD-96TOF1-EBZ with Draonboard 820c]

Open ghost opened this issue 2 years ago • 0 comments

Hi There,

We are trying to interface the AD-96TOF1-EBZ with Dragonboard 820c. So far, we are able to build kernel modules for kernel v4.14 along with the patches given here. On the top of above patches we have applied the device tree changes for apq8096 to support dragonboard 820c.

Using the dmesg we have confirmed that we have confirmed that the sensor and eeprom are probed successfully.

linaro@linaro-alip:~$ dmesg | grep 903
[    4.903512] hub 2-0:1.0: 1 port detected
[   18.740992] addi903x 3-0064: addi903x_probe: Enter, i2c addr = 0x64
[   18.741193] addi903x 3-0064: Reset LOW
[   18.747232] addi903x 3-0064: s_power 1
[   18.751548] addi903x 3-0064: addi903x_set_power_on
[   18.775914] addi903x 3-0064: power on complete
[   18.789185] addi903x 3-0064: addi903x detected at address 0x64
[   18.795997] addi903x 3-0064: s_power 0
[   18.810385] addi903x 3-0064: addi903x_set_power_off
[   18.830948] addi903x 3-0064: power off complete
[   18.830953] addi903x 3-0064: addi903x_entity_init_cfg: Enter
[   18.830958] addi903x 3-0064: set_fmt: 0 640x960
[   18.830966] addi903x 3-0064: >> addi903x_s_ctrl
[   18.830969] addi903x 3-0064: << addi903x_s_ctrl
[   19.329648] addi903x 3-0064: addi903x_entity_init_cfg: Enter
[   19.329654] addi903x 3-0064: set_fmt: 0 640x960
[   20.325407] addi903x 3-0064: addi903x_entity_init_cfg: Enter
[   20.325433] addi903x 3-0064: set_fmt: 0 640x960
[   20.330297] addi903x 3-0064: set_fmt: 3008 640x960

linaro@linaro-alip:~$ dmesg | grep at24
[   14.483494] at24 0-0056: 131072 byte 24c1024 EEPROM, writable, 32 bytes/write

We have also done the required changes for udev rules. updated eeprom device node path and config_pipe changes:

linaro@linaro-alip:~/workspace/github/aditof_sdk$ git diff
diff --git a/sdk/src/cameras/ad-96tof1-ebz/dragonboard/target_definitions.h b/sdk/src/cameras/ad-96tof1-ebz/dragonboard/target_definitions.h
index b43d7fe..5591e76 100644
--- a/sdk/src/cameras/ad-96tof1-ebz/dragonboard/target_definitions.h
+++ b/sdk/src/cameras/ad-96tof1-ebz/dragonboard/target_definitions.h
@@ -32,9 +32,9 @@
 #ifndef TARGET_DEFINITIONS_H
 #define TARGET_DEFINITIONS_H
 
-static const char *EEPROM_DEV_PATH = "/sys/bus/i2c/devices/0-0056/eeprom";
+static const char *EEPROM_DEV_PATH = "/sys/devices/platform/soc/7577000.i2c/i2c-0/0-0056/eeprom";
 
-static const char *TEMP_SENSOR_DEV_PATH = "/dev/i2c-1";
+static const char *TEMP_SENSOR_DEV_PATH = "/dev/i2c-0";
 static const char LASER_TEMP_SENSOR_I2C_ADDR = 0x49;
 static const char AFE_TEMP_SENSOR_I2C_ADDR = 0x4b;
 
diff --git a/utils/dragonboard/53-aditofsdkdragonboard.rules b/utils/dragonboard/53-aditofsdkdragonboard.rules
index e4e123a..b3f0a13 100644
--- a/utils/dragonboard/53-aditofsdkdragonboard.rules
+++ b/utils/dragonboard/53-aditofsdkdragonboard.rules
@@ -1,6 +1,6 @@
 # allow read/write access to the eeprom and the temperature sensor for DragonBoard
 
 SUBSYSTEM=="i2c", 
-RUN+="/bin/chown root:plugdev /sys/bus/i2c/devices/0-0056/eeprom", 
-RUN+="/bin/chmod 0060 /sys/bus/i2c/devices/0-0056/eeprom", 
-RUN+="/bin/chmod 666 /dev/i2c-1"
+RUN+="/bin/chown root:plugdev /sys/devices/platform/soc/7577000.i2c/i2c-0/0-0056/eeprom", 
+RUN+="/bin/chmod 0060 /sys/devices/platform/soc/7577000.i2c/i2c-0/0-0056/eeprom", 
+RUN+="/bin/chmod 666 /dev/i2c-0"
diff --git a/utils/dragonboard/config_pipe.sh b/utils/dragonboard/config_pipe.sh
index 603fa2c..1aab69b 100755
--- a/utils/dragonboard/config_pipe.sh
+++ b/utils/dragonboard/config_pipe.sh
@@ -1,5 +1,5 @@
 #!/bin/bash
 set +x
 
-sudo media-ctl -v -d /dev/media1 -l '"msm_csiphy1":1->"msm_csid0":0[1],"msm_csid0":1->"msm_ispif0":0[1],"msm_ispif0":1->"msm_vfe0_rdi0":0[1]'
-sudo media-ctl -v -d /dev/media1 -V '"addi903x 1-0064":0[fmt:SBGGR12/640x960 field:none],"msm_csiphy1":0[fmt:SBGGR12/640x960 field:none],"msm_csid0":0[fmt:SBGGR12/640x960 field:none],"msm_ispif0":0[fmt:SBGGR12/640x960 field:none],"msm_vfe0_rdi0":0[fmt:SBGGR12/640x960 field:none]'
+sudo media-ctl -v -d /dev/media0 -l '"msm_csiphy1":1->"msm_csid0":0[1],"msm_csid0":1->"msm_ispif0":0[1],"msm_ispif0":1->"msm_vfe0_rdi0":0[1]'
+sudo media-ctl -v -d /dev/media0 -V '"addi903x 3-0064":0[fmt:SBGGR12/640x960 field:none],"msm_csiphy1":0[fmt:SBGGR12/640x960 field:none],"msm_csid0":0[fmt:SBGGR12/640x960 field:none],"msm_ispif0":0[fmt:SBGGR12/640x960 field:none],"msm_vfe0_rdi0":0[fmt:SBGGR12/640x960 field:none]'

When we try to run aditof-demo application it is not able to capture the frames. It is not showing any error related to initialization sequence, though.

linaro@linaro-alip:~/workspace/github/aditof_sdk/build/examples/aditof-demo$ sudo ./aditof-demo 
I1012 06:20:16.881911  6928 system_impl.cpp:120] SDK version: 3.1.0 | branch: master | commit: 4351028
I1012 06:20:16.882716  6928 system_impl.cpp:125] SDK built with websockets version:3.1.0
I1012 06:20:16.921948  6928 sensor_enumerator_dragonboard.cpp:160] Looking for sensors on the target
I1012 06:20:16.997947  6928 camera_96tof1.cpp:156] Initializing camera
I1012 06:20:16.998361  6928 addi9036_sensor.cpp:155] Opening device
I1012 06:20:16.998479  6928 addi9036_sensor.cpp:173] Looking for the following cards:
I1012 06:20:16.998546  6928 addi9036_sensor.cpp:175] Qualcomm Camera Subsystem
I1012 06:20:17.429579  6928 calibration_96tof1.cpp:179] EEPROM calibration data size 65044 bytes
I1012 06:20:23.319448  6928 camera_96tof1.cpp:212] Camera initialized
I1012 06:20:23.326717  6928 addi9036_sensor.cpp:272] Starting device 0
I1012 06:20:23.378085  6928 camera_96tof1.cpp:245] Chosen mode: near
I1012 06:20:23.378201  6928 camera_96tof1.cpp:289] Camera range for mode: near is: 250 mm and 800 mm
I1012 06:20:23.379671  6928 camera_96tof1.cpp:299] Found firmware for mode: near
I1012 06:20:23.379770  6928 camera_96tof1.cpp:302] Firmware size: 10440 bytes
I1012 06:20:26.103509  6928 calibration_96tof1.cpp:394] Camera calibration parameters for mode: near are gain: 1 offset: 0
I1012 06:20:26.104184  6928 calibration_96tof1.cpp:406] Camera intrinsic parameters:
    fx: 383.95
    fy: 380.865
    cx: 343.026
    cy: 240.329
I1012 06:20:31.033388  6928 addi9036_sensor.cpp:314] Stopping device
I1012 06:20:32.070185  6928 addi9036_sensor.cpp:272] Starting device 0
I1012 06:20:32.122968  6928 camera_96tof1.cpp:245] Chosen mode: near
I1012 06:20:32.123075  6928 camera_96tof1.cpp:289] Camera range for mode: near is: 250 mm and 800 mm
I1012 06:20:32.124440  6928 camera_96tof1.cpp:299] Found firmware for mode: near
I1012 06:20:32.124514  6928 camera_96tof1.cpp:302] Firmware size: 10440 bytes
I1012 06:20:34.846506  6928 calibration_96tof1.cpp:394] Camera calibration parameters for mode: near are gain: 1 offset: 0
I1012 06:20:34.846856  6928 calibration_96tof1.cpp:406] Camera intrinsic parameters:
    fx: 383.95
    fy: 380.865
    cx: 343.026
    cy: 240.329
W1012 06:20:59.507225  6940 addi9036_sensor.cpp:932] select timeout
W1012 06:20:59.509459  6940 camera_96tof1.cpp:490] Failed to get frame from device

v4l2-ctl returns following output:

linaro@linaro-alip:~/workspace/github/aditof_sdk$ v4l2-ctl --all
Driver Info:
        Driver name      : qcom-camss
        Card type        : Qualcomm Camera Subsystem
        Bus info         : platform:a34000.camss
        Driver version   : 4.14.96
        Capabilities     : 0x85201000
                Video Capture Multiplanar
                Read/Write
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps      : 0x05201000
                Video Capture Multiplanar
                Read/Write
                Streaming
                Extended Pix Format
Media Driver Info:
        Driver name      : qcom-camss
        Model            : Qualcomm Camera Subsystem
        Serial           : 
        Bus info         : 
        Media version    : 4.14.96
        Hardware revision: 0x00000000 (0)
        Driver version   : 4.14.96
Interface Info:
        ID               : 0x03000027
        Type             : V4L Video
Entity Info:
        ID               : 0x00000025 (37)
        Name             : msm_vfe0_video0
        Function         : V4L2 I/O
        Pad 0x01000026   : Sink
          Link 0x02000029: from remote pad 0x1000024 of entity 'msm_vfe0_rdi0': Data, Enabled, Immutable
Priority: 2
Video input : 0 (camera: ok)
Format Video Capture Multiplanar:
        Width/Height      : 640/480
        Pixel Format      : 'UYVY' (UYVY 4:2:2)
        Field             : None
        Number of planes  : 1
        Flags             : 
        Colorspace        : sRGB
        Transfer Function : sRGB
        YCbCr/HSV Encoding: ITU-R 601
        Quantization      : Full Range
        Plane 0           :
           Bytes per Line : 1280
           Size Image     : 614400

config_pipe changes also seems to be working:

linaro@linaro-alip:~/workspace/github/aditof_sdk$ systemctl status config_pipe
● config_pipe.service
   Loaded: loaded (/etc/systemd/system/config_pipe.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Wed 2022-10-12 06:05:29 UTC; 50min ago
  Process: 6217 ExecStart=/home/linaro/workspace/github/aditof_sdk/utils/dragonboard/config_pipe.sh (code=exited, status=0/SUCCESS)
 Main PID: 6217 (code=exited, status=0/SUCCESS)

Oct 12 06:05:29 linaro-alip config_pipe.sh[6217]: Setting up format SBGGR12_1X12 640x960 on pad msm_csiphy1/0
Oct 12 06:05:29 linaro-alip config_pipe.sh[6217]: Format set: SBGGR12_1X12 640x960
Oct 12 06:05:29 linaro-alip config_pipe.sh[6217]: Setting up format SBGGR12_1X12 640x960 on pad msm_csid0/0
Oct 12 06:05:29 linaro-alip config_pipe.sh[6217]: Format set: SBGGR12_1X12 640x960
Oct 12 06:05:29 linaro-alip config_pipe.sh[6217]: Setting up format SBGGR12_1X12 640x960 on pad msm_ispif0/0
Oct 12 06:05:29 linaro-alip config_pipe.sh[6217]: Format set: SBGGR12_1X12 640x960
Oct 12 06:05:29 linaro-alip config_pipe.sh[6217]: Setting up format SBGGR12_1X12 640x960 on pad msm_vfe0_rdi0/0
Oct 12 06:05:29 linaro-alip config_pipe.sh[6217]: Format set: SBGGR12_1X12 640x960
Oct 12 06:05:29 linaro-alip systemd[1]: config_pipe.service: Succeeded.

Could you please suggest what could be wrong here? We have confirmed that the same sensor is working by interfacing with Dragonboard 410c which is running with the auto generated ci image.

ghost avatar Oct 12 '22 07:10 ghost