Jetson NX Orin IMX477 CSI input 1 doesn't work however 0 and 2 do work

We have a custom carrier on a Jetson NX Orin, we have modified the device tree to support 3x cameras using ports 0, 1 and 2. Ports 0 and 2 do function as expected however port 1 doesn’t appear to be functioning. The setup is all CSI lanes go to the jetson as expected, however the i2c bus goes through a pca9547. It appears the i2c is atleast functioning given cam0 and cam2 do function.

Additionally this carrier was able to function with an NX Xavier so I know the carriers CSI lanes and correct in that sense.

This is happening with Jetpack 35.2.1 and Jetpack 35.3.1.

1 Like

The error I have is

          gst-launch-1.0 nvarguscamerasrc sensor-id=1 wbmode=0 ! "video/x-raw(memory:NVMM),format=(string)NV12,width=(int)3840,height=(int)2160,framerate=(fraction)30/1" ! nvvidconv flip-method=0 ! nvv4l2h264enc bitrate=8000000 insert-sps-pps=true ! rtph264pay mtu=1400 ! udpsink host=192.168.1.150 port=5004 sync=0 async=0 -e
          Setting pipeline to PAUSED ...
          Opening in BLOCKING MODE 
          Pipeline is live and does not need PREROLL ...
          Setting pipeline to PLAYING ...
          New clock: GstSystemClock
          Redistribute latency...
          NvMMLiteOpen : Block : BlockType = 4 
          ===== NVMEDIA: NVENC =====
          NvMMLiteBlockCreate : Block : BlockType = 4 
          GST_ARGUS: Creating output stream
          CONSUMER: Waiting until producer is connected...
          GST_ARGUS: Available Sensor modes :
          GST_ARGUS: 3840 x 2160 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 22.250000; Exposure Range min 13000, max 683709000;
          
          GST_ARGUS: 1920 x 1080 FR = 59.999999 fps Duration = 16666667 ; Analog Gain range min 1.000000, max 22.250000; Exposure Range min 13000, max 683709000;
          
          GST_ARGUS: Running with following settings:
             Camera index = 1 
             Camera mode  = 0 
             Output Stream W = 3840 H = 2160 
             seconds to Run    = 0 
             Frame Rate = 29.999999 
          GST_ARGUS: Setup Complete, Starting captures for 0 seconds
          GST_ARGUS: Starting repeat capture requests.
          CONSUMER: Producer has connected; continuing.
          nvbuf_utils: dmabuf_fd -1 mapped entry NOT found
          Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, threadExecute:694 NvBufSurfaceFromFd Failed.
          Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, threadFunction:247 (propagating)
          Got EOS from element "pipeline0".
          Execution ended after 0:00:04.046505806
          Setting pipeline to NULL ...
          GST_ARGUS: Cleaning up

The modified file for this device tree is as follows, it is combined into one file.

#define CAM0_PWDN	TEGRA234_MAIN_GPIO(H, 6)
#define CAM1_PWDN	TEGRA234_MAIN_GPIO(AC, 0)
#define CAM2_PWDN	TEGRA234_MAIN_GPIO(AC, 2)
#define CAMERA_I2C_MUX_BUS(x)	(0x1E + x)

