4 lane connected IMX477 throws error in `nvarguscamerasrc` `Failed to create CaptureSession`

I am trying to gstreamer video from an IMX477 camera connected to a 22 pin MIPI 4 lane port on the Jetson Orin NX. The same camera works when using a 15 pin MIPI dual lane connection instead. Below is some debug data to set the context.

v4l2-ctl --list-devices --all:

NVIDIA Tegra Video Input Device (platform:tegra-camrtc-ca):
        /dev/media0

vi-output, imx477 10-001a (platform:tegra-capture-vi:1):
        **/dev/video0**

Driver Info:
        Driver name      : tegra-video
        Card type        : vi-output, imx477 10-001a
        Bus info         : platform:tegra-capture-vi:1
        Driver version   : 5.15.136
        Capabilities     : 0x84200001
                Video Capture
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps      : 0x04200001
                Video Capture
                Streaming
                Extended Pix Format
Media Driver Info:
        Driver name      : tegra-camrtc-ca
        Model            : NVIDIA Tegra Video Input Device
        Serial           : 
        Bus info         : 
        Media version    : 5.15.136
        Hardware revision: 0x00000003 (3)
        Driver version   : 5.15.136
...

cat /boot/extlinux/extlinux.conf:

LABEL JetsonIO
        MENU LABEL Custom Header Config: <CSI Camera IMX477 Dual 4 lane> <M2KE User Custom [2024-09-09-171806]>
        LINUX /boot/Image
        FDT /boot/dtb/kernel_tegra234-p3768-0000+p3767-0000-nv.dtb
        INITRD /boot/initrd
        APPEND ${cbootargs} root=PARTUUID=ad065378-dc75-4fec-9dc3-8331b2bac9c3 rw rootwait rootfstype=ext4 mminit_loglevel=4 console=ttyTCU0,115200 firmware_class.path=/etc/firmware fbcon=map:0 net.ifnames=0 nospectre_bhb video=efifb:off console=tty0
        OVERLAYS **/boot/tegra234-p3767-camera-p3768-imx477-dual-4lane.dtbo**

GST_DEBUG=4 gst-launch-1.0 nvarguscamerasrc sensor-id=0 ! 'video/x-raw(memory:NVMM), width=1280, height=720, format=NV12, framerate=30/1' ! nvvidconv ! 'video/x-raw(memory:NVMM), width=1280, height=720' ! nvv4l2h265enc bitrate=4000000 preset-level=0 insert-sps-pps=1 iframeinterval=10 ! h265parse ! rtph265pay config-interval=1 ! udpsink host=192.168.1.38 port=5600 sync=false async=false:

NvMMLiteBlockCreate : Block : BlockType = 8 
0:00:00.247571445  3255 0xaaaae473ed80 WARN          v4l2bufferpool gstv4l2bufferpool.c:1116:gst_v4l2_buffer_pool_start:<nvv4l2h265enc0:pool:src> Uncertain or not enough buffers, enabling copy threshold
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:803 **Failed to create CaptureSession**

So from what I can tell the everything on the I2C side is correct but maybe something in the device tree overlay is messed up?

I have decompiled /boot/tegra234-p3767-camera-p3768-imx477-dual-4lane.dtbo and checked several times but the lane numbers and camera config all looks fine to me. Any ideas what could be causing this Failed to create CaptureSession error? Thanks!

Here is my gpio schematic showing how im connecting the the orin gpio pins. Everything seems in keeping with the docs.


@JerryChang I saw a post on Jetson NX Orin IMX477 CSI input 1 doesn't work however 0 and 2 do work - #3 by nick99 which might be related here if my custom carrier board has not accounted for the polarity inversion. Are you able to assist?

Hi @bcastor
Could you share the overlay file to see if you are missing changes?

The main thing would be to check the polarity but this only applies to some ports. The other possibility is that you are missing changes specific to capturing on 4-lanes.

You would need to update both the device-tree and the image sensor register tables to be able to correctly capture at 4-lanes.

Embedded SW Engineer at RidgeRun
Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com/
Website: www.ridgerun.com

