Orin NX CAM0:MAX9296+MAX9295+IMX390 gmsl camera

你好,这边在用Orin NX 16G官方套件调试GMSL时遇到点困难。
现在的方案是MAX9296+MAX9295+IMX390,解串板是自制的底板,接口有2CSI、2GMSL
目前用Orin NX的CAM1连接解串板上的CSI0,2个GSML都可以正常打开(video2、video3),但CAM0或CSI1都是无效的。
image
image

连接CAM0打开失败的log:failedGMSL0.log (89.5 KB)
连接CAM1打开video2成功的log:openGMSL2.log (88.4 KB)
连接CAM1打开video3成功的log:openGMSL3.log (88.1 KB)
附上部分代码:

i2c@0 {
reg = <0x00>;
#address-cells = <0x01>;
#size-cells = <0x00>;

		cam_0@1b {
			compatible = "sensing,sgx-yuv-gmsl2-0";
			reg = <0x1b>;
			def-addr = <0x10>;
			devnode = "video0";
			physical_w = "15.0";
			physical_h = "12.5";
			sensor_model = "sgx-yuv-gmsl2";
			post_crop_frame_drop = [30 00];
			use_decibel_gain = "false";
			use_sensor_mode_id = "true";
			clocks = <0x02 0x24 0x02 0x24>;
			clock-names = "extperiph1\0pllp_grtba";
			mclk = "extperiph1";
			sensing,gmsl-ser-device = <0x2cd>;
			sensing,gmsl-dser-device = <0x2ce>;

			mode0 {
				mclk_khz = "24000";
				num_lanes = [34 00];
				tegra_sinterface = "serial_c";
				vc_id = [30 00];
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = [30 00];
				dynamic_pixel_bit_depth = "16";
				csi_pixel_bit_depth = "16";
				mode_type = "yuv";
				pixel_phase = "uyvy";
				active_w = "1920";
				active_h = "1080";
				readout_orientation = [30 00];
				line_length = "2200";
				inherent_gain = [31 00];
				pix_clk_hz = "150000000";
				serdes_pix_clk_hz = "300000000";
				gain_factor = "1000";
				min_gain_val = [31 00];
				max_gain_val = "30000";
				step_gain_val = "300";
				default_gain = [30 00];
				min_hdr_ratio = [31 00];
				max_hdr_ratio = [31 00];
				framerate_factor = "1000000";
				min_framerate = "30000000";
				max_framerate = "30000000";
				step_framerate = [31 00];
				default_framerate = "30000000";
				exposure_factor = "1000000";
				min_exp_time = "59";
				max_exp_time = "33333";
				step_exp_time = [31 00];
				default_exp_time = "33333";
				embedded_metadata_height = [30 00];
			};

			mode1 {
				mclk_khz = "24000";
				num_lanes = [34 00];
				tegra_sinterface = "serial_a";
				vc_id = [30 00];
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = [30 00];
				dynamic_pixel_bit_depth = "16";
				csi_pixel_bit_depth = "16";
				mode_type = "yuv";
				pixel_phase = "uyvy";
				active_w = "1920";
				active_h = "1536";
				readout_orientation = [30 00];
				line_length = "2200";
				inherent_gain = [31 00];
				pix_clk_hz = "200000000";
				serdes_pix_clk_hz = "200000000";
				gain_factor = "1000";
				min_gain_val = [31 00];
				max_gain_val = "30000";
				step_gain_val = "300";
				default_gain = [30 00];
				min_hdr_ratio = [31 00];
				max_hdr_ratio = [31 00];
				framerate_factor = "1000000";
				min_framerate = "30000000";
				max_framerate = "30000000";
				step_framerate = [31 00];
				default_framerate = "30000000";
				exposure_factor = "1000000";
				min_exp_time = "59";
				max_exp_time = "33333";
				step_exp_time = [31 00];
				default_exp_time = "33333";
				embedded_metadata_height = [30 00];
			};

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

				port@0 {
					reg = <0x00>;

					endpoint {
						vc-id = <0x00>;
						port-index = <0x00>;
						bus-width = <0x04>;
						remote-endpoint = <0x2cf>;
						phandle = <0x289>;
					};
				};
			};

			gmsl-link {
				src-csi-port = [62 00];
				dst-csi-port = [61 00];
				serdes-csi-link = [61 00];
				csi-mode = "1x4";
				st-vc = <0x00>;
				vc-id = <0x00>;
				num-lanes = <0x04>;
				streams = "ued-u1\0yuv16";
			};
		};

		cam_1@1c {
			compatible = "sensing,sgx-yuv-gmsl2-1";
			reg = <0x1c>;
			def-addr = <0x10>;
			devnode = "video1";
			physical_w = "15.0";
			physical_h = "12.5";
			sensor_model = "sgx-yuv-gmsl2";
			post_crop_frame_drop = [30 00];
			use_decibel_gain = "false";
			use_sensor_mode_id = "true";
			clocks = <0x02 0x24 0x02 0x24>;
			clock-names = "extperiph1\0pllp_grtba";
			mclk = "extperiph1";
			sensing,gmsl-ser-device = <0x2d0>;
			sensing,gmsl-dser-device = <0x2ce>;

			mode0 {
				mclk_khz = "24000";
				num_lanes = [34 00];
				tegra_sinterface = "serial_a";
				vc_id = [31 00];
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = [30 00];
				dynamic_pixel_bit_depth = "16";
				csi_pixel_bit_depth = "16";
				mode_type = "yuv";
				pixel_phase = "uyvy";
				active_w = "1920";
				active_h = "1080";
				readout_orientation = [30 00];
				line_length = "2200";
				inherent_gain = [31 00];
				pix_clk_hz = "150000000";
				serdes_pix_clk_hz = "300000000";
				gain_factor = "1000";
				min_gain_val = [31 00];
				max_gain_val = "30000";
				step_gain_val = "300";
				default_gain = [30 00];
				min_hdr_ratio = [31 00];
				max_hdr_ratio = [31 00];
				framerate_factor = "1000000";
				min_framerate = "30000000";
				max_framerate = "30000000";
				step_framerate = [31 00];
				default_framerate = "30000000";
				exposure_factor = "1000000";
				min_exp_time = "59";
				max_exp_time = "33333";
				step_exp_time = [31 00];
				default_exp_time = "33333";
				embedded_metadata_height = [30 00];
			};

			mode1 {
				mclk_khz = "24000";
				num_lanes = [34 00];
				tegra_sinterface = "serial_c";
				vc_id = [31 00];
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = [30 00];
				dynamic_pixel_bit_depth = "16";
				csi_pixel_bit_depth = "16";
				mode_type = "yuv";
				pixel_phase = "uyvy";
				active_w = "1920";
				active_h = "1536";
				readout_orientation = [30 00];
				line_length = "2200";
				inherent_gain = [31 00];
				pix_clk_hz = "200000000";
				serdes_pix_clk_hz = "300000000";
				gain_factor = "1000";
				min_gain_val = [31 00];
				max_gain_val = "30000";
				step_gain_val = "300";
				default_gain = [30 00];
				min_hdr_ratio = [31 00];
				max_hdr_ratio = [31 00];
				framerate_factor = "1000000";
				min_framerate = "30000000";
				max_framerate = "30000000";
				step_framerate = [31 00];
				default_framerate = "30000000";
				exposure_factor = "1000000";
				min_exp_time = "59";
				max_exp_time = "33333";
				step_exp_time = [31 00];
				default_exp_time = "33333";
				embedded_metadata_height = [30 00];
			};

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

				port@0 {
					reg = <0x00>;

					endpoint {
						vc-id = <0x01>;
						port-index = <0x00>;
						bus-width = <0x04>;
						remote-endpoint = <0x2d1>;
						phandle = <0x28b>;
					};
				};
			};

			gmsl-link {
				src-csi-port = [62 00];
				dst-csi-port = [61 00];
				serdes-csi-link = [62 00];
				csi-mode = "1x4";
				st-vc = <0x00>;
				vc-id = <0x01>;
				num-lanes = <0x04>;
				streams = "ued-u1\0yuv16";
			};
		};

		max9296_0@48 {
			compatible = "maxim,max9296_0";
			reg = <0x48>;
			csi-mode = "2x4";
			max-src = <0x02>;
			reset-gpios = <0x50 0x3e 0x00>;
			phandle = <0x2ce>;
		};

		max9295_prim_0@40 {
			compatible = "maxim,max9295_0";
			reg = <0x40>;
			is-prim-ser;
			phandle = <0x493>;
		};

		max9295_0@60 {
			compatible = "maxim,max9295_0";
			reg = <0x60>;
			sensing,gmsl-dser-device = <0x2ce>;
			phandle = <0x2cd>;
		};

		max9295_1@62 {
			compatible = "maxim,max9295_0";
			reg = <0x62>;
			sensing,gmsl-dser-device = <0x2ce>;
			phandle = <0x2d0>;
		};

		rbpcv2_imx219_a@10 {

			mode0 {
				tegra_sinterface = "serial_b";
				lane_polarity = [36 00];
			};

			mode1 {
				tegra_sinterface = "serial_b";
				lane_polarity = [36 00];
			};

			mode2 {
				tegra_sinterface = "serial_b";
				lane_polarity = [36 00];
			};

			mode3 {
				tegra_sinterface = "serial_b";
				lane_polarity = [36 00];
			};

			mode4 {
				tegra_sinterface = "serial_b";
				lane_polarity = [36 00];
			};

			ports {

				port@0 {

					endpoint {
						port-index = <0x01>;
					};
				};
			};
		};

		rbpcv3_imx477_a@1a {

			mode0 {
				tegra_sinterface = "serial_b";
				lane_polarity = [36 00];
			};

			mode1 {
				tegra_sinterface = "serial_b";
				lane_polarity = [36 00];
			};

			ports {

				port@0 {

					endpoint {
						port-index = <0x01>;
					};
				};
			};
		};
	};

	i2c@1 {
		reg = <0x01>;
		#address-cells = <0x01>;
		#size-cells = <0x00>;

		cam_2@1b {
			compatible = "sensing,sgx-yuv-gmsl2-2";
			reg = <0x1b>;
			def-addr = <0x10>;
			devnode = "video2";
			physical_w = "15.0";
			physical_h = "12.5";
			sensor_model = "sgx-yuv-gmsl2";
			post_crop_frame_drop = [30 00];
			use_decibel_gain = "false";
			use_sensor_mode_id = "true";
			clocks = <0x02 0x24 0x02 0x24>;
			clock-names = "extperiph1\0pllp_grtba";
			mclk = "extperiph1";
			sensing,gmsl-ser-device = <0x2d2>;
			sensing,gmsl-dser-device = <0x2d3>;

			mode0 {
				mclk_khz = "24000";
				num_lanes = [34 00];
				tegra_sinterface = "serial_c";
				vc_id = [30 00];
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = [30 00];
				dynamic_pixel_bit_depth = "16";
				csi_pixel_bit_depth = "16";
				mode_type = "yuv";
				pixel_phase = "uyvy";
				active_w = "1920";
				active_h = "1080";
				readout_orientation = [30 00];
				line_length = "2200";
				inherent_gain = [31 00];
				pix_clk_hz = "150000000";
				serdes_pix_clk_hz = "300000000";
				gain_factor = "1000";
				min_gain_val = [31 00];
				max_gain_val = "30000";
				step_gain_val = "300";
				default_gain = [30 00];
				min_hdr_ratio = [31 00];
				max_hdr_ratio = [31 00];
				framerate_factor = "1000000";
				min_framerate = "30000000";
				max_framerate = "30000000";
				step_framerate = [31 00];
				default_framerate = "30000000";
				exposure_factor = "1000000";
				min_exp_time = "59";
				max_exp_time = "33333";
				step_exp_time = [31 00];
				default_exp_time = "33333";
				embedded_metadata_height = [30 00];
			};

			mode1 {
				mclk_khz = "24000";
				num_lanes = [34 00];
				tegra_sinterface = "serial_c";
				vc_id = [30 00];
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = [30 00];
				dynamic_pixel_bit_depth = "16";
				csi_pixel_bit_depth = "16";
				mode_type = "yuv";
				pixel_phase = "uyvy";
				active_w = "1920";
				active_h = "1536";
				readout_orientation = [30 00];
				line_length = "2200";
				inherent_gain = [31 00];
				pix_clk_hz = "200000000";
				serdes_pix_clk_hz = "300000000";
				gain_factor = "1000";
				min_gain_val = [31 00];
				max_gain_val = "30000";
				step_gain_val = "300";
				default_gain = [30 00];
				min_hdr_ratio = [31 00];
				max_hdr_ratio = [31 00];
				framerate_factor = "1000000";
				min_framerate = "30000000";
				max_framerate = "30000000";
				step_framerate = [31 00];
				default_framerate = "30000000";
				exposure_factor = "1000000";
				min_exp_time = "59";
				max_exp_time = "33333";
				step_exp_time = [31 00];
				default_exp_time = "33333";
				embedded_metadata_height = [30 00];
			};

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

				port@0 {
					reg = <0x00>;

					endpoint {
						vc-id = <0x00>;
						port-index = <0x02>;
						bus-width = <0x04>;
						remote-endpoint = <0x2d4>;
						phandle = <0x28d>;
					};
				};
			};

			gmsl-link {
				src-csi-port = [62 00];
				dst-csi-port = [61 00];
				serdes-csi-link = [61 00];
				csi-mode = "1x4";
				st-vc = <0x00>;
				vc-id = <0x00>;
				num-lanes = <0x04>;
				streams = "ued-u1\0yuv16";
			};
		};

		cam_3@1c {
			compatible = "sensing,sgx-yuv-gmsl2-3";
			reg = <0x1c>;
			def-addr = <0x10>;
			devnode = "video3";
			physical_w = "15.0";
			physical_h = "12.5";
			sensor_model = "sgx-yuv-gmsl2";
			post_crop_frame_drop = [30 00];
			use_decibel_gain = "false";
			use_sensor_mode_id = "true";
			clocks = <0x02 0x24 0x02 0x24>;
			clock-names = "extperiph1\0pllp_grtba";
			mclk = "extperiph1";
			sensing,gmsl-ser-device = <0x2d5>;
			sensing,gmsl-dser-device = <0x2d3>;

			mode0 {
				mclk_khz = "24000";
				num_lanes = [34 00];
				tegra_sinterface = "serial_c";
				vc_id = [31 00];
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = [30 00];
				dynamic_pixel_bit_depth = "16";
				csi_pixel_bit_depth = "16";
				mode_type = "yuv";
				pixel_phase = "uyvy";
				active_w = "1920";
				active_h = "1080";
				readout_orientation = [30 00];
				line_length = "2200";
				inherent_gain = [31 00];
				pix_clk_hz = "150000000";
				serdes_pix_clk_hz = "300000000";
				gain_factor = "1000";
				min_gain_val = [31 00];
				max_gain_val = "30000";
				step_gain_val = "300";
				default_gain = [30 00];
				min_hdr_ratio = [31 00];
				max_hdr_ratio = [31 00];
				framerate_factor = "1000000";
				min_framerate = "30000000";
				max_framerate = "30000000";
				step_framerate = [31 00];
				default_framerate = "30000000";
				exposure_factor = "1000000";
				min_exp_time = "59";
				max_exp_time = "33333";
				step_exp_time = [31 00];
				default_exp_time = "33333";
				embedded_metadata_height = [30 00];
			};

			mode1 {
				mclk_khz = "24000";
				num_lanes = [34 00];
				tegra_sinterface = "serial_c";
				vc_id = [31 00];
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = [30 00];
				dynamic_pixel_bit_depth = "16";
				csi_pixel_bit_depth = "16";
				mode_type = "yuv";
				pixel_phase = "uyvy";
				active_w = "1920";
				active_h = "1536";
				readout_orientation = [30 00];
				line_length = "2200";
				inherent_gain = [31 00];
				pix_clk_hz = "200000000";
				serdes_pix_clk_hz = "300000000";
				gain_factor = "1000";
				min_gain_val = [31 00];
				max_gain_val = "30000";
				step_gain_val = "300";
				default_gain = [30 00];
				min_hdr_ratio = [31 00];
				max_hdr_ratio = [31 00];
				framerate_factor = "1000000";
				min_framerate = "30000000";
				max_framerate = "30000000";
				step_framerate = [31 00];
				default_framerate = "30000000";
				exposure_factor = "1000000";
				min_exp_time = "59";
				max_exp_time = "33333";
				step_exp_time = [31 00];
				default_exp_time = "33333";
				embedded_metadata_height = [30 00];
			};

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

				port@0 {
					reg = <0x00>;

					endpoint {
						vc-id = <0x01>;
						port-index = <0x02>;
						bus-width = <0x04>;
						remote-endpoint = <0x2d6>;
						phandle = <0x28f>;
					};
				};
			};

			gmsl-link {
				src-csi-port = [62 00];
				dst-csi-port = [61 00];
				serdes-csi-link = [62 00];
				csi-mode = "1x4";
				st-vc = <0x00>;
				vc-id = <0x01>;
				num-lanes = <0x04>;
				streams = "ued-u1\0yuv16";
			};
		};

		max9296_1@48 {
			compatible = "maxim,max9296_1";
			reg = <0x48>;
			csi-mode = "2x4";
			max-src = <0x02>;
			reset-gpios = <0x50 0x3e 0x00>;
			phandle = <0x2d3>;
		};

		max9295_prim_0@40 {
			compatible = "maxim,max9295_1";
			reg = <0x40>;
			is-prim-ser;
			phandle = <0x494>;
		};

		max9295_2@60 {
			compatible = "maxim,max9295_1";
			reg = <0x60>;
			sensing,gmsl-dser-device = <0x2d3>;
			phandle = <0x2d2>;
		};

		max9295_3@62 {
			compatible = "maxim,max9295_1";
			reg = <0x62>;
			sensing,gmsl-dser-device = <0x2d3>;
			phandle = <0x2d5>;
		};
	};

