TC358743 on Jetson Xavier NX

Hello everyone, I am trying to use the TC358743 HDMI2CSI converter, I found a lot of post regarding its implementation in the TX2 platform. However they are quite sparse, and very long. I tried to follow them and put all the pieces together. and I arrived at this point: I changed the driver files using the ones linked here, after that I enabled the driver as builtin using the guide here. Then I edited the device tree, in particular I created a new device tree source called tegra194-camera-tc358743.dtsi(see below) then I included it in tegra194-p3668-all-p3509-0000.dts.

Running dmesg | grep tc358743then I get the following result:

[    2.014752] tc358743 2-000f: chip found @0xf (3180000.i2c)
[    2.014790] tc358743 2-000f: Device Tree Parameters:
[    2.014821] OF: /i2c@3180000/tc358743@0f: could not get #gpio-cells for /host1x/gpio@6000d000
[    2.014830] tc358743 2-000f: reset_gpio = -22
[    2.014840] tc358743 2-000f: refclk_hz = 27000000
[    2.014856] tc358743 endpoint->bus.mipi_csi2.flags 512
[    2.014862] tc358743 endpoint->bus.mipi_csi2.clock_lane 0
[    2.014868] tc358743 endpoint->bus.mipi_csi2.num_data_lanes 2
[    2.014874] tc358743 endpoint->bus.mipi_csi2.data_lanes [1-2-0-0]
[    2.014880] tc358743 endpoint->nr_of_link_frequencies 1
[    2.014899] tc358743 state->pdata.pll_prd=4
[    2.014906] tc358743 state->pdata.pll_fbd=88
[    2.014911] tc358743 2-000f: Subdev init done
[    2.015388] tc358743 2-000f: Chip ID val: 0
[    2.015396] tc358743 2-000f: ctrl handler initied
[    2.015439] tc358743 2-000f: A bunch of new cutoms done
[    2.016014] tc358743 2-000f: Controls updated
[    2.016194] tc358743 2-000f: Work queue created
[    2.016203] tc358743 2-000f: About to call tegra_media_entity_init
[    2.016211] tc358743 2-000f: tegra_media_entity_init complete
[    2.016221] tc358743 2-000f: Set mbus_fmt_code in probe to: 8207
[    2.016227] tc358743 2-000f: About to register subdev
[    2.016236] tc358743 2-000f: Register subdev: 0
[    2.016242] tc358743 2-000f: before tc358743_initial_setup
[    2.022716] tc358743 2-000f: tc358743_set_hdmi_hdcp: disable
[    2.028253] tc358743 2-000f: after tc358743_initial_setup
[    2.028263] tc358743 2-000f: tc358743_set_csi_color_space: YCbCr 422 16-bit
[    2.029263] tc358743 2-000f: enable_stream: enable
[    2.030452] tc358743 2-000f: 792:enable_stream: end
[    2.031143] tc358743 2-000f: -----Chip status-----
[    2.031373] tc358743 2-000f: Chip ID:0x00
[    2.031604] tc358743 2-000f: Chip revision:0x00
[    2.031616] tc358743 2-000f: Reset: IR: 1, CEC: 1, CSI TX: 0, HDMI: 0
[    2.031624] tc358743 2-000f: Sleep mode: off
[    2.031632] tc358743 2-000f: Cable detected (+5V power): no
[    2.031837] tc358743 2-000f: DDC lines enabled: yes
[    2.032041] tc358743 2-000f: Hotplug enabled: no
[    2.032267] tc358743 2-000f: CEC enabled: no
[    2.032278] tc358743 2-000f: -----Signal status-----
[    2.032287] tc358743 2-000f: TMDS signal detected: no
[    2.032294] tc358743 2-000f: Stable sync signal: no
[    2.032302] tc358743 2-000f: PHY PLL locked: no
[    2.032320] tc358743 2-000f: PHY DE detected: no
[    2.032514] tc358743 2-000f: tc358743_get_detected_timings: no valid signal
[    2.032521] tc358743 2-000f: No video detected
[    2.032530] tc358743 2-000f: Configured format: 0x0p0.0 (0x0)
[    2.032537] tc358743 2-000f: horizontal: fp = 0, -sync = 0, bp = 0
[    2.032543] tc358743 2-000f: vertical: fp = 0, -sync = 0, bp = 0
[    2.032548] tc358743 2-000f: pixelclock: 0
[    2.032555] tc358743 2-000f: flags (0x0):
[    2.032560] tc358743 2-000f: standards (0x0):
[    2.032565] tc358743 2-000f: -----CSI-TX status-----
[    2.032570] tc358743 2-000f: Lanes needed: 0
[    2.032830] tc358743 2-000f: Lanes in use: 1
[    2.033034] tc358743 2-000f: Waiting for particular sync signal: no
[    2.033236] tc358743 2-000f: Transmit mode: no
[    2.033440] tc358743 2-000f: Receive mode: no
[    2.033642] tc358743 2-000f: Stopped: no
[    2.033648] tc358743 2-000f: Color space: YCbCr 422 16-bit
[    2.033825] tc358743 2-000f: -----DVI-D status-----
[    2.033841] tc358743 2-000f: HDCP encrypted content: no
[    2.033846] tc358743 2-000f: Input color space: RGB full range
[    2.034032] tc358743 2-000f: before tc358743_s_dv_timings
[    2.034038] tc358743 2-000f: tc358743_s_dv_timings
[    2.034044] tc358743 2-000f: enable_stream: disable
[    2.034570] tc358743 2-000f: 792:enable_stream: end
[    2.035018] tc358743 2-000f: tc358743_set_pll:
[    2.035025] tc358743 2-000f: tc358743_set_pll: updating PLL clock
[    2.036698] tc358743 2-000f: tc358743_set_csi:
[    2.041386] tc358743 2-000f: before tc358743_init_interrupts, irq: 0
[    2.043585] tc358743 2-000f: after tc358743_init_interrupts, irq: 0
[    2.043592] tc358743 2-000f: tc358743_enable_interrupts: cable connected = 1
[    2.044464] tc358743 2-000f: tc358743 found @0xf (3180000.i2c)
[    2.044472] tc358743 2-000f: tc358743_s_edid, pad 0, start block 0, blocks 2
[    2.044477] tc358743 2-000f: tc358743_disable_edid:
[    2.051650] tc358743 2-000f: tc358743_enable_edid
[    2.051656] tc358743 2-000f: tc358743_enable_edid:
[    2.051664] tc358743 2-000f: tc358743_enable_interrupts: cable connected = 1
[    2.052547] tc358743 2-000f: tc358743_enable_edid completed successfully
[    2.052555] tc358743 2-000f: tc358743_s_edid completed successfully
[    2.052560] tc358743 2-000f: Calling tc358743_g_edid
[    2.059189] tc358743 2-000f: EDID_RAM has 256 byte from: 0x8c00 to 0x8d00 
[    2.059194] tc358743 2-000f: tc358743_g_edid completed successfully
[    2.059740] tc358743 2-000f: -----Chip status-----
[    2.059981] tc358743 2-000f: Chip ID:0x00
[    2.060187] tc358743 2-000f: Chip revision:0x00
[    2.060193] tc358743 2-000f: Reset: IR: 1, CEC: 1, CSI TX: 0, HDMI: 0
[    2.060198] tc358743 2-000f: Sleep mode: off
[    2.060203] tc358743 2-000f: Cable detected (+5V power): no
[    2.060381] tc358743 2-000f: DDC lines enabled: yes
[    2.060557] tc358743 2-000f: Hotplug enabled: no
[    2.060758] tc358743 2-000f: CEC enabled: no
[    2.060784] tc358743 2-000f: -----Signal status-----
[    2.060789] tc358743 2-000f: TMDS signal detected: no
[    2.060793] tc358743 2-000f: Stable sync signal: no
[    2.060798] tc358743 2-000f: PHY PLL locked: no
[    2.060802] tc358743 2-000f: PHY DE detected: no
[    2.060986] tc358743 2-000f: tc358743_get_detected_timings: no valid signal
[    2.060991] tc358743 2-000f: No video detected
[    2.060998] tc358743 2-000f: Configured format: 1920x1080p30.0 (2200x1125)
[    2.061004] tc358743 2-000f: horizontal: fp = 88, +sync = 44, bp = 148
[    2.061009] tc358743 2-000f: vertical: fp = 4, +sync = 5, bp = 36
[    2.061015] tc358743 2-000f: pixelclock: 74250000
[    2.061021] tc358743 2-000f: flags (0x12): CAN_REDUCE_FPS CE_VIDEO
[    2.061027] tc358743 2-000f: standards (0x1): CEA
[    2.061031] tc358743 2-000f: -----CSI-TX status-----
[    2.061036] tc358743 2-000f: Lanes needed: 2
[    2.061289] tc358743 2-000f: Lanes in use: 2
[    2.061517] tc358743 2-000f: Waiting for particular sync signal: no
[    2.061719] tc358743 2-000f: Transmit mode: no
[    2.061920] tc358743 2-000f: Receive mode: no
[    2.062122] tc358743 2-000f: Stopped: no
[    2.062127] tc358743 2-000f: Color space: YCbCr 422 16-bit
[    2.062303] tc358743 2-000f: -----DVI-D status-----
[    2.062308] tc358743 2-000f: HDCP encrypted content: no
[    2.062313] tc358743 2-000f: Input color space: RGB full range
[    2.062512] tc358743 2-000f: Probe complete
[    2.158722] tc358743 2-000f: tc358743_delayed_work_enable_hotplug:
[    2.158861] tc358743 2-000f: i2c_rd: #### reading register0x8544 from0xf failed
[    2.159207] tc358743 2-000f: i2c_wr: writing register0x8544 from0xf failed