/ {
	tegra-capture-vi  {
		num-channels = <3>;
		status = "okay";
		ports {
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";
			vi_port0: port@0 {
				reg = <0>;
				status = "okay";
				rbpcv3_imx477_vi_in0: endpoint {
					status = "okay";
					port-index = <0>;
					bus-width = <2>;
					remote-endpoint = <&rbpcv3_imx477_csi_out0>;
				};
			};
			vi_port1: port@1 {
				reg = <1>;
				status = "okay";
				rbpcv3_imx477_vi_in1: endpoint {
					status = "okay";
					port-index = <1>;
					bus-width = <2>;
					remote-endpoint = <&rbpcv3_imx477_csi_out1>;
				};
			};
			vi_port2: port@2 {
				reg = <2>;
				status = "okay";
				rbpcv3_imx477_vi_in2: endpoint {
					status = "okay";
					port-index = <2>;
					bus-width = <2>;
					remote-endpoint = <&rbpcv3_imx477_csi_out2>;
				};
			};
		};
	};

	host1x@13e00000 {
		nvcsi@15a00000 {
			num-channels = <3>;
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";
			csi_chan0: channel@0 {
				reg = <0>;
				status = "okay";
				ports {
					#address-cells = <1>;
					#size-cells = <0>;
					status = "okay";
					csi_chan0_port0: port@0 {
						reg = <0>;
						status = "okay";
						rbpcv3_imx477_csi_in0: endpoint@0 {
							port-index = <0>;
							bus-width = <2>;
							remote-endpoint = <&rbpcv3_imx477_sensor_out0>;
						};
					};
					csi_chan0_port1: port@1 {
						reg = <1>;
						status = "okay";
						rbpcv3_imx477_csi_out0: endpoint@1 {
							status = "okay";
							remote-endpoint = <&rbpcv3_imx477_vi_in0>;
						};
					};
				};
			};
			csi_chan1: channel@1 {
				reg = <1>;
				status = "okay";
				ports {
					#address-cells = <1>;
					#size-cells = <0>;
					status = "okay";
					csi_chan1_port0: port@0 {
						reg = <0>;
						status = "okay";
						rbpcv3_imx477_csi_in1: endpoint@2 {
							status = "okay";
							port-index = <1>;
							bus-width = <2>;
							remote-endpoint = <&rbpcv3_imx477_sensor_out1>;
						};
					};
					csi_chan1_port1: port@1 {
						reg = <1>;
						status = "okay";
						rbpcv3_imx477_csi_out1: endpoint@3 {
							status = "okay";
							remote-endpoint = <&rbpcv3_imx477_vi_in1>;
						};
					};
				};
			};
			csi_chan2: channel@2 {
				reg = <2>;
				status = "okay";
				ports {
					#address-cells = <1>;
					#size-cells = <0>;
					status = "okay";
					csi_chan2_port0: port@0 {
						reg = <0>;
						status = "okay";
						rbpcv3_imx477_csi_in2: endpoint@4 {
							status = "okay";
							port-index = <2>;
							bus-width = <2>;
							remote-endpoint = <&rbpcv3_imx477_sensor_out2>;
						};
					};
					csi_chan2_port1: port@1 {
						reg = <1>;
						status = "okay";
						rbpcv3_imx477_csi_out2: endpoint@5 {
							status = "okay";
							remote-endpoint = <&rbpcv3_imx477_vi_in2>;
						};
					};
				};
			};
		};
	};
	
	i2c@3180000 {
		pca9547@70 {
			compatible = "nxp,pca9547";
			status = "okay";
			reg = <0x70>;
			#address-cells = <1>;
			#size-cells = <0>;
			skip_mux_detect;
			force_bus_start = <CAMERA_I2C_MUX_BUS(0)>;
			i2c@0 {
				reg = <0>;
				i2c-mux,deselect-on-exit;
				#address-cells = <1>;
				#size-cells = <0>;
				imx477_cam0: imx477_a@1a {
					compatible = "ridgerun,imx477";
					/* I2C device address */
					reg = <0x1a>;
					/* V4L2 device node location */
					devnode = "video0";
					/* Physical dimensions of sensor */
					physical_w = "3.680";
					physical_h = "2.760";
					sensor_model = "imx477";
					use_sensor_mode_id = "true";
						
					reset-gpios =<&tegra_main_gpio CAM0_PWDN GPIO_ACTIVE_HIGH>;
					mode0 { /* IMX477_MODE_3840x2160 */
						mclk_khz = "24000";
						num_lanes = "2";
						tegra_sinterface = "serial_a";
						phy_mode = "DPHY";
						discontinuous_clk = "no";
						dpcm_enable = "false";
						cil_settletime = "0";
						lane_polarity = "6";
						active_w = "3840";
						active_h = "2160";
						mode_type = "bayer";
						pixel_phase = "rggb";
						csi_pixel_bit_depth = "10";
						readout_orientation = "90";
						line_length = "11200";
						inherent_gain = "1";
						mclk_multiplier = "80";
						pix_clk_hz = "300000000";

						gain_factor = "16";
						framerate_factor = "1000000";
						exposure_factor = "1000000";
						min_gain_val = "16"; /* 1.00x */
						max_gain_val = "356"; /* 22x */
						step_gain_val = "1";
						default_gain = "16"; /* 1.00x */
						min_hdr_ratio = "1";
						max_hdr_ratio = "1";
						min_framerate = "2000000"; /* 2.0 fps */
						max_framerate = "30000000"; /* 30.0 fps */
						step_framerate = "1";
						default_framerate = "30000000"; /* 30.0 fps */
						min_exp_time = "13"; /* us */
						max_exp_time = "683709"; /* us */
						step_exp_time = "1";
						default_exp_time = "2495"; /* us */
			
						embedded_metadata_height = "2";
					};
					mode1 { /* IMX477_MODE_1920X1080 */
						mclk_khz = "24000";
						num_lanes = "2";
						tegra_sinterface = "serial_a";
						phy_mode = "DPHY";
						discontinuous_clk = "no";
						dpcm_enable = "false";
						cil_settletime = "0";
						lane_polarity = "6";
						active_w = "1920";
						active_h = "1080";
						mode_type = "bayer";
						pixel_phase = "rggb";
						csi_pixel_bit_depth = "10";
						readout_orientation = "90";
						line_length = "7000";
						inherent_gain = "1";
						mclk_multiplier = "80";
						pix_clk_hz = "300000000";
						gain_factor = "16";
						framerate_factor = "1000000";
						exposure_factor = "1000000";
						min_gain_val = "16"; /* 1.00x */
						max_gain_val = "356"; /* 22x */
						step_gain_val = "1";
						default_gain = "16"; /* 1.00x */
						min_hdr_ratio = "1";
						max_hdr_ratio = "1";
						min_framerate = "2000000"; /* 2.0 fps */
						max_framerate = "60000000"; /* 60.0 fps */
						step_framerate = "1";
						default_framerate = "60000000"; /* 60.0 fps */
						min_exp_time = "13"; /* us */
						max_exp_time = "683709"; /* us */
						step_exp_time = "1";
						default_exp_time = "2495"; /* us */

						embedded_metadata_height = "2";
					};
					ports {
						#address-cells = <1>;
						#size-cells = <0>;
						status = "okay";
						port@0 {
							reg = <0>;
							status = "okay";
							rbpcv3_imx477_sensor_out0: endpoint {
								status = "okay";
								port-index = <0>;
								bus-width = <2>;
								remote-endpoint = <&rbpcv3_imx477_csi_in0>;
							};
						};
					};
				};
			};
			i2c@1 {
				reg = <1>;
				i2c-mux,deselect-on-exit;
				#address-cells = <1>;
				#size-cells = <0>;
				imx477_cam1: imx477_b@1a {
					compatible = "ridgerun,imx477";
					/* I2C device address */
					reg = <0x1a>;
					/* V4L2 device node location */
					devnode = "video1";
					/* Physical dimensions of sensor */
					physical_w = "3.680";
					physical_h = "2.760";
					sensor_model = "imx477";
					use_sensor_mode_id = "true";
					
					reset-gpios =<&tegra_main_gpio CAM1_PWDN GPIO_ACTIVE_HIGH>;
					mode0 { /* IMX477_MODE_3840x2160 */
						mclk_khz = "24000";
						num_lanes = "2";
						tegra_sinterface = "serial_b";
						phy_mode = "DPHY";
						discontinuous_clk = "no";
						dpcm_enable = "false";
						cil_settletime = "0";
						lane_polarity = "0";
						active_w = "3840";
						active_h = "2160";
						mode_type = "bayer";
						pixel_phase = "rggb";
						csi_pixel_bit_depth = "10";
						readout_orientation = "90";
						line_length = "11200";
						inherent_gain = "1";
						mclk_multiplier = "80";
						pix_clk_hz = "300000000";
						gain_factor = "16";
						framerate_factor = "1000000";
						exposure_factor = "1000000";
						min_gain_val = "16"; /* 1.00x */
						max_gain_val = "356"; /* 22x */
						step_gain_val = "1";
						default_gain = "16"; /* 1.00x */
						min_hdr_ratio = "1";
						max_hdr_ratio = "1";
						min_framerate = "2000000"; /* 2.0 fps */
						max_framerate = "30000000"; /* 30.0 fps */
						step_framerate = "1";
						default_framerate = "30000000"; /* 30.0 fps */
						min_exp_time = "13"; /* us */
						max_exp_time = "683709"; /* us */
						step_exp_time = "1";
						default_exp_time = "2495"; /* us */
						embedded_metadata_height = "2";
					};
					mode1 { /* IMX477_MODE_1920X1080 */
						mclk_khz = "24000";
						num_lanes = "2";
						tegra_sinterface = "serial_b";
						phy_mode = "DPHY";
						discontinuous_clk = "no";
						dpcm_enable = "false";
						cil_settletime = "0";
						lane_polarity = "0";
						active_w = "1920";
						active_h = "1080";
						mode_type = "bayer";
						pixel_phase = "rggb";
						csi_pixel_bit_depth = "10";
						readout_orientation = "90";
						line_length = "7000";
						inherent_gain = "1";
						mclk_multiplier = "80";
						pix_clk_hz = "300000000";
						gain_factor = "16";
						framerate_factor = "1000000";
						exposure_factor = "1000000";
						min_gain_val = "16"; /* 1.00x */
						max_gain_val = "356"; /* 22x */
						step_gain_val = "1";
						default_gain = "16"; /* 1.00x */
						min_hdr_ratio = "1";
						max_hdr_ratio = "1";
						min_framerate = "2000000"; /* 2.0 fps */
						max_framerate = "60000000"; /* 60.0 fps */
						step_framerate = "1";
						default_framerate = "60000000"; /* 60.0 fps */
						min_exp_time = "13"; /* us */
						max_exp_time = "683709"; /* us */
						step_exp_time = "1";
						default_exp_time = "2495"; /* us */
						embedded_metadata_height = "2";
					};
					ports {
						#address-cells = <1>;
						#size-cells = <0>;
						status = "okay";
						port@0 {
							reg = <0>;
							status = "okay";
							rbpcv3_imx477_sensor_out1: endpoint {
								status = "okay";
								port-index = <1>;
								bus-width = <2>;
								remote-endpoint = <&rbpcv3_imx477_csi_in1>;
							};
						};
					};
				};
			};
			i2c@2 {
				reg = <2>;
				i2c-mux,deselect-on-exit;
				#address-cells = <1>;
				#size-cells = <0>;
				imx477_cam2: imx477_c@1a {
					compatible = "ridgerun,imx477";
					/* I2C device address */
					reg = <0x1a>;

					/* V4L2 device node location */
					devnode = "video2";
					/* Physical dimensions of sensor */
					physical_w = "3.680";
					physical_h = "2.760";
					sensor_model = "imx477";
					use_sensor_mode_id = "true";
					reset-gpios = <&tegra_main_gpio CAM2_PWDN GPIO_ACTIVE_HIGH>;

					mode0 { /* IMX477_MODE_3840x2160 */
						mclk_khz = "24000";
						num_lanes = "2";
						tegra_sinterface = "serial_c";
						phy_mode = "DPHY";
						discontinuous_clk = "no";
						dpcm_enable = "false";
						cil_settletime = "0";
						lane_polarity = "0";
						active_w = "3840";
						active_h = "2160";
						mode_type = "bayer";
						pixel_phase = "rggb";
						csi_pixel_bit_depth = "10";
						readout_orientation = "90";
						line_length = "11200";
						inherent_gain = "1";
						mclk_multiplier = "80";
						pix_clk_hz = "300000000";
						gain_factor = "16";
						framerate_factor = "1000000";
						exposure_factor = "1000000";
						min_gain_val = "16"; /* 1.00x */
						max_gain_val = "356"; /* 22x */
						step_gain_val = "1";
						default_gain = "16"; /* 1.00x */
						min_hdr_ratio = "1";
						max_hdr_ratio = "1";
						min_framerate = "2000000"; /* 2.0 fps */
						max_framerate = "30000000"; /* 30.0 fps */
						step_framerate = "1";
						default_framerate = "30000000"; /* 30.0 fps */
						min_exp_time = "13"; /* us */
						max_exp_time = "683709"; /* us */
						step_exp_time = "1";
						default_exp_time = "2495"; /* us */
						embedded_metadata_height = "2";
					};
					mode1 { /* IMX477_MODE_1920X1080 */
						mclk_khz = "24000";
						num_lanes = "2";
						tegra_sinterface = "serial_c";
						phy_mode = "DPHY";
						discontinuous_clk = "no";
						dpcm_enable = "false";
						cil_settletime = "0";
						lane_polarity = "0";
						active_w = "1920";
						active_h = "1080";
						mode_type = "bayer";
						pixel_phase = "rggb";
						csi_pixel_bit_depth = "10";
						readout_orientation = "90";
						line_length = "7000";
						inherent_gain = "1";
						mclk_multiplier = "80";
						pix_clk_hz = "300000000";
						gain_factor = "16";
						framerate_factor = "1000000";
						exposure_factor = "1000000";
						min_gain_val = "16"; /* 1.00x */
						max_gain_val = "356"; /* 22x */
						step_gain_val = "1";
						default_gain = "16"; /* 1.00x */
						min_hdr_ratio = "1";
						max_hdr_ratio = "1";
						min_framerate = "2000000"; /* 2.0 fps */
						max_framerate = "60000000"; /* 60.0 fps */
						step_framerate = "1";
						default_framerate = "60000000"; /* 60.0 fps */
						min_exp_time = "13"; /* us */
						max_exp_time = "683709"; /* us */
						step_exp_time = "1";
						default_exp_time = "2495"; /* us */
						embedded_metadata_height = "2";
					};
					ports {
						#address-cells = <1>;
						#size-cells = <0>;
						status = "okay";
						port@0 {
							reg = <0>;
							status = "okay";
							rbpcv3_imx477_sensor_out2: endpoint {
								status = "okay";
								port-index = <2>;
								bus-width = <2>;
								remote-endpoint = <&rbpcv3_imx477_csi_in2>;
							};
						};
					};
				};
			};
		};
	};	
};

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

		/**
		* Physical settings to calculate max ISO BW
		*
		* num_csi_lanes = <>;
		* Total number of CSI lanes when all cameras are active
		*
		* max_lane_speed = <>;
		* Max lane speed in Kbit/s
		*
		* min_bits_per_pixel = <>;
		* Min bits per pixel
		*
		* vi_peak_byte_per_pixel = <>;
		* Max byte per pixel for the VI ISO case
		*
		* vi_bw_margin_pct = <>;
		* Vi bandwidth margin in percentage
		*
		* max_pixel_rate = <>;
		* Max pixel rate in Kpixel/s for the ISP ISO case
		*
		* isp_peak_byte_per_pixel = <>;
		* Max byte per pixel for the ISP ISO case
		*
		* isp_bw_margin_pct = <>;
		* Isp bandwidth margin in percentage
		*/
		num_csi_lanes = <6>;
		max_lane_speed = <1500000>;
		min_bits_per_pixel = <10>;
		vi_peak_byte_per_pixel = <2>;
		vi_bw_margin_pct = <25>;
		max_pixel_rate = <7500000>;
		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 vendor.
		 */
		modules {
			status = "okay";
			cam_module0: module0 {
				badge = "imx477_0_477IMX";
				position = "0";
				orientation = "1";
				status = "okay";
				cam_module0_drivernode0: drivernode0 {
					status = "okay";
					pcl_id = "v4l2_sensor";
					devname = "imx477 30-001a";
					proc-device-tree = "/proc/device-tree/i2c@3180000/pca9547@70/i2c@0/imx477_a@1a";
				};
			};
			cam_module1: module1 {
				badge = "imx477_1_477IMX";
				position = "1";
				orientation = "1";
				status = "okay";
				cam_module1_drivernode0: drivernode0 {
					status = "okay";
					pcl_id = "v4l2_sensor";
					devname = "imx477 31-001a";
					proc-device-tree = "/proc/device-tree/i2c@3180000/pca9547@70/i2c@1/imx477_b@1a";
				};
			};
			cam_module2: module2 {
				badge = "imx477_2_477IMX";
				position = "2";
				orientation = "1";
				status = "okay";
				cam_module2_drivernode0: drivernode0 {
					status = "okay";
					pcl_id = "v4l2_sensor";
					devname = "imx477 32-001a";
					proc-device-tree = "/proc/device-tree/i2c@3180000/pca9547@70/i2c@2/imx477_c@1a";
				};
			};
		};
	};
};

