Xavier nx capture yuv sensor

  1. 软件环境:
    . jetpak : 5.0.2

  2. 硬件环境:
    . xaiver nx, yuv sensor(with isp)

  3. 问题现像:
    v4l2-ctl --set-fmt-video=width=2160,height=1280,pixelformat=UYVY --stream-mmap --stream-count=1 -d /dev/video0 --stream-to=x.raw

[ 1285.880475] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 44340, flags: 0, err_data 32
[ 1288.415887] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[ 1288.416134] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel

4.设备树如下:

/ {
	tegra-capture-vi  {
		num-channels = <1>;
		ports {
			#address-cells = <1>;
			#size-cells = <0>;
			vi_port0: port@0 {
				reg = <0>;
				xc9080_vi_in0: endpoint {
					port-index = <0>;
					bus-width = <2>;
					remote-endpoint = <&xc9080_csi_out0>;
				};
			};
		};
	};

i2c@3180000 {
			xc9080_a@1b {
				compatible = "nvidia,xc9080";
				/* I2C device address */
				reg = <0x1b>;

				/* V4L2 device node location */
				devnode = "video0";

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

				sensor_model = "xc9080";

				use_sensor_mode_id = "true";

				/**
				* ==== Modes ====
				* A modeX node is required to support v4l2 driver
				* implementation with NVIDIA camera software stack
				*
				* == Signal properties ==
				*
				* phy_mode = "";
				* PHY mode used by the MIPI lanes for this device
				*
				* tegra_sinterface = "";
				* CSI Serial interface connected to tegra
				* Incase of virtual HW devices, use virtual
				* For SW emulated devices, use host
				*
				* pix_clk_hz = "";
				* Sensor pixel clock used for calculations like exposure and framerate
				*
				* readout_orientation = "0";
				* Based on camera module orientation.
				* Only change readout_orientation if you specifically
				* Program a different readout order for this mode
				*
				* == Image format Properties ==
				*
				* active_w = "";
				* Pixel active region width
				*
				* active_h = "";
				* Pixel active region height
				*
				* pixel_t = "";
				* The sensor readout pixel pattern
				*
				* line_length = "";
				* Pixel line length (width) for sensor mode.
				*
				* == Source Control Settings ==
				*
				* Gain factor used to convert fixed point integer to float
				* Gain range [min_gain/gain_factor, max_gain/gain_factor]
				* Gain step [step_gain/gain_factor is the smallest step that can be configured]
				* Default gain [Default gain to be initialized for the control.
				*     use min_gain_val as default for optimal results]
				* Framerate factor used to convert fixed point integer to float
				* Framerate range [min_framerate/framerate_factor, max_framerate/framerate_factor]
				* Framerate step [step_framerate/framerate_factor is the smallest step that can be configured]
				* Default Framerate [Default framerate to be initialized for the control.
				*     use max_framerate to get required performance]
				* Exposure factor used to convert fixed point integer to float
				* For convenience use 1 sec = 1000000us as conversion factor
				* Exposure range [min_exp_time/exposure_factor, max_exp_time/exposure_factor]
				* Exposure step [step_exp_time/exposure_factor is the smallest step that can be configured]
				* Default Exposure Time [Default exposure to be initialized for the control.
				*     Set default exposure based on the default_framerate for optimal exposure settings]
				*
				* gain_factor = ""; (integer factor used for floating to fixed point conversion)
				* min_gain_val = ""; (ceil to integer)
				* max_gain_val = ""; (ceil to integer)
				* step_gain_val = ""; (ceil to integer)
				* default_gain = ""; (ceil to integer)
				* Gain limits for mode
				*
				* exposure_factor = ""; (integer factor used for floating to fixed point conversion)
				* min_exp_time = ""; (ceil to integer)
				* max_exp_time = ""; (ceil to integer)
				* step_exp_time = ""; (ceil to integer)
				* default_exp_time = ""; (ceil to integer)
				* Exposure Time limits for mode (sec)
				*
				* framerate_factor = ""; (integer factor used for floating to fixed point conversion)
				* min_framerate = ""; (ceil to integer)
				* max_framerate = ""; (ceil to integer)
				* step_framerate = ""; (ceil to integer)
				* default_framerate = ""; (ceil to integer)
				* Framerate limits for mode (fps)
				*
				* embedded_metadata_height = "";
				* Sensor embedded metadata height in units of rows.
				* If sensor does not support embedded metadata value should be 0.
				*/
				mode0 { /* xc9080_MODE_2560x1280_30FPS */
					mclk_khz = "24000";
					num_lanes = "2";
					tegra_sinterface = "serial_a";
					phy_mode = "DPHY";
					discontinuous_clk = "no";
					dpcm_enable = "false";
					cil_settletime = "0";

					active_w = "2160";
					active_h = "1280";
					mode_type = "yuv";
					pixel_phase = "uyvy";
					csi_pixel_bit_depth = "16";
					readout_orientation = "0";
					line_length = "2540";
					inherent_gain = "1";
					mclk_multiplier = "9.33";
					pix_clk_hz = "74250000";

					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 = "30000000"; /* 2.0 fps */
					max_framerate = "30000000"; /* 21.0 fps */
					step_framerate = "1";
					default_framerate = "30000000"; /* 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 = "2";
				};

				ports {
					#address-cells = <1>;
					#size-cells = <0>;
					port@0 {
						reg = <0>;
						xc9080_out0: endpoint {
							port-index = <0>;
							bus-width = <2>;
							remote-endpoint = <&xc9080_csi_in0>;
						};
					};
				};
			};
  1. 调试过程:
    a. 设备驱动可以正常初始化sensor(with isp), 初始化参数是原厂验证过的寄存器配置, 从示波器看似乎是正常的.但vi采集不到数据.
    b. media-ctl -p
    Media controller API version 5.10.104

Media device information

driver tegra-camrtc-ca
model NVIDIA Tegra Video Input Device
serial
bus info
hw revision 0x3
driver version 5.10.104

Device topology

  • entity 1: 13e10000.host1x:nvcsi@15a00000- (2 pads, 2 links)
    type V4L2 subdev subtype Unknown flags 0
    device node name /dev/v4l-subdev0
    pad0: Sink
    ← “xc9080 2-001b”:0 [ENABLED]
    pad1: Source
    → “vi-output, xc9080 2-001b”:0 [ENABLED]

  • entity 4: xc9080 2-001b (1 pad, 1 link)
    type V4L2 subdev subtype Sensor flags 0
    device node name /dev/v4l-subdev1
    pad0: Source
    [fmt:UYVY8_1X16/2160x1280 field:none colorspace:srgb]
    → “13e10000.host1x:nvcsi@15a00000-”:0 [ENABLED]

  • entity 6: vi-output, xc9080 2-001b (1 pad, 1 link)
    type Node subtype V4L flags 0
    device node name /dev/video0
    pad0: Sink
    ← “13e10000.host1x:nvcsi@15a00000-”:1 [ENABLED]

    v4l2-ctl --list-formats-ext
    

ioctl: VIDIOC_ENUM_FMT
Type: Video Capture

    [0]: 'UYVY' (UYVY 4:2:2)
            Size: Discrete 2160x1280
                    Interval: Discrete 0.033s (30.000 fps)
    [1]: 'NV16' (Y/CbCr 4:2:2)
            Size: Discrete 2160x1280
                    Interval: Discrete 0.033s (30.000 fps)
    [2]: 'UYVY' (UYVY 4:2:2)
            Size: Discrete 2160x1280
                    Interval: Discrete 0.033s (30.000 fps)
  1. 问题
    a. 请问设备树是否有配置错?
    b. 关于mipi 接收还有什么其它调试手段

还有一个问题, 如果设备树配置成mode_type = “yuv”, pixel_phase = “uyvy”; xiaver nx 内部ISP是不是自动bypass?

如果是自动bypass是否以下参数是不生效的? 配不配无所谓, 设备树我是参数imx219的设备树
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 = “30000000”; /
2.0 fps /
max_framerate = “30000000”; /
21.0 fps /
step_framerate = “1”;
default_framerate = “30000000”; /
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 = "2";

Yes
However, suppose need to confirm the embedded_metadata_height = “2” for your sensor output. Also get the trace log to get more information.

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

您好!

   将以下参数设置后,目前能采集到摄像头数据,并不会报错。请问这些参数是什么意义?我需要将这些参数固定在开机启动服务里边?

echo 1 > /sys/kernel/debug/bpmp/debug/clk/vi/mrq_rate_locked
echo 1 > /sys/kernel/debug/bpmp/debug/clk/isp/mrq_rate_locked
echo 1 > /sys/kernel/debug/bpmp/debug/clk/nvcsi/mrq_rate_locked
cat /sys/kernel/debug/bpmp/debug/clk/vi/max_rate |tee /sys/kernel/debug/bpmp/debug/clk/vi/rate
cat /sys/kernel/debug/bpmp/debug/clk/isp/max_rate | tee /sys/kernel/debug/bpmp/debug/clk/isp/rate
cat /sys/kernel/debug/bpmp/debug/clk/nvcsi/max_rate | tee /sys/kernel/debug/bpmp/debug/clk/nvcsi/rate

Increase the pix_clk_hz to get more NVCSI/VI bandwidth for this kind of case.

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