I think I am having something bad in the dtsi file below, does someone knows what can be the problem? I plugged the pin 33 of my Xavier NX to the interrupt pin of the tc358743.

#include "tegra194-camera-rbpcv2-imx219.dtsi"
#include <dt-bindings/gpio/gpio.h>

#define CAM0_PWDN	TEGRA194_MAIN_GPIO(P, 4)
#define CAM1_PWDN	TEGRA194_MAIN_GPIO(P, 5)
#define CAM_I2C_MUX 	TEGRA194_AON_GPIO(CC, 3)



/{
    host1x {
        gpio: gpio@6000d000 {
            camera-control-output-low {
                gpio-hog;
                output-low;
                gpios = < CAM1_PWDN 0 >;
                label = "cam1-pwdn";
            };
        };

        vi@15700000  {
            num-channels = <1>;
            ports {
                #address-cells = <1>;
                #size-cells = <0>;
                tc358743_vi_port2: port@0 {
                    status = "okay";
                    reg = <0>;
                    tc358743_vi_in0: endpoint {
                        status = "okay";
                        csi-port = <0>;  /* CSI-C */
                        bus-width = <4>; /* Use CSI-CD*/
                        remote-endpoint = <&tc358743_csi_out0>;
                    };
                };
            };
        };


		nvcsi@150c0000 {
			num-channels = <1>;
            #address-cells = <1>;
            #size-cells = <0>;
			channel@0 {
				reg = <0>;
                status = "okay";
				ports {
					#address-cells = <1>;
					#size-cells = <0>;
					port@0 {
                        status = "okay";
						reg = <0>;
						tc358743_csi_in0: endpoint@0 {
							status = "okay";
                            csi-port = <0>;
							bus-width = <4>;
							remote-endpoint = <&tc358743_out0>;
						};
					};
					port@1 {
                        status = "okay";
						reg = <1>;
						tc358743_csi_out0: endpoint@1 {
							status = "okay";
                            remote-endpoint = <&tc358743_vi_in0>;
						};
					};
				};
			};
        };
    };
    
    i2c@3180000 {  /* I2C_0, "adapter" 0 */
        status = "okay";
        #address-cells = <1>;
        #size-cells = <0>;
        tc358743@0f {
            status = "okay";
            compatible = "tc358743";
            reg = <0x0f>; /* (normal = address not shifted) */

            //devnode ="video1";

            mclk = "cam_mclk1";

            reset-gpios = <&gpio 151 0>;
            refclk_hz = <27000000>;  // refclk_hz -> regclk

		    interrupt-parent = <&gpio>;
		    interrupts = <TEGRA194_MAIN_GPIO(E, 6) GPIO_ACTIVE_HIGH>;

            // reset-gpios = <&tegra_main_gpio 149 0>;
            // refclk = <27000000>;
			// clock-names = "refclk";
            

            //reset-gpios = <&tegra_main_gpio TEGRA194_MAIN_GPIO(R,1) 0>;
            // refclk_hz = <27000000>;

            // reset-gpios = <&tegra_main_gpio TEGRA194_MAIN_GPIO(P, 5) GPIO_ACTIVE_HIGH>;
  		    // interrupt-parent = <CAM1_PWDN>;
	        // interrupts = <TEGRA194_MAIN_GPIO(E,6) GPIO_ACTIVE_HIGH>;

            // mclk = "extperiph1";

		    //clock-names = "refclk";
            //mclk = "cam_mclk1";

            /* 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_out0: endpoint {
                        port-index = <0>; /* CSI B */
                        bus-width = <4>; /* Use CSI-B only */
                        data-lanes = <1 2>;
                        clock-lanes = <0>;
                        clock-noncontinuous;
                        link-frequencies = /bits/ 64 <297000000>;
                        remote-endpoint = <&tc358743_csi_in0>;
                    };
                };
            };
        };
    };
    
    tcp: tegra-camera-platform {
	    status = "okay";
		compatible = "nvidia, tegra-camera-platform";
		num_csi_lanes = <2>;
		max_lane_speed = <1500000>;
		min_bits_per_pixel = <16>;
		vi_peak_byte_per_pixel = <2>;
		vi_bw_margin_pct = <25>;
		max_pixel_rate = <408000>;
		isp_peak_byte_per_pixel = <2>;
		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 {
            module0 {
                status = "okay";
                badge = "tc358743_top_i2c0_cd";
                position = "top";
                orientation = "3";
                drivernode0 {
                    status = "okay";
                    /* Declare PCL support driver (classically known as guid)  */
                    pcl_id = "v4l2_sensor";
                    /* Driver's v4l2 device name */
                    devname = "tc358743 0-000f";
                    /* Declare the device-tree hierarchy to driver instance */
                    proc-device-tree = "/proc/device-tree/i2c@3180000/tc358743@0f";
                };
                
            };
		};
	};
};

