Virtual Channel Aggreggation in VI-Bypass Mode

Hi,

Iam having 2 GMSL2 custom sensors (AR0820 imager) connected via a GMSL2-Deserializer aggregating both streams to CSI-E port of the jetson TX2 NX device. First sensor is sending on VC=0 while the other is sending on VC=1.
Using v4l2-ctl tool along with bypass mode = 0 the “dis-aggregation” seems to work good:
v4l2-ctl -d /dev/video0 --set-ctrl bypass_mode=0 --set-fmt-video=width=3840,height=2160,pixelformat=BA12 --stream-mmap --stream-count=1 --stream-to=image0.raw
gives me the picture of sensor with VC=1 and
v4l2-ctl -d /dev/video1 --set-ctrl bypass_mode=0 --set-fmt-video=width=3840,height=2160,pixelformat=BA12 --stream-mmap --stream-count=1 --stream-to=image1.raw gives me a picture for snesor with VC=0

Streaming via ISP and argus for sensor-id=0:
./test-launch "nvarguscamerasrc sensor-mode=0 sensor-id=0 ! video/x-raw(memory:NVMM), width=(int)3840, height=(int)2160, format=(string)NV12, framerate=(fraction)23/1 ! nvv4l2h264enc bitrate=28000000 ! h264parse ! rtph264pay name=pay0 pt=96"
also gives me pictures for sensor with VC=0, however when I try to stream sensor-id=1 via following command:
./test-launch "nvarguscamerasrc sensor-mode=0 sensor-id=1 ! video/x-raw(memory:NVMM), width=(int)3840, height=(int)2160, format=(string)NV12, framerate=(fraction)23/1 ! nvv4l2h264enc bitrate=28000000 ! h264parse ! rtph264pay name=pay0 pt=96"
I get the following error message:

Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:744 Invalid camera device specified 1 specified, 0 max index
NvMMLiteOpen : Block : BlockType = 4 
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4 

Do you have an idea why via v4l2-ctl (using VI-nonbypass) dis-aggregation is working, while going via ISP I get an error message when trying to stream sensor-id 1?

I also attached my device-tree-source file, please don’t be confused about the Raspberry PI camera in the source, I based my trialls and development on this driver…

Thanks for any support on this issue.

