Xavier TC358743

Hello,

The TC358743 got some attention on the Jetson Nano and I want to use it on the Jetson Xavier NX.

I compiled the driver into the kernel and tried to adjust the device tree. Yet I cannot see a dmesg output for any detected devices on the I2C bus. Running i2cdetect I can see the device residing at 0x0F.

root@steep-desktop:~# i2cdetect -y -r 2
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – -- – -- – -- – -- – -- – -- 0f

I used this thread as a reference: No captured data from v4l2 driver (TC358743)

The I2C Bus I adjusted to is 3180000 which is described as cam_i2c in the device tree of the Xavier. I’m mainly working in the p3886 files of the t19x architecture.

Are there any tips how I can see more debugging messages of what is going on?

I am trying to use “tegra194-camera-imx185-a00.dtsi” as a reference for the design of my device tree file

/*
 * Copyright (c) 2018-2020, NVIDIA CORPORATION.  All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#include <dt-bindings/media/camera.h>

#define CAM0_PWDN	TEGRA194_MAIN_GPIO(P, 4)
#define CAM1_PWDN	TEGRA194_MAIN_GPIO(P, 5)

/ {
	host1x {
   vi@15c10000 {
        num-channels = <1>;  // Change 4->2
        ports {
            #address-cells = <1>;
            #size-cells = <0>;

            vi_port1: port@0 {
                status = "okay";
                reg = <0>;
                tc358743_vi_in1: endpoint {
                    status = "okay";
                    port-index = <0>;  /* CSI-B */
                    bus-width = <2>; /* Use CSI-B only */
                    remote-endpoint = <&tc358743_csi_out0>;
                };
            };
        };
    };


    nvcsi@15a00000 {
        num-channels = <1>;
        #address-cells = <1>;
        #size-cells = <0>;

        channel@0 {
            reg = <0>;
            ports {
                #address-cells = <1>;
                #size-cells = <0>;
                port@0 {
                    status = "okay";
                    reg = <0>;
                    tc358743_csi_in0: endpoint@0 {
                        status = "okay";
                        port-index = <0>;
                        bus-width = <2>;
                        remote-endpoint = <&tc358743_out1>;
                    };
                };
                port@1 {
                    reg = <1>;
                    status = "okay";
                    tc358743_csi_out0: endpoint@1 {
                        status = "okay";
                        remote-endpoint = <&tc358743_vi_in1>;
                    };
                };
            };
        };
    };

    i2c@3180000 {  /* I2C_PM, "adapter" 6 */
        status = "okay";
        #address-cells = <1>;
        #size-cells = <0>;
        tc358743@0f {
            status = "okay";
            compatible = "tc358743";
            reg = <0x0f>; /* shifted by 2 */
            // The Cam_I2C clock is "divclock"
            // I don't know wheter this changed from jetson
            // Or wheter the entry "cam_mclk1" is still correct
            mclk = "cam_mclk1";
            // I am assuming the CAM_PWDN pins were used?
            reset-gpios = <CAM1_PWDN>;
            refclk_hz = <27000000>;  // refclk_hz -> regclk

            //interrupt-parent = <&tegra_aon_gpio>;
            // What was this assigned to?
            //interrupts = <TEGRA_GPIO(E, 6) GPIO_ACTIVE_HIGH>;

            /* Physical dimensions of sensor */
            physical_w = "4.713";
            physical_h = "3.494";
            /* Sensor Model */
            sensor_model ="tc358743";
            
   

            ddc5v_delay = <2>;
            enable_hdcp = "false";
            lineinitcnt = <0xe80>;
            lptxtimecnt = <0x003>;
            tclk_headercnt = <0x1403>;
            tclk_trailcnt = <0x00>;
            ths_headercnt = <0x0103>;
            twakeup = <0x4882>;
            tclk_postcnt = <0x008>;
            ths_trailcnt = <0x02>;
            hstxvregcnt = <0>;

            ports {
                #address-cells = <1>;
                #size-cells = <0>;

                port@0 {
                    reg = <0>;
                    tc358743_out1: endpoint {
                        port-index = <0>; /* CSI B */
                        bus-width = <2>; /* Use CSI-B only */
                        data-lanes = <1 2>;
                        clock-lanes = <0>;
                        clock-noncontinuous;
                        link-frequencies = /bits/ 64 <297000000>;
                        remote-endpoint = <&tc358743_csi_in0>;
                    };
                };
            };
        };
    };
  };
};


/ {

tegra-camera-platform {
  status = "okay";
	compatible = "nvidia, tegra-camera-platform";
	num_csi_lanes = <2>;  // Changed 2 -> 4
	max_lane_speed = <1500000>;
	min_bits_per_pixel = <10>;  // Changed 16 -> 10
	vi_peak_byte_per_pixel = <2>;
	vi_bw_margin_pct = <25>;
	max_pixel_rate = <750000>;
	isp_peak_byte_per_pixel = <5>;
	isp_bw_margin_pct = <25>;

    	/**
	* The general guideline for naming badge_info contains 3 parts, and is as follows,
	* The first part is the camera_board_id for the module; if the module is in a FFD
	* platform, then use the platform name for this part.
	* The second part contains the position of the module, ex. “rear” or “front”.
	* The third part contains the last 6 characters of a part number which is found
	* in the module's specsheet from the vender.
	*/
	modules {

	    module1 {
	        status = "okay";
	        badge = "tc358743_top_i2c6_b";
	        position = "front";
	        orientation = "1";
	        drivernode0 {
	            status = "okay";
	            /* Declare PCL support driver (classically known as guid)  */
	            pcl_id = "v4l2_sensor";
	            /* Driver's v4l2 device name */
	            devname = "tc358743 6-000f";
	            /* Declare the device-tree hierarchy to driver instance */
	            proc-device-tree = "/proc/device-tree/host1x/i2c@3180000/tc358743@0f";
	        };
	    };
        
	};
};
};

hello lukas.bockel,

please refer to developer guide, there’s Applications Using V4L2 IOCTL Directly. you may use V4L2 IOCTL to verify basic functionality during sensor bring-up.
please also check Debugging Tips session to examine your sensor drivers.
thanks

Hello Jerry,

The Problem is before the /dev/video device is being created as such I cannot reference the V4L2 document.

I managed to get the device tree working as far as errors being produced. The TC358743 driver is looking for a 26Mhz/27Mhz reference clock. I’ve been referencing this document https://docs.nvidia.com/jetson/archives/l4t-archived/l4t-3243/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide%2Fcamera_sensor_prog.html%23wwpID0E0YE0HA

Yet, I cannot find the values which clocks support which range and which clock is suitable to my application, given I am very much new to the topic of the device tree.

Could you help me with a few pointers how to find the propper clock source?

While we’re at it do you happen to know which pins I should use for the CAM0 / CAM1 interrupt lines?

hello lukas.bockel,

please access NVIDIA Jetson Nano and Jetson Xavier NX Camera Design Guide via download center.
you may refer to [Developer Kit Carrier Board Camera Connector] for the signal name and its pin.
thanks