hello yager.project,

FYI,
the HDMI2CSI reference driver (i.e. TC358840) is supported with TX1 and TX2 platforms.
may I know what’s your actual use-case with NX?
you may also contact with Jetson Camera Partners for the details of camera solutions.
thanks

Hi @JerryChang , I am using the TC358743. I have a camera that outputs video in 1920x1080@30FPS and I want to read the stream using the CSI of the XAVIER.

hello yager.project,

please refer to Sensor Software Driver Programming Guide to implement your driver.
you should start with Port Binding, to have node definitions of the port binding for VI, NvCSI, and also sensor modules. it’ll register video node, (i.e. /dev/video0) if you have correct assignment.
for the next step, you’ll need to complete device tree (*.dtsi) property definition, for example, clock, GPIO, and regulator properties definitions.

BTW,
you may also refer to Topic 83289, multi-brick streams (i.e. gang mode) is NOT implemented for Xavier’s VI drivers.
thanks

Hi @JerryChang

I am going to follow the guide and I will update you. Thank you.

Anyway, I followed the kernel configuration procedure How to build NVIDIA Jetson Xavier NX kernel , and I enabled the drivers for the TC358743. they are under Device Drivers ----> Multimedia support ----> I2C Encoders, decoders, sensors and other helper chips ----> Toshiba TC358743 decoder. So I guess I am doing something wrong in the device tree file.

hello yager.project,

please check Tutorials page,
this should also helps for sensor drive development, V4L2 Sensor Driver Development Tutorial.
thanks

@JerryChang I think that I am having issues with the GPIO mapping. I need to define GPIO to be the interrupt for the TC358743, I don’t know how to map GPIO pins to Kernel TEGRA194_MAIN_GPIO. For example if I want to say that GPIO pin 33 is my interrupt how can I do it?

I tried something like interrupts = <TEGRA194_MAIN_GPIO(E,6) GPIO_ACTIVE_HIGH>;

I don’t know E,6 to what correspond.

hello yager.project,

here’s developer guide, GPIO Changes it shows an example to check the GPIO number.
you may also access pinmux spreadsheets via download center to check the default pin configuration.
please also check Jetson Xavier NX Platform Adaptation and Bring-Up for more details.
thanks

Did you get this working on the Xavier? We see communication with the i2c side of things, but /dev/video0 does not show up for us.