/ {
	host1x {
		vi@15700000  {
			num-channels = <2>;
			ports {
				#address-cells = <1>;
				#size-cells = <0>;
				port@0 {
					reg = <0>;
					rbpcv2_imx219_vi_in0: endpoint {
						port-index = <4>;
						bus-width = <4>;
						vc-id = <0>;
						remote-endpoint = <&rbpcv2_imx219_csi_out0>;
					};
				};
				port@1 {
					reg = <1>;
					rbpcv2_imx219_vi_in1: endpoint {
						port-index = <4>;
						bus-width = <4>;
						vc-id = <1>;
						remote-endpoint = <&rbpcv2_imx219_csi_out1>;
					};
				};
			};
		};

		nvcsi@150c0000 {
			num-channels = <2>;
			#address-cells = <1>;
			#size-cells = <0>;

			channel@0 {
				reg = <0>;
				ports {
					#address-cells = <1>;
					#size-cells = <0>;
					port@0 {
						reg = <0>;
						rbpcv2_imx219_csi_in0: endpoint@0 {
							port-index = <4>;
							bus-width = <4>;
							remote-endpoint = <&rbpcv2_imx219_out0>;
						};
					};
					port@1 {
						reg = <1>;
						rbpcv2_imx219_csi_out0: endpoint@1 {
							remote-endpoint = <&rbpcv2_imx219_vi_in0>;
						};
					};
				};
			};
			channel@1 {
				reg = <1>;
				ports {
					#address-cells = <1>;
					#size-cells = <0>;
					port@0 {
						reg = <0>;
						rbpcv2_imx219_csi_in1: endpoint@2 {
							port-index = <4>;																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																									
							bus-width = <4>;
							remote-endpoint = <&rbpcv2_imx219_out1>;
						};
					};
					port@1 {
						reg = <1>;
						rbpcv2_imx219_csi_out1: endpoint@3 {
							remote-endpoint = <&rbpcv2_imx219_vi_in1>;
						};
					};
				};
			};
		};
	};
	i2c@3160000 {
		rbpcv2_imx219_a@12 {
			compatible = "nvidia,imx219";
			/* I2C device address */
			reg = <0x12>;

			/* V4L2 device node location */
			devnode = "video1";
			reset-gpios = <&tegra_main_gpio CAM0_PWDN GPIO_ACTIVE_HIGH>;

			/* Physical dimensions of sensor */
			physical_w = "3.680";
			physical_h = "2.760";

			sensor_model = "imx219";

			use_sensor_mode_id = "true";

			mode0 { /* IMX219_MODE_3264x2464_21FPS */
				mclk_khz = "2500000";
				num_lanes = "4";
				tegra_sinterface = "serial_e";
				phy_mode = "DPHY";
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = "0";

				active_w = "3840";
				active_h = "2160";
				dynamic_pixel_bit_depth = "12";
				csi_pixel_bit_depth = "12";
				mode_type = "bayer";
				pixel_phase = "grbg";
				readout_orientation = "90";
				line_length = "3840";
				inherent_gain = "1";
				mclk_multiplier = "9.33";
				pix_clk_hz = "190771200";
				serdes_pix_clk_hz = "833333333";

				gain_factor = "16";
				framerate_factor = "1000000";
				exposure_factor = "1000000";
				min_gain_val = "16"; /* 1.00x */
				max_gain_val = "170"; /* 10.66x */
				step_gain_val = "1";
				default_gain = "16"; /* 1.00x */
				min_hdr_ratio = "1";
				max_hdr_ratio = "1";
				min_framerate = "2200000"; /* 2.0 fps */
				max_framerate = "24000000"; /* 21.0 fps */
				step_framerate = "1";
				default_framerate = "23000000"; /* 21.0 fps */
				min_exp_time = "13"; /* us */
				max_exp_time = "683709"; /* us */
				step_exp_time = "1";
				default_exp_time = "2495"; /* us */

				embedded_metadata_height = "0";
			};
			mode1 { /* IMX219_MODE_1920x1080_30FPS */
				mclk_khz = "2500000";
				num_lanes = "4";
				tegra_sinterface = "serial_e";
				phy_mode = "DPHY";
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = "0";

				active_w = "1920";
				active_h = "1080";
				
				dynamic_pixel_bit_depth = "12";
				csi_pixel_bit_depth = "12";
				mode_type = "bayer";
				pixel_phase = "grbg";
				readout_orientation = "90";
				line_length = "1920";
				inherent_gain = "1";
				mclk_multiplier = "9.33";
				pix_clk_hz = "47692800";
				serdes_pix_clk_hz = "833333333";

				gain_factor = "16";
				framerate_factor = "1000000";
				exposure_factor = "1000000";
				min_gain_val = "16"; /* 1.00x */
				max_gain_val = "170"; /* 10.66x */
				step_gain_val = "1";
				default_gain = "16"; /* 1.00x */
				min_hdr_ratio = "1";
				max_hdr_ratio = "1";
				min_framerate = "22000000"; /* 2.0 fps */
				max_framerate = "24000000"; /* 30.0 fps */
				step_framerate = "1";
				default_framerate = "23000000"; /* 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 = "0";
			};

			ports {
				#address-cells = <1>;
				#size-cells = <0>;
				port@0 {
					reg = <0>;
					rbpcv2_imx219_out1: endpoint {
						port-index = <4>;
						bus-width = <4>;
						remote-endpoint = <&rbpcv2_imx219_csi_in1>;
					};
				};
			};
		};
		rbpcv2_imx219_c@11 {
			compatible = "nvidia,imx219";
			/* I2C device address */
			reg = <0x11>;

			/* V4L2 device node location */
			devnode = "video0";
			reset-gpios = <&tegra_main_gpio CAM0_PWDN GPIO_ACTIVE_HIGH>;

			/* Physical dimensions of sensor */
			physical_w = "3.680";
			physical_h = "2.760";

			sensor_model = "imx219";

			use_sensor_mode_id = "true";

			mode0 { /* IMX219_MODE_3264x2464_21FPS */
				mclk_khz = "2500000";
				num_lanes = "4";
				tegra_sinterface = "serial_e";
				phy_mode = "DPHY";
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = "0";
				active_w = "3840";
				active_h = "2160";
				
				dynamic_pixel_bit_depth = "12";
				csi_pixel_bit_depth = "12";
				mode_type = "bayer";			
				pixel_phase = "grbg";
				readout_orientation = "90";
				line_length = "3840";
				inherent_gain = "1";
				mclk_multiplier = "9.33";
				pix_clk_hz = "190771200";
				serdes_pix_clk_hz = "833333333";
				gain_factor = "16";
				framerate_factor = "1000000";
				exposure_factor = "1000000";
				min_gain_val = "16"; /* 1.00x */
				max_gain_val = "170"; /* 10.66x */
				step_gain_val = "1";
				default_gain = "16"; /* 1.00x */
				min_hdr_ratio = "1";
				max_hdr_ratio = "1";
				min_framerate = "2200000"; /* 2.0 fps */
				max_framerate = "24000000"; /* 21.0 fps */
				step_framerate = "1";
				default_framerate = "23000000"; /* 21.0 fps */
				min_exp_time = "13"; /* us */
				max_exp_time = "683709"; /* us */
				step_exp_time = "1";
				default_exp_time = "2495"; /* us */
				embedded_metadata_height = "0";
			};
			mode1 { /* IMX219_MODE_1920x1080_30FPS */
				mclk_khz = "2500000";
				num_lanes = "4";
				tegra_sinterface = "serial_e";
				phy_mode = "DPHY";
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = "0";

				active_w = "1920";
				active_h = "1080";
				
				dynamic_pixel_bit_depth = "12";
				csi_pixel_bit_depth = "12";
				mode_type = "bayer";
				pixel_phase = "grbg";
				readout_orientation = "90";
				line_length = "1920";
				inherent_gain = "1";
				mclk_multiplier = "9.33";
				pix_clk_hz = "47692800";
				serdes_pix_clk_hz = "833333333";

				gain_factor = "16";
				framerate_factor = "1000000";
				exposure_factor = "1000000";
				min_gain_val = "16"; /* 1.00x */
				max_gain_val = "170"; /* 10.66x */
				step_gain_val = "1";
				default_gain = "16"; /* 1.00x */
				min_hdr_ratio = "1";
				max_hdr_ratio = "1";
				min_framerate = "2200000"; /* 2.0 fps */
				max_framerate = "24000000"; /* 30.0 fps */
				step_framerate = "1";
				default_framerate = "23000000"; /* 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 = "0";
			};

			ports {
				#address-cells = <1>;
				#size-cells = <0>;
				port@0 {
					reg = <0>;
					rbpcv2_imx219_out0: endpoint {
						status = "okay";
						port-index = <4>;
						bus-width = <4>;
						remote-endpoint = <&rbpcv2_imx219_csi_in0>;
					};
				};
			};
		};
	};

	lens_imx219@RBPCV2 {
		min_focus_distance = "0.0";
		hyper_focal = "0.0";
		focal_length = "3.04";
		f_number = "2.0";
		aperture = "0.0";
	};
};
/ {
	tcp: tegra-camera-platform {
		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 = <4>;
		max_lane_speed = <2500000>;
		min_bits_per_pixel = <12>;
		vi_peak_byte_per_pixel = <2>;
		vi_bw_margin_pct = <25>;
		max_pixel_rate = <240000>;
		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.
		 */
		/* badge number remains same for 186 and 194 for them to share the same config */
		modules {
			module0 {
				badge = "lanai_rear_ar0820";
				position = "topright";
				orientation = "1";
				drivernode0 {
					pcl_id = "v4l2_sensor";
					devname = "imx219 0-0011";
					proc-device-tree = "/proc/device-tree/i2c@3160000/rbpcv2_imx219_c@11";
				};
			module1 {
				badge = "lanai_front_ar0820";
				position = "topleft";
				orientation = "1";
				drivernode0 {
					pcl_id = "v4l2_sensor";
					devname = "imx219 2-0012";
					proc-device-tree = "/proc/device-tree/i2c@3160000/rbpcv2_imx219_a@12";
				};
			};
			};
		};
	};
};

Kind regards,
Steve

P.S. From nvargus-daemon I get the following logs.
The log for the stream-id=0 (which is working):

Mär 02 00:22:58 localhost nvargus-daemon[6476]: === gst-launch-1.0[6660]: CameraProvider initialized (0x7f919d6320)LSC: LSC surface is not based on full res!
Mär 02 00:22:57 localhost nvargus-daemon[6476]: LSC: LSC surface is not based on full res!
Mär 02 00:22:57 localhost nvargus-daemon[6476]: ---- imager: No override file found. ----
Mär 02 00:22:57 localhost nvargus-daemon[6476]: CheckOverridesPermissions: Error: override file [/var/nvidia/nvcam/settings/camera_overrides.isp] has non-root:root owner or 
Mär 02 00:22:57 localhost nvargus-daemon[6476]: OFParserGetVirtualDevice: NVIDIA Camera virtual enumerator not found in proc device-tree
Mär 02 00:22:57 localhost nvargus-daemon[6476]: NvPclHwGetModuleList: No module data found
Mär 02 00:22:57 localhost nvargus-daemon[6476]: NvPclHwGetModuleList: WARNING: Could not map module to ISP config string

The log for stream-id=1 which is not working:

Mär 02 00:23:22 localhost nvargus-daemon[6476]: LSC: LSC surface is not based on full res!
Mär 02 00:23:22 localhost nvargus-daemon[6476]: ---- imager: No override file found. ----
Mär 02 00:23:22 localhost nvargus-daemon[6476]: CheckOverridesPermissions: Error: override file [/var/nvidia/nvcam/settings/camera_overrides.isp] has non-root:root owner or 
Mär 02 00:23:22 localhost nvargus-daemon[6476]: OFParserGetVirtualDevice: NVIDIA Camera virtual enumerator not found in proc device-tree
Mär 02 00:23:21 localhost nvargus-daemon[6476]: NvPclHwGetModuleList: No module data found
Mär 02 00:23:21 localhost nvargus-daemon[6476]: NvPclHwGetModuleList: WARNING: Could not map module to ISP config string

Is this relevant: “OFParserGetVirtualDevice: NVIDIA Camera virtual enumerator not found in proc device-tree” ?

And dmesg shows me following “warning” when trying to register the second instance of the driver:

[   16.249049] imx219 0-0011: couldn't create debugfs

Thanks, Steve

P.S.S.
What I also figured is that the /proc/device-tree/tegra-camera-platform directory only contains one module:

nvidia@localhost:~$ ls /proc/device-tree/tegra-camera-platform/modules/
module0  name

Even though I have two modules defined in my dts. Do you know why second module does not apear in this directory?

I fixed the one module problem, there was a syntax error in my module definition, but dtc was not reporting about it. After fixing the syntax error both modules apear in the /proc/device-tree, however nvarguscamerasrc still fails for sensor-id=1

Now I get more log outputs by nvargus-daemon:

-- Logs begin at Thu 2023-03-02 00:00:00 CET, end at Thu 2023-03-02 13:58:03 CET. --
Mär 02 00:03:50 localhost nvargus-daemon[6340]: SCF: Error BadParameter:  (propagating from src/api/CameraDriver.cpp, function getSource(), line 471)
Mär 02 00:03:50 localhost nvargus-daemon[6340]: SCF: Error BadParameter:  (propagating from src/api/CameraDriver.cpp, function addSourceByIndex(), line 305)
Mär 02 00:03:50 localhost nvargus-daemon[6340]: SCF: Error BadParameter:  (propagating from src/services/capture/CaptureService.cpp, function addSourceByGuid(), line 437)
Mär 02 00:03:50 localhost nvargus-daemon[6340]: SCF: Error BadParameter: Sensor could not be opened. (in src/services/capture/CaptureServiceDeviceSensor.cpp, function getSou
Mär 02 00:03:50 localhost nvargus-daemon[6340]: NvPclOpen: PCL Open Failed. Error: 0xf
Mär 02 00:03:50 localhost nvargus-daemon[6340]: NvPclStateControllerOpen: Failed ImagerGUID 3. (error 0xA000E)
Mär 02 00:03:50 localhost nvargus-daemon[6340]: NvPclStartPlatformDrivers: Failed to start module drivers
Mär 02 00:03:50 localhost nvargus-daemon[6340]: NvPclInitializeDrivers: error: Failed to init camera sub module v4l2_sensor
Mär 02 00:03:50 localhost nvargus-daemon[6340]: NvPclDriverInitializeData: Unable to initialize driver v4l2_sensor
Mär 02 00:03:50 localhost nvargus-daemon[6340]: (NvOdmDevice) Error ModuleNotPresent:  (propagating from dvs/git/dirty/git-master_linux/camera-partner/imager/src/devices/V4L
Mär 02 00:03:50 localhost nvargus-daemon[6340]: (NvCamV4l2) Error ModuleNotPresent:  (propagating from /dvs/git/dirty/git-master_linux/camera/utils/nvcamv4l2/v4l2_device.cpp
Mär 02 00:03:50 localhost nvargus-daemon[6340]: (NvCamV4l2) Error ModuleNotPresent: V4L2Device not available (in /dvs/git/dirty/git-master_linux/camera/utils/nvcamv4l2/v4l2_
Mär 02 00:03:50 localhost nvargus-daemon[6340]: CAM: serial no file already exists, skips storing again---- imager: Found override file [/var/nvidia/nvcam/settings/camera_ov
Mär 02 00:03:50 localhost nvargus-daemon[6340]: ---- imager: Found override file [/var/nvidia/nvcam/settings/camera_overrides.isp]. ----
Mär 02 00:03:50 localhost nvargus-daemon[6340]: OFParserGetVirtualDevice: NVIDIA Camera virtual enumerator not found in proc device-tree
Mär 02 00:03:50 localhost nvargus-daemon[6340]: NvPclHwGetModuleList: No module data found
Mär 02 00:03:50 localhost nvargus-daemon[6340]: NvPclHwGetModuleList: WARNING: Could not map module to ISP config string
Mär 02 00:03:50 localhost nvargus-daemon[6340]: NvPclHwGetModuleList: No module data found
Mär 02 00:03:50 localhost nvargus-daemon[6340]: NvPclHwGetModuleList: WARNING: Could not map module to ISP config string
Mär 02 00:03:50 localhost nvargus-daemon[6340]: OFParserListModules: module list: /proc/device-tree/tegra-camera-platform/modules/module1
Mär 02 00:03:50 localhost nvargus-daemon[6340]: === NVIDIA Libargus Camera Service (0.98.3)=== Listening for connections...=== gst-launch-1.0[6348]: Connection established (
Mär 02 00:03:40 localhost systemd[1]: Started Argus daemon.
1 Like

P.S.
nvargus_nvram --lps gives

nvidia@localhost:~$ nvargus_nvraw --lps
nvargus_nvraw version 1.11.0
Number of supported sensor entries 2
Entry  Source Mode      Uniquename             Resolution   FR  BitDepth  Mode
Index  Index  Index                                             CSI Dyn   Type
  0      0      0           lanai_rear_ar0820   3840x2160   23  12  12    Bayer       
  1      0      1           lanai_rear_ar0820   1920x1080   23  12  12    Bayer 

Meanwhile I solved my issue:

		modules {
...
			module1 {
				badge = "ar0820_center";
				position = "topleft";
				orientation = "1";
				drivernode0 {
					pcl_id = "v4l2_sensor";
					devname = "imx219 2-0012";
					proc-device-tree = "/proc/device-tree/i2c@3160000/rbpcv2_imx219_a@12";
				};
			};

Changing the devname parameter to have value “imx219 0-0012” instead of “imx219 2-0012” lets argus find my second camera stream! devname for module0 has “imx219 0-0011” as value.

Can someone elloborate on how this string is parsed, and what are the meaning of these fields?

Thanks, Steve

1 Like

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