An interesting point is that no matter what my devname is set to when I run “sudo dmesg | grep imx477” they will always be labeled 30-001a, 31-001a and 32-001a. This leads me to believe there is a file somewhere that I am not modifying correctly

hello nick99,

please note that, for Orin NX, CSI0 D1 and CSI1 D0 P/N will always been swizzled for P/N.

the failure here meant there’s no frames of sensor-id=1

          nvbuf_utils: dmabuf_fd -1 mapped entry NOT found
          Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, threadExecute:694 NvBufSurfaceFromFd Failed.
          Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, threadFunction:247 (propagating)
          Got EOS from element "pipeline0".

could you please double check which camera module (CSI-A, B, or C) it is causing the failure?

Can you explain what you mean by “CSI0 D1 and CSI1 D0 P/N will always been swizzled for P/N”? I’m not sure what you mean by this.

By covering each sensor and only installing one at a time I have been able to verify CSI-A and CSI-C are functioning. It appears to only be CSI-B that is failing.

You are correct, by changing the lane polarity of the second input to 6 I was able to get all 3 cameras working.

Many thanks, also had troubles with the Orin NX’ polarity inversion and was loosing my mind about it.

First thought on an issue with our custom carrier board but then reproduced exactly the same behavior on a NX DevKit.

Then looked into the camera driver (Vision Component IMX 265 based) when i found this.

Didn’t see any mention about this in the Xavier NX - Orin NX migration guide, only a mention about the number of CSI lanes going from 14 to 8. Might be a good point to document it there as well. Only found out about it when comparing side-by-side the developer guides of both Xavier NX and Orin NX which then helped me find this forum post.

Many thanks @JerryChang , as often the forum is the best source of documentation.

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