现在想调试连接CAM0使摄像头正常使用。麻烦帮忙看下问题!
希望能得到回复,谢谢!

Dump the device tree to confirm the port-index/bus-width.

sudo dtc -I fs -O dts -o extracted_proc.dts /proc/device-tree

extracted_proc.dts.txt (425.9 KB)
目前来看port-index/bus-width是对得上的,不知道是不是要做调整。

This port-index=1 doesn’t correct. Suppose should be 0.

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

			port@0 {
				reg = <0x00>;

				endpoint {
					bus-width = <0x04>;
					remote-endpoint = <0x27f>;
					vc-id = <0x00>;
					port-index = <0x01>;
					phandle = <0x28a>;
				};
			};

..
..
..
			channel@0 {
				reg = <0x00>;

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

					port@0 {
						reg = <0x00>;

						endpoint@0 {
							bus-width = <0x04>;
							remote-endpoint = <0x289>;
							port-index = <0x01>;
							phandle = <0x2cf>;
						};
					};


你好,我把port-index修改为1的改为0后还是一样。
extracted_proc.dts.txt (425.9 KB)
image
以下是打开video0时的报错:

What’s the trace log.

https://elinux.org/Jetson/l4t/Camera_BringUp

这是打印出的log,麻烦看下。
trace.log (20.8 MB)

Add lane_polarity = “6”; to verify.

添加以后log有所变化,麻烦看下。
extracted_proc.dts.txt (426.1 KB)
trace.log (9.0 KB)
请教是否有可能与tegra_sinterface的设置有关呢?

For YUV sensor the tegra_sinterface can ignore it.
After add lane_polarity the trace looks didn’t receive any data from sensor that’s weird.

好的了解了,谢谢!
是的。还有没有什么方法可以去定位问题呢?

请问是否跟这个问题是一样的呢,J1不能用,如果是的话是调整max_gain_val的值吗?

You can try up date to r35.5 for this version implement calibrate to improve stability or try lower data rate to confirm it.

Thanks

比较麻烦的是我们需要在R35.4.1上应用。

试过了还是不行。
我查看了Orin NX的资料,关于CAM0和CAM1的支持不一样,是否与这个有关,需要不同的配置?


请问是否有Orin NX Camera相关的资料提供呢?谢谢!

Suppose you are using customized carrier camera board that shouldn’t have this problem. Please try the lower data rate to check.

Thanks

你好,调整后还是不行。
我现在想通过连接J21,修改CSI mode为1x2 lane去验证驱动,因为现在不行的J20只支持1x2lane。
调整了nvcsi@15a00000的bus-width等设置,但好像不行,可以麻烦帮忙看下吗?谢谢!
extracted_proc.dts.txt (425.2 KB)
trace.log (4.3 KB)

SPURIOUS_DATA of CSIMUX_STREAM that means the sensor output un-support package to the MIPI bus.

 kworker/4:1-71      [004] ....   151.072583: rtcpu_vinotify_event: tstamp:5403860868 cch:-1 vi:1 tag:CSIMUX_STREAM channel:0x20 frame:0 vi_tstamp:172915172512 data:0x0000000000000100

https://elinux.org/Jetson/l4t/Camera_BringUp

trace.log (50.5 MB)
你好,我重新调整了配置,但trace报告反复都是这个错误。
可以麻烦帮忙看下吗?谢谢!

There have err_intr_stat_ph_ecc_single_bit_err_vc0/err_intr_stat_pd_wc_short_err_vc0 error in the trace log.

trace.log (124.9 KB)
extracted_proc.dts.txt (425.2 KB)
你好!我调整配置之后有所改善,目前看链路好像是通了,摄像头可以打开,但是只有一瞬间的画面,马上就绿屏然后缩小了。



不确定这是与什么有关,可以麻烦帮忙看下吗?谢谢!!