TX2 NX vs Jetson Nano camera

Hi,
i have a camera that is working on jetson Nano, i moved to TX2 NX module with making change on device tree:
bellow changes:

host1x {
		
		vi@15700000 {
			status = "okay";
			num-channels = <1>;
			ports {
				status = "okay";
				#address-cells = <1>;
				#size-cells = <0>;
				port@0 {
					status = "okay";
					reg = <0>;
					ov7251_vi_in0: endpoint {
						status = "okay";
						port-index = <0>;
						bus-width = <1>;
						remote-endpoint = <&ov7251_csi_out0>;
					};
				};
			};
		};
 
		nvcsi@150c0000  {
			status = "okay";
			num-channels = <1>;
			#address-cells = <1>;
			#size-cells = <0>;
			channel@0 {
				status = "okay";
				reg = <0>;
				ports {
					#address-cells = <1>;
					#size-cells = <0>;
					port@0 {
						status = "okay";
						reg = <0>;
						ov7251_csi_in0: endpoint@0 {
							status = "okay";
							port-index = <0>;
							bus-width = <1>;
							remote-endpoint = <&ov7251_cam_out0>;
						};
					};
					port@1 {
						status = "okay";
						reg = <1>;
						ov7251_csi_out0: endpoint@1 {
							status = "okay";
							remote-endpoint = <&ov7251_vi_in0>;
						};
					};
				};
			};
		};


		i2c_ov7251: i2c@3180000  {
                        status = "okay";
			cam_ov7251: ov7251@60  {
				compatible = "nvidia,ov7251";
				reg = <0x60>;
				status = "okay";

				/* V4L2 device node location */
				devnode = "video0";

				/* Physical dimensions of sensor */
				physical_w = "1.968";
				physical_h = "1.488";
												
				/* ie. clocks, io pins, power sources */
				pwdn-gpios = <&tegra_main_gpio CAM0_PWDN GPIO_ACTIVE_HIGH>;
				clocks = <&tegra_car TEGRA186_CLK_EXTPERIPH1>,<&tegra_car TEGRA186_CLK_PLLP_OUT0>;
				clock-names = "extperiph1", "pllp_grtba";
				mclk = "extperiph1";
				clock-frequency = <24000000>;

...

tcpOV7251: tegra-camera-platform {
		compatible = "nvidia, tegra-camera-platform";
		status="okay";

		num_csi_lanes = <2>;
		max_lane_speed = <1500000>;
		min_bits_per_pixel = <10>;
		vi_peak_byte_per_pixel = <2>;
		vi_bw_margin_pct = <25>;
		isp_peak_byte_per_pixel = <5>;
		isp_bw_margin_pct = <25>;
		
		modules {
			status="okay";
			cam_module0: module0 {
				status="okay";
				badge = "ov7251_bottom1_ov7251";
				position = "bottom";
				orientation = "0";
				cam_module0_drivernode0: drivernode0 {
					status="okay";
					pcl_id = "v4l2_sensor";
					devname = "ov7251 6-0060";
					proc-device-tree = "/proc/device-tree/i2c_ov7251/cam_ov7251";
				};
			};
	
		};	

I can see that the VI/CSI is bound

[    3.761708] nvcsi 150c0000.nvcsi: initialized
[    3.762543] tegra-vi4 15700000.vi: using default number of vi channels,15
[    3.764653] Wake83 for irq=51
[    3.764734] gpio tegra-gpio-aon wake29 for gpio=56(FF:0)
[    3.764861] input: gpio-keys as /devices/gpio-keys/input/input2
[    3.766002] tegra-vi4 15700000.vi: initialized
[    3.766745] tegra-vi4 15700000.vi: subdev 150c0000.nvcsi--1 bound

However, the camera is not invoked from I2C ( i removed eeprom from plugin-manager).
moreover, i can’t detect camera with :

root@jetson-xavier-nx-devkit-tx2-nx:~# i2cdetect -y -r 2
60: [  420.661673] tegra-i2c 3180000.i2c: no acknowledge from address 0x60

Any idea?

Also when i compare I2c dtc settings for both Nano and TX2 :
Nano

	i2c7: i2c@546c0000 {
			#address-cells = <1>;
			#size-cells = <0>;
			compatible = "nvidia,tegra210-vii2c";
			reg = <0x0 0x546C0000 0x0 0x00034000>;
			iommus = <&smmu TEGRA_SWGROUP_VII2C>;
			interrupts = <0 17 0x04>;
			scl-gpio = <&gpio TEGRA_GPIO(S, 2) 0>;
			sda-gpio = <&gpio TEGRA_GPIO(S, 3) 0>;
			status = "disabled";
			clocks = <&tegra_car TEGRA210_CLK_VI_I2C>,
				<&tegra_car TEGRA210_CLK_I2CSLOW>,
				<&tegra_car TEGRA210_CLK_HOST1X>;
			clock-names = "vii2c", "i2cslow", "host1x";
			resets = <&tegra_car 208>;
			reset-names = "vii2c";
			clock-frequency = <400000>;
		};

TX2 (NX)


	cam_i2c: i2c@3180000 {
		#address-cells = <1>;
		#size-cells = <0>;
		iommus = <&smmu TEGRA_SID_GPCDMA_0>;
		compatible = "nvidia,tegra186-i2c";
		reg = <0x0 0x3180000 0x0 0x100>;
		interrupts = <0 TEGRA186_IRQ_I2C3 0x04>;
		scl-gpio = <&tegra_main_gpio TEGRA_MAIN_GPIO(O, 2) 0>;
		sda-gpio = <&tegra_main_gpio TEGRA_MAIN_GPIO(O, 3) 0>;
		status = "disabled";
		clock-frequency = <400000>;
		clocks = <&tegra_car TEGRA186_CLK_I2C3
			&tegra_car TEGRA186_CLK_PLLP_OUT0
			&tegra_car TEGRA186_CLK_I2C_SLOW>;
		clock-names = "div-clk", "parent", "slow-clk";
		resets = <&tegra_car TEGRA186_RESET_I2C3>;
		reset-names = "i2c";
		dmas = <&gpcdma 23>, <&gpcdma 23>;
		dma-names = "rx", "tx";
	};

There is an equivalent for tegra210-vii2c for TX2?

Nano:

TX2 NX:


hello ahadach,

this is correct,
note, TX2 NX it’s by default using cam_i2c for camera i2c bus.
as you can see via device tree sources,
i.e. kernel_src/hardware/nvidia/platform/t18x/lanai/kernel-dts/common/tegra186-camera-lanai-rbpcv2-imx219.dtsi
they’re using i2c mux for sharing the i2c bus,
for example,

        cam_i2cmux{
                i2c-parent = <&cam_i2c>;

                i2c@0 {
                        rbpcv2_imx219_a@10 {
                i2c@1 {
                        rbpcv2_imx219_c@10 {

and,
kernel_src/hardware/nvidia/platform/t18x/lanai/kernel-dts/common/tegra186-camera-rbpcv2-imx219.dtsi
define the tegra-camera-platform{} as following,

proc-device-tree = "/proc/device-tree/cam_i2cmux/i2c@0/rbpcv2_imx219_a@10";
proc-device-tree = "/proc/device-tree/cam_i2cmux/i2c@1/rbpcv2_imx219_c@10";

your failure looks like you did not given correct power supply to this i2c bus.

hence,
please review the regulator settings, and please double check you’re connect to the correct i2c bus.
thanks

You mean TX2 NX internal 3.3v regulator settings?
Could you share settings or DTC file.

hello ahadach,

did you port the driver from Nano to TX2 NX?
suggest you should review below device tree and revise the code to adapt your sensor driver.
for example,
$L4T_Sources/r32.6.1/Linux_for_Tegra/source/public/hardware/nvidia/platform/t18x/lanai/kernel-dts/common/tegra186-camera-rbpcv2-imx219.dtsi

Yes, but the driver should work without porting?!, i need only to adapte the device tree. I used the sample that you shared to adapte my device tree.

Could you share regulator settings to check with i2cdetect.

hello ahadach,

please access Camera Module Hardware Design Guide,
this design guide contains recommendations and guidelines for engineers to follow when designing a camera module for use with carrier boards for Jetson Nano, Jetson TX2 NX, and Jetson Xavier NX.
thanks

As i said the camera is working with Jetson Nano, No hardware change is needed when migrating from Nano to TX2 NX, only device tree changes are needed?!

Also i2cdetect is working for Nano.For me some thing is wrong on device tree or on TX2 NX module. i will check with the scope.

hello ahadach,

yes, you should only update the device tree sources to adapt the sensor driver to TX2 series.
BTW, you should note that the i2c bus also different, you’ll need to check Topic 180921 to enable /dev/i2c-7 interface.
thanks

Hello,
i found the root cause, the i2c_ov7251: i2c@3180000 was under host1x. but it’s working with nano (strange).
for i2cdetect, the camera wasn’t powered with dtc .

Thanks.