No captured data from v4l2 driver (TC358743)

Sure :

<tc358743.dtsi>

#include <dt-bindings/media/camera.h>
#include <dt-bindings/platform/t210/t210.h>
#include <dt-bindings/gpio/gpio.h>

/ {
host1x {

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

    vi_base: vi {
        num-channels = <2>;  // Change 4->2
        ports {
            #address-cells = <1>;
            #size-cells = <0>;

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


csi_base: nvcsi {
        num-channels = <2>;
        #address-cells = <1>;
        #size-cells = <0>;
        csi_chan0: channel@0 {
            reg = <0>;
            ports {
                #address-cells = <1>;
                #size-cells = <0>;
                csi_chan0_port0: port@0 {
                    reg = <0>;
                    rbpcv2_imx219_csi_in0: endpoint@0 {
                        port-index = <0>;
                        bus-width = <2>;
                        //remote-endpoint = <&rbpcv2_imx219_out0>;
                    };
                };
                csi_chan0_port1: port@1 {
                    reg = <1>;
                    rbpcv2_imx219_csi_out0: endpoint@1 {
                        //remote-endpoint = <&rbpcv2_imx219_vi_in0>;
                    };
                };
            };
        };
        channel@1 {
            reg = <1>;
            ports {
                #address-cells = <1>;
                #size-cells = <0>;
                port@0 {
                    status = "okay";
                    reg = <0>;
                    tc358743_csi_in0: endpoint@2 {
                        status = "okay";
                        port-index = <1>;
                        bus-width = <2>;
                        remote-endpoint = <&tc358743_out1>;
                    };
                };
                port@1 {
                    reg = <1>;
                    status = "okay";
                    tc358743_csi_out0: endpoint@3 {
                        status = "okay";
                        remote-endpoint = <&tc358743_vi_in1>;
                    };
                };
            };
        };
    };

    i2c@546c0000 {  /* I2C_PM, "adapter" 6 */
        status = "okay";
        #address-cells = <1>;
        #size-cells = <0>;
        tc358743@0f {
            status = "okay";
            compatible = "tc358743";
            reg = <0x0f>; /* shifted by 2 */
            mclk = "cam_mclk1";
            reset-gpios = <&gpio 149 0>;
            refclk_hz = <27000000>;  // refclk_hz -> regclk

	interrupt-parent = <&gpio>;
	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 = <1>; /* CSI B */
                        bus-width = <4>; /* Use CSI-B only */
                        data-lanes = <1 2 3 4>;
                        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 = <4>;  // 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@546c0000/tc358743@0f";
	        };
	    };
        
	};
};

};

When I use your device tree my Nano doesn’t boot (at least not to ssh).

Did you disable the camera models plugin manager?

yes , I disabled these in <tegra210-porg-p3448-common.dtsi> :

#include “porg-platforms/tegra210-porg-camera-rbpcv2-imx219.dtsi”
#include “porg-platforms/tegra210-porg-camera-rbpcv2-dual-imx219.dtsi”
#include “porg-plugin-manager/tegra210-porg-plugin-manager.dtsi”

Hi, this discussion is very interesting to me as I tried to get the TC358743 working on Jetson Nano a few months ago but eventually gave up. You seem to have already got further than I did!

It has encouraged me to try again so I would appreciate if you could post your latest driver/dtsi file so I can try to get my kernel to build and run!

Thanks

Phil Taylor

Hi Phil,

Great to hear you’re keen on having another go! There seems to be a lot of demand to get get this driver working judging by the posts on the forum but very few people seem to have succeed and noone has posted the final device tree and driver when they do get it to work.

The code in this gist https://gist.github.com/nyacg/becd94a029355825a05f633f38a25b46 is very close to what I have now, and works just as well/badly as any changes I’ve made since.

Other things:

  • It seems to be important to disable the camera plugin manager
  • I’ve found compiling the code as a module has made iterating on development much much faster (when I first started out I was re-flashing the Nano on every change which was painfully slow)
  • I lack the nvcsi in my device tree and I’ve not yet managed to get the one @electrixoul posted to work, I’m planning to have another attempt on the weekend

Out of interest are you using the Auvidea B101 or a different/custom board for the tc358743?

The more heads we put together on this openly the more likely we’ll get to a working driver for everyone to use!

Cheers,
Robert

Thanks for the reply Robert, I am using a generic tc358743 board although I think that I have a B101 somewhere that I bought for another project.

This is the board that I am using at the moment but I will try to find my B101 as well. https://www.bilibili.com/video/av50329206/

Cheers

Phil

Hi, Robert
the dtsi file I posted has some problems in nvcsi as it seems not working very stable , there are 70% chance it boots up not recognizing “TMDS signal” . I will fix this issue and post the correct dtsi file as soon as I can !

I’m using the same board :-D

Hi Robert,

Using your tc358743.c I get compile errors about tc358743_platform_data missing encpoint and reset_gpio members. I assume that there are also edits to tc358743.h?

Cheers

Phil

yes, you have to modify the includes:


#define DEBUG
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/interrupt.h>
#include <linux/videodev2.h>
#include <linux/workqueue.h>
#include <linux/v4l2-dv-timings.h>
#include <linux/hdmi.h>
#include <media/v4l2-dv-timings.h>
#include <media/v4l2-device.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-event.h>
#include <media/v4l2-of.h>
#include <media/camera_common.h>

#include <dt-bindings/gpio/tegra-gpio.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/gpio.h>
#include <linux/module.h>

#include <linux/seq_file.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/of_gpio.h>

#include <linux/i2c-dev.h>
#include <linux/fs.h>

// #include <media/v4l2-chip-ident.h>
#include <media/tegra-v4l2-camera.h>
#include <media/camera_common.h>
#include <media/soc_camera.h>

#include “tc358743.h”
#include “tc358743_regs.h”

Hi, I don’t have a tc358743.h on my system?

I managed to get it to compile by adding:

    int reset_gpio;
    struct v4l2_of_endpoint endpoint;

to tc354743_platform_data within media/i2c/tc358743.h but I don’t know if that is correct?

Phil

take a look at this :
https://drive.google.com/open?id=1xU_np06RFsejqpCj66qDEYeuHCO-fPvH
I’m using header files from here

Thanks, I will have a look. I am just rebuilding my environment and Trying Jetpack 4.4.

I use these commands to compile & update the device-trees on Nano, you don’t have to flash the whole system each time you changed your device trees :

  1. compile dts files in path : <public_sources/kernel/kernel-4.9> , and move them to L4T dir <Linux_for_Tegra> :
make ARCH=arm64 O=$TEGRA_KERNEL_OUT -j7 && cp -r /home/electricsoul/Work/OpenDronePilot/JetsonNano_Driver_dev/public_sources/kernel/kernel-4.9/kernel_build/arch/arm64/boot/dts/* /home/electricsoul/Work/OpenDronePilot/JetsonNano_Driver_dev/Linux_for_Tegra/kernel/dtb
  1. put nano to Force-Recovery-Mode
  2. go to <Linux_for_Tegra> , flash DTS(only) to device :
sudo ./flash.sh -k DTB jetson-nano-qspi-sd mmcblk0p1
  1. then remove Force Recovery Mode pin, system will boot automatically

That’s not an option for me at the moment as I am using a remote machine to compile so can’t connect it to the Nano by USB. I am struggling to the the TC358743 recognised by the Nano at the moment. I had more success when I tried it a few months ago but can’t seem to find what I did to get it detected!

I have #include “tegra210-tc358743.dtsi” in tegra210-jetson-cv-base-p2597-2180-a00.dts is this correct?

so far I got the best result with these set of code :


  1. public_sources/hardware/nvidia/platform/t210/porg/kernel-dts/tc358743.dtsi
  2. public_sources/hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-porg-p3448-common.dtsi
  3. public_sources/kernel/nvidia/drivers/media/i2c/tc358743.c
  4. public_sources/kernel/nvidia/drivers/media/i2c/tc358743.h
  5. public_sources/kernel/nvidia/drivers/media/i2c/tc358743_regs.h

Great thanks for that. I was off a bit I think, memory isn’t what it used to be!

in order to make the driver work properly, you should connect:
“INT” pin of H2C -> “pin33” of Nano
like this :

2 Likes

@robert.j.h.chandler @phil1 current version of driver can only probe and connect correctly , still trying to get csi data stream