Hi Jafeth. Please see below. I have tried changing lane_priority to 6 for both modes under i2c@0 without any improvement. I do not know what the image sensor register tables are.

/dts-v1/;

/ {
	overlay-name = "Camera IMX477 Dual 4 lane";
	jetson-header-name = "Jetson 24pin CSI Connector";
	compatible = "nvidia,p3768-0000+p3767-0000\0nvidia,p3768-0000+p3767-0001\0nvidia,p3768-0000+p3767-0003\0nvidia,p3768-0000+p3767-0004\0nvidia,p3768-0000+p3767-0005";

	fragment@0 {
		target-path = "/";

		__overlay__ {

			tegra-capture-vi {
				num-channels = <0x02>;

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

					port@0 {
						reg = <0x00>;

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

					port@1 {
						reg = <0x01>;

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

			tegra-camera-platform {
				compatible = "nvidia, tegra-camera-platform";
				num_csi_lanes = <0x04>;
				max_lane_speed = <0x16e360>;
				min_bits_per_pixel = <0x0a>;
				vi_peak_byte_per_pixel = <0x02>;
				vi_bw_margin_pct = <0x19>;
				max_pixel_rate = <0x7270e0>;
				isp_peak_byte_per_pixel = <0x05>;
				isp_bw_margin_pct = <0x19>;

				modules {

					module0 {
						badge = "jakku_front_RBPCV3";
						position = "front";
						orientation = "1";

						drivernode0 {
							pcl_id = "v4l2_sensor";
							sysfs-device-tree = "/sys/firmware/devicetree/base/bus@0/cam_i2cmux/i2c@0/rbpcv3_imx477_a@1a";
						};
					};

					module1 {
						badge = "jakku_rear_RBPCV3";
						position = "rear";
						orientation = "1";

						drivernode0 {
							pcl_id = "v4l2_sensor";
							sysfs-device-tree = "/sys/firmware/devicetree/base/bus@0/cam_i2cmux/i2c@1/rbpcv3_imx477_c@1a";
						};
					};
				};
			};

			bus@0 {

				host1x@13e00000 {

					nvcsi@15a00000 {
						num-channels = <0x02>;
						#address-cells = <0x01>;
						#size-cells = <0x00>;

						channel@0 {
							reg = <0x00>;

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

								port@0 {
									reg = <0x00>;

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

								port@1 {
									reg = <0x01>;

									endpoint@1 {
										remote-endpoint = <0x04>;
										phandle = <0x01>;
									};
								};
							};
						};

						channel@1 {
							reg = <0x01>;

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

								port@0 {
									reg = <0x00>;

									endpoint@2 {
										port-index = <0x02>;
										bus-width = <0x02>;
										remote-endpoint = <0x05>;
										phandle = <0x08>;
									};
								};

								port@1 {
									reg = <0x01>;

									endpoint@3 {
										remote-endpoint = <0x06>;
										phandle = <0x02>;
									};
								};
							};
						};
					};
				};

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

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

						rbpcv2_imx219_a@10 {
							status = "disabled";
						};

						rbpcv3_imx477_a@1a {
							reset-gpios = <0xffffffff 0x3e 0x00>;
							compatible = "ridgerun,imx477";
							reg = <0x1a>;
							devnode = "video0";
							physical_w = "3.680";
							physical_h = "2.760";
							sensor_model = "imx477";
							use_sensor_mode_id = "true";

							mode0 {
								mclk_khz = "24000";
								num_lanes = "4";
								tegra_sinterface = "serial_b";
								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 = "5832";
								inherent_gain = "1";
								mclk_multiplier = "80";
								pix_clk_hz = "600000000";
								gain_factor = "16";
								framerate_factor = "1000000";
								exposure_factor = "1000000";
								min_gain_val = "16";
								max_gain_val = "356";
								step_gain_val = "1";
								default_gain = "16";
								min_hdr_ratio = "1";
								max_hdr_ratio = "1";
								min_framerate = "2000000";
								max_framerate = "30000000";
								step_framerate = "1";
								default_framerate = "30000000";
								min_exp_time = "13";
								max_exp_time = "683709";
								step_exp_time = "1";
								default_exp_time = "2495";
								embedded_metadata_height = "2";
							};

							mode1 {
								mclk_khz = "24000";
								num_lanes = "4";
								tegra_sinterface = "serial_b";
								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 = "3076";
								inherent_gain = "1";
								mclk_multiplier = "80";
								pix_clk_hz = "600000000";
								gain_factor = "16";
								framerate_factor = "1000000";
								exposure_factor = "1000000";
								min_gain_val = "16";
								max_gain_val = "356";
								step_gain_val = "1";
								default_gain = "16";
								min_hdr_ratio = "1";
								max_hdr_ratio = "1";
								min_framerate = "2000000";
								max_framerate = "60000000";
								step_framerate = "1";
								default_framerate = "60000000";
								min_exp_time = "13";
								max_exp_time = "683709";
								step_exp_time = "1";
								default_exp_time = "2495";
								embedded_metadata_height = "2";
							};

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

								port@0 {
									reg = <0x00>;

									endpoint {
										port-index = <0x01>;
										bus-width = <0x04>;
										remote-endpoint = <0x07>;
										phandle = <0x03>;
									};
								};
							};
						};
					};

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

						rbpcv2_imx219_c@10 {
							status = "disabled";
						};

						rbpcv3_imx477_c@1a {
							reset-gpios = <0xffffffff 0xa0 0x00>;
							compatible = "ridgerun,imx477";
							reg = <0x1a>;
							devnode = "video1";
							physical_w = "3.680";
							physical_h = "2.760";
							sensor_model = "imx477";
							use_sensor_mode_id = "true";

							mode0 {
								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";
								max_gain_val = "356";
								step_gain_val = "1";
								default_gain = "16";
								min_hdr_ratio = "1";
								max_hdr_ratio = "1";
								min_framerate = "2000000";
								max_framerate = "30000000";
								step_framerate = "1";
								default_framerate = "30000000";
								min_exp_time = "13";
								max_exp_time = "683709";
								step_exp_time = "1";
								default_exp_time = "2495";
								embedded_metadata_height = "2";
							};

							mode1 {
								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";
								max_gain_val = "356";
								step_gain_val = "1";
								default_gain = "16";
								min_hdr_ratio = "1";
								max_hdr_ratio = "1";
								min_framerate = "2000000";
								max_framerate = "60000000";
								step_framerate = "1";
								default_framerate = "60000000";
								min_exp_time = "13";
								max_exp_time = "683709";
								step_exp_time = "1";
								default_exp_time = "2495";
								embedded_metadata_height = "2";
							};

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

								port@0 {
									reg = <0x00>;

									endpoint {
										status = "okay";
										port-index = <0x02>;
										bus-width = <0x02>;
										remote-endpoint = <0x08>;
										phandle = <0x05>;
									};
								};
							};
						};
					};
				};

				gpio@6000d000 {

					camera-control-output-low {
						gpio-hog;
						output-low;
						gpios = <0xa0 0x00 0x3e 0x00>;
						label = "cam1-pwdn\0cam0-pwdn";
					};
				};
			};
		};
	};

	__symbols__ {
		rbpcv3_imx477_vi_in0 = "/fragment@0/__overlay__/tegra-capture-vi/ports/port@0/endpoint";
		rbpcv3_imx477_vi_in1 = "/fragment@0/__overlay__/tegra-capture-vi/ports/port@1/endpoint";
		rbpcv3_imx477_csi_in0 = "/fragment@0/__overlay__/bus@0/host1x@13e00000/nvcsi@15a00000/channel@0/ports/port@0/endpoint@0";
		rbpcv3_imx477_csi_out0 = "/fragment@0/__overlay__/bus@0/host1x@13e00000/nvcsi@15a00000/channel@0/ports/port@1/endpoint@1";
		rbpcv3_imx477_csi_in1 = "/fragment@0/__overlay__/bus@0/host1x@13e00000/nvcsi@15a00000/channel@1/ports/port@0/endpoint@2";
		rbpcv3_imx477_csi_out1 = "/fragment@0/__overlay__/bus@0/host1x@13e00000/nvcsi@15a00000/channel@1/ports/port@1/endpoint@3";
		rbpcv3_imx477_out0 = "/fragment@0/__overlay__/bus@0/cam_i2cmux/i2c@0/rbpcv3_imx477_a@1a/ports/port@0/endpoint";
		rbpcv3_imx477_out1 = "/fragment@0/__overlay__/bus@0/cam_i2cmux/i2c@1/rbpcv3_imx477_c@1a/ports/port@0/endpoint";
	};

	__fixups__ {
		gpio_aon = "/fragment@0/__overlay__/bus@0/cam_i2cmux:mux-gpios:0";
		cam_i2c = "/fragment@0/__overlay__/bus@0/cam_i2cmux:i2c-parent:0";
		gpio = "/fragment@0/__overlay__/bus@0/cam_i2cmux/i2c@0/rbpcv3_imx477_a@1a:reset-gpios:0\0/fragment@0/__overlay__/bus@0/cam_i2cmux/i2c@1/rbpcv3_imx477_c@1a:reset-gpios:0";
	};

	__local_fixups__ {

		fragment@0 {

			__overlay__ {

				tegra-capture-vi {

					ports {

						port@0 {

							endpoint {
								remote-endpoint = <0x00>;
							};
						};

						port@1 {

							endpoint {
								remote-endpoint = <0x00>;
							};
						};
					};
				};

				bus@0 {

					host1x@13e00000 {

						nvcsi@15a00000 {

							channel@0 {

								ports {

									port@0 {

										endpoint@0 {
											remote-endpoint = <0x00>;
										};
									};

									port@1 {

										endpoint@1 {
											remote-endpoint = <0x00>;
										};
									};
								};
							};

							channel@1 {

								ports {

									port@0 {

										endpoint@2 {
											remote-endpoint = <0x00>;
										};
									};

									port@1 {

										endpoint@3 {
											remote-endpoint = <0x00>;
										};
									};
								};
							};
						};
					};

					cam_i2cmux {

						i2c@0 {

							rbpcv3_imx477_a@1a {

								ports {

									port@0 {

										endpoint {
											remote-endpoint = <0x00>;
										};
									};
								};
							};
						};

						i2c@1 {

							rbpcv3_imx477_c@1a {

								ports {

									port@0 {

										endpoint {
											remote-endpoint = <0x00>;
										};
									};
								};
							};
						};
					};
				};
			};
		};
	};
};

IMX477 4 lane configuration only working on cam1(CSI-C) for the devkit HW design.

Is there a reason why? I’m actually using a custom carrier breakout board (see diagram above). Also I just want to be able to get a single camera working over our MIPI 4 lane pinout.

@bcastor The image sensor also needs to be correctly set to output for 4-lane MIPI. When outputting in this mode it is likely that the sensor will need to change some register settings to correctly output for 4-lanes.

If you are basing this on RidgeRun’s driver, these register tables would be in the imx477_mode_tbls.h file. However, I believe RidgeRun had not added 4-lane support to this driver.

If the image sensor registers have not been updated correctly for 4-lane, the output frames will be output wrong or discarded.

I see no major issues with the device-tree overlay. Is it possible to move the 4-lane camera to another port to check that polarity is not the only problem?

Embedded SW Engineer at RidgeRun
Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com/
Website: www.ridgerun.com

We can connect and gstream the camera from the 2 lane MIPI (i2c@1 bus serial_c) just fine (where lane_polarity=0). The issue is with the i2c@0 connection (serial_a and serial_b). imx477_mode_tbls.h is not present in the file system.

@ShaneCCC you are correct:

Is there a way to use cam0 as two 2 lanes (and split out serial a and b somehow)? Given the above image why can’t the exact same camera work in either cam port?

Otherwise, is this a devkit HW limitation or something intrinsic to the Orin NX?

@jafeth.garcia are you aware of any way to make a single imx477 work on cam0 on the devkit? Assuming you can, my hope is that whatever overlay/driver change is required would also work when the orin is connected to my third party carrier board.

It’s HW design limitation. However, you can design your own camera carrier board to support it.
You can get the design guide from the download center.

Thanks

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