Porting Driver from Jetson Nano to Jetson Orin NX

Hi folks,

we are porting a driver from the NVIDIA Jetson Nano Platform (using the Development Kit B) to the Jetson Orin NX running in an Seeed-Studio J401 Carrier Board.

At the moment the Camera gets detected by the driver and is available as /dev/video0 and we are able to take pictures via “v4l2-ctl”. The problem is, that those pictures just do not look right:

Expected result:

Actual result (sensor not covered):

Actual result (Sensor covered with Hand):

We do think that it might be a clock problem, but we do not know how to set the clocks properly. In the NVIDIA Jetson Nano DTB the clocks are set as followed:

DTB of Jetson Nano (not 100% sure why cam_i2cmux and i2c@0 are disabled, but it is working):

cam_i2cmux {
		compatible = "i2c-mux-gpio";
		#address-cells = <0x01>;
		#size-cells = <0x00>;
		mux-gpios = <0x5b 0x40 0x00>;
		i2c-parent = <0xad>;
		status = "disabled";
		linux,phandle = <0xcb>;
		phandle = <0xcb>;

		i2c@0 {
			status = "disabled";
			reg = <0x00>;
			#address-cells = <0x01>;
			#size-cells = <0x00>;
			linux,phandle = <0xcc>;
			phandle = <0xcc>;

			imx485_a@1a {
				compatible = "test,imx485";
				reg = <0x1a>;
				devnode = "video0";
				physical_w = "20.00";
				physical_h = "16.80";
				sensor_model = "imx485";
				post_crop_frame_drop = [30 00];
				use_decibel_gain = "true";
				delayed_gain = "false";
				use_sensor_mode_id = "false";
				clocks = <0x26 0x117>;
				clock-names = "clk_out_3";
				mclk = "clk_out_3";
				clock-frequency = <0x2367b88>;
				reset-gpios = <0x5b 0x97 0x00>;
				linux,phandle = <0x12c>;
				phandle = <0x12c>;

				mode0 {
					mclk_khz = "37125";
					num_lanes = [32 00];
					tegra_sinterface = "serial_a";
					phy_mode = "DPHY";
					discontinuous_clk = "yes";
					dpcm_enable = "false";
					cil_settletime = [30 00];
					active_w = "3864";
					active_h = "2180";
					dynamic_pixel_bit_depth = "12";
					csi_pixel_bit_depth = "12";
					mode_type = "bayer";
					pixel_phase = "rggb";
					readout_orientation = [30 00];
					line_length = "6600";
					inherent_gain = [31 00];
					mclk_multiplier = "20.48";
					pix_clk_hz = "760000000";
					gain_factor = "10";
					min_gain_val = [30 00];
					max_gain_val = "720";
					step_gain_val = [33 00];
					default_gain = [30 00];
					min_hdr_ratio = [31 00];
					max_hdr_ratio = "64";
					framerate_factor = "1000000";
					min_framerate = "1500000";
					max_framerate = "32000000";
					step_framerate = [31 00];
					default_framerate = "30000000";
					exposure_factor = "1000000";
					min_exp_time = "27";
					max_exp_time = "660000";
					step_exp_time = [31 00];
					default_exp_time = "10000";
					embedded_metadata_height = [31 00];
				};

				mode1 {
					mclk_khz = "37125";
					num_lanes = [32 00];
					tegra_sinterface = "serial_a";
					phy_mode = "DPHY";
					discontinuous_clk = "yes";
					dpcm_enable = "false";
					cil_settletime = [30 00];
					active_w = "1920";
					active_h = "1080";
					dynamic_pixel_bit_depth = "12";
					csi_pixel_bit_depth = "12";
					mode_type = "bayer";
					pixel_phase = "rggb";
					readout_orientation = [30 00];
					line_length = "6600";
					inherent_gain = [31 00];
					mclk_multiplier = "20.48";
					pix_clk_hz = "760000000";
					gain_factor = "10";
					min_gain_val = [30 00];
					max_gain_val = "720";
					step_gain_val = [33 00];
					default_gain = [30 00];
					min_hdr_ratio = [31 00];
					max_hdr_ratio = "64";
					framerate_factor = "1000000";
					min_framerate = "1500000";
					max_framerate = "63000000";
					step_framerate = [31 00];
					default_framerate = "60000000";
					exposure_factor = "1000000";
					min_exp_time = "27";
					max_exp_time = "660000";
					step_exp_time = [31 00];
					default_exp_time = "10000";
					embedded_metadata_height = [31 00];
				};

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

					port@0 {
						reg = <0x00>;

						endpoint {
							port-index = <0x00>;
							bus-width = <0x02>;
							remote-endpoint = <0x78>;
							linux,phandle = <0x79>;
							phandle = <0x79>;
						};
					};
				};
			};

DTB of Jetson Orin NX:

cam_i2cmux {
		compatible = "i2c-mux-gpio";
		#address-cells = <0x01>;
		#size-cells = <0x00>;
		mux-gpios = <0x64 0x13 0x00>;
		i2c-parent = <0x2bf>;
		status = "okay";

		i2c@0 {
			reg = <0x00>;
			#address-cells = <0x01>;
			#size-cells = <0x00>;
			status = "okay";
			phandle = <0x488>;

			imx485_a@1a {
				status = "okay";
				compatible = "test,imx485";
				reg = <0x1a>;
				devnode = "video0";
				physical_w = "20.00";
				physical_h = "16.80";
				sensor_model = "imx485";
				post_crop_frame_drop = [30 00];
				use_decibel_gain = "true";
				delayed_gain = "false";
				use_sensor_mode_id = "false";
				reset-gpios = <0x05 0x3e 0x00>;
				phandle = <0x489>;

				mode0 {
					mclk_khz = "37125";
					num_lanes = [32 00];
					tegra_sinterface = "serial_a";
					phy_mode = "DPHY";
					discontinuous_clk = "yes";
					dpcm_enable = "false";
					cil_settletime = [30 00];
					dynamic_pixel_bit_depth = "12";
					csi_pixel_bit_depth = "12";
					mode_type = "bayer";
					pixel_phase = "rggb";
					active_w = "3840";
					active_h = "2160";
					readout_orientation = [30 00];
					line_length = "988";
					inherent_gain = [31 00];
					mclk_multiplier = "7.37";
					pix_clk_hz = "273715200";
					gain_factor = "1";
					min_gain_val = [30 00];
					max_gain_val = "300";
					step_gain_val = [33 00];
					default_gain = [30 00];
					min_hdr_ratio = [31 00];
					max_hdr_ratio = [31 00];
					framerate_factor = "1000000";
					min_framerate = "2500000";
					max_framerate = "33000000";
					step_framerate = [31 00];
					default_framerate = "33000000";
					exposure_factor = "1000000";
					min_exp_time = "450";
					max_exp_time = "400000";
					step_exp_time = [31 00];
					default_exp_time = "16667";
					embedded_metadata_height = [31 00];
				};

				mode1 {
					mclk_khz = "37125";
					num_lanes = [32 00];
					tegra_sinterface = "serial_a";
					phy_mode = "DPHY";
					discontinuous_clk = "yes";
					dpcm_enable = "false";
					cil_settletime = [30 00];
					active_w = "1920";
					active_h = "1080";
					dynamic_pixel_bit_depth = "12";
					csi_pixel_bit_depth = "12";
					mode_type = "bayer";
					pixel_phase = "rggb";
					readout_orientation = [30 00];
					line_length = "6600";
					inherent_gain = [31 00];
					mclk_multiplier = "20.48";
					pix_clk_hz = "760000000";
					gain_factor = "10";
					min_gain_val = [30 00];
					max_gain_val = "720";
					step_gain_val = [33 00];
					default_gain = [30 00];
					min_hdr_ratio = [31 00];
					max_hdr_ratio = "64";
					framerate_factor = "1000000";
					min_framerate = "1500000";
					max_framerate = "63000000";
					step_framerate = [31 00];
					default_framerate = "60000000";
					exposure_factor = "1000000";
					min_exp_time = "27";
					max_exp_time = "660000";
					step_exp_time = [31 00];
					default_exp_time = "10000";
					embedded_metadata_height = [31 00];
				};

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

					port@0 {
						reg = <0x00>;

						endpoint {
							port-index = <0x00>;
							bus-width = <0x02>;
							remote-endpoint = <0x2c0>;
							phandle = <0x48a>;
						};
					};
				};
			};

If we add the entries:

clocks = <0x26 0x117>;
clock-names = "clk_out_3";
mclk = "clk_out_3";
clock-frequency = <0x2367b88>;

from the Jetson DTB to the Orin DTB the camera does not work at all anymore and the Driver gives me the following errors in dmesg:

[   10.937334] imx485: loading out-of-tree module taints kernel.
[   10.948847] imx485 9-001a: probing v4l2 sensor at addr 0x1a
[   10.948901] imx485 9-001a: imx485_parse_dt: Parse dtb
[   10.954198] imx485 9-001a: avdd, iovdd and/or dvdd reglrs. not present, assume sensor powered independently
[   10.954208] OF: /cam_i2cmux/i2c@0/imx485_a@1a: could not get #clock-cells for /thermal-zones/SOC2-therm/trips/soc2-sw-throttle
[   10.965939] imx485 9-001a: unable to get clock clk_out_3
[   10.971399] imx485 9-001a: unable to power get
[   10.975961] imx485 9-001a: tegra camera driver registration failed
[   10.982522] imx485: probe of 9-001a failed with error -14

dmesg output on Jetson Nano for comparison:

[    6.093097] imx485: loading out-of-tree module taints kernel.
[    6.093797] imx485 7-001a: imx485_parse_dt: Parse dtb
[    6.094015] imx485 7-001a: tegracam sensor driver:imx485_v2.0.6
[    6.395884] imx485 7-001a: imx485_power_off: power off
[    6.397011] vi 54080000.vi: subdev imx485 7-001a bound

Im quite confident, that the camera will work after adding the correct clocks, but i don’t now which clocks to use on the Orin.

Any help would be greatly appreciated!

hello triemer,

can you confirm those message has gone after adding the correct clocks?
BTW, there’s developer guide, Camera Sensor Drivers Porting for your reference.

@JerryChang thank you for your response.

I do not know what the correct clocks are? How do I know which clocks to use?

Thank you
Timo

hello triemer,

please refer to Jetson Orin NX Series and Orin Nano Series Design Guide.
you may check [Table 10-1. Orin Module CSI Pin Descriptions] or [Figure 10-3. Available Camera Control Pins] to review the connections.

Hi @JerryChang ,

thank you very much. We got the Camera working on l4t 5.1.1. On l4t 5.1.2 the same driver and dtb won’t work. I get the following error:

timo@testsetup:~$ sudo dmesg | grep imx
[   10.771551] test_imx485: loading out-of-tree module taints kernel.
[   10.771641] test_imx485: module verification failed: signature and/or required key missing - tainting kernel
[   10.788142] imx219 10-0010: tegracam sensor driver:imx219_v2.0.6
[   10.793945] test_imx485 9-001a: Probing for sensor eimx485
[   10.793952] test_imx485 9-001a: adapter name i2c-2-mux (chan_id 0)
[   10.793957] test_imx485 9-001a: HALLO
[   10.793959] test_imx485 9-001a: address: 26
[   10.827973] tegra-camrtc-capture-vi tegra-capture-vi: subdev imx219 10-0010 bound
[   10.829913] test_imx485 9-001a: width=3840  height=2160     frate=33
[   10.829918] test_imx485 9-001a: width=1920  height=1080     frate=60
[   10.830035] test_imx485 9-001a: tegracam sensor driver:imx485_v1.0.9
[   10.830037] test_imx485 9-001a: cam_probe : Use_sensor_mode_id = 1
[   10.830039] test_imx485 9-001a: cam_power_on: power on
[   10.830457] test_imx485 9-001a: cam_fill_string_ctrl[803] Set!
[   10.830461] test_imx485 9-001a: ctrl Gain range update failed
[   10.837652] test_imx485 9-001a: Error -34 updating mode specific control ranges
[   10.860157] test_imx485 9-001a: Error -34 updating control ranges
[   10.867658] test_imx485 9-001a: Failed to init ctrls imx485
[   10.876949] test_imx485 9-001a: tegra camera subdev registration failed
[   10.888336] test_imx485: probe of 9-001a failed with error -34

Is this caused by the failed module verification?
Is the driver signing enabled by default in the default kernel Image?

Thank you!

it looks sensor has probed.
the error has reported with incorrect gain range, could you please review the device tree settings for your gain settings.
BTW, it’s suggest you create a new topic to follow-up this failure.
thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.