Nvarguscamerasrc hang system

Porting driver from imx274 to imx334.

12bit rggb bayer, 3840X2160 30fps.
Set gain/exposure/fps functions to dummy.

Save raw image successed by

v4l2-ctl -d /dev/video0 --set-fmt-video=width=3840,height=2160,pixelformat=RG12 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1 --stream-to=ss.raw

But if run

gst-launch-1.0 nvarguscamerasrc ! fakesink

Desktop will hang then reboot.

Dts list below

#include <dt-bindings/media/camera.h>
#include <dt-bindings/platform/t210/t210.h>
#define CAM1_PWDN	TEGRA_GPIO(S, 7)

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

		num_csi_lanes = <4>;
		max_lane_speed = <1500000>;
		min_bits_per_pixel = <12>;

		vi_peak_byte_per_pixel = <2>;
		vi_bw_margin_pct = <25>;
		max_pixel_rate = <750000>;
		isp_peak_byte_per_pixel = <5>;
		isp_bw_margin_pct = <25>;


		modules {
			module0 {
				badge = "imx334_rear_imx334";
				position = "rear";
				status = "okay";
				orientation = "0";
				cam_module0_drivernode0: drivernode0 {
					pcl_id = "v4l2_sensor";
					devname = "imx334 6-001a";
					proc-device-tree = "/proc/device-tree/host1x/i2c@546c0000/imx334_a@1a";
				};

			};
		};
	};

	gpio@6000d000 {
		camera-control-output-low {
			gpio-hog;
			output-low;
			gpios = < CAM1_PWDN 0 >;
			label = "cam1-pwdn";
		};
	};

	host1x {
		vi {
			num-channels = <1>;
			ports {
				#address-cells = <1>;
				#size-cells = <0>;
				port@0 {
					reg = <0>;
					imx334_vi_in0: endpoint {
						port-index = <0>;
						bus-width = <4>;
						remote-endpoint = <&imx334_csi_out0>;
					};
				};
			};
		};

		nvcsi {
			num-channels = <1>;
			#address-cells = <1>;
			#size-cells = <0>;
			channel@0 {
				reg = <0>;
				ports {
					#address-cells = <1>;
					#size-cells = <0>;
					port@0 {
						reg = <0>;
						imx334_csi_in0: endpoint@0 {
							port-index = <0>;
							bus-width = <4>;
							remote-endpoint = <&imx334_out0>;
						};
					};
					port@1 {
						reg = <1>;
						imx334_csi_out0: endpoint@1 {
							remote-endpoint = <&imx334_vi_in0>;
						};
					};
				};
			};
		};

		i2c@546c0000 {
			clock-frequency = <200000>;
			imx334_a@1a {
				compatible = "nvidia,imx334";
				/* I2C device address */
				reg = <0x1a>;

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

				/* Physical dimensions of sensor */
				physical_w = "3.674";
				physical_h = "2.738";

				clocks = <&tegra_car TEGRA210_CLK_CLK_OUT_3>;
				clock-names = "clk_out_3";
				clock-frequency = <24000000>;


				reset-gpios = <&gpio CAM1_PWDN GPIO_ACTIVE_HIGH>;

				sensor_model = "imx334";

				use_sensor_mode_id = "true";

				mode0 {
					mclk_khz = "24000";
					num_lanes = "4";
					tegra_sinterface = "serial_a";
					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 = "rggb";

					readout_orientation = "0";
					line_length = "4538";

					inherent_gain = "1";
					pix_clk_hz = "297000000";

					gain_factor = "10000";
					min_gain_val = "11250";/* 1DB*/
					max_gain_val = "320000";/* 32DB*/
					step_gain_val = "625";
					default_gain = "11250";

					min_hdr_ratio = "1";
					max_hdr_ratio = "1";
					framerate_factor = "1000000";
					min_framerate = "1500000";/*1.5 */
					max_framerate = "30000000";/*30*/
					step_framerate = "1";
					default_framerate = "30000000";

					exposure_factor = "1000000";
					min_exp_time = "34";/* us */
					max_exp_time = "358733";/* us */
					step_exp_time = "1";
					default_exp_time = "12000";/* us */
					#default_exp_time = "12000";/* us */
					
					embedded_metadata_height = "0";
				};

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

					port@0 {
						reg = <0>;
						imx334_out0: endpoint {
							port-index = <0>;
							bus-width = <4>;
							remote-endpoint = <&imx334_csi_in0>;
						};
					};
				};

			};
		};
	};
};

Thanks for your help!!

Did you check the raw image?
Have confirm below command to check if able streaming continuously.

v4l2-ctl -d /dev/video0 --set-fmt-video=width=3840,height=2160,pixelformat=RG12 --set-ctrl bypass_mode=0 --stream-mmap

The raw image data all zeros.

And the stream is continuous and maintain 30 fps.

Thank you!

Modify all of the control function like set_frame_rate() to dummy to try.

All control functions set to dummy already.

static struct tegracam_ctrl_ops imx334_ctrl_ops = {
	.numctrls = ARRAY_SIZE(ctrl_cid_list),
	.ctrl_cid_list = ctrl_cid_list,
	.set_gain = imx334_set_gain,
	.set_exposure = imx334_set_exposure,
	.set_frame_rate = imx334_set_frame_rate,
	.set_group_hold = imx334_set_group_hold,
	// .fill_string_ctrl = imx334_fill_string_ctrl,
};

static int imx334_set_gain(struct tegracam_device *tc_dev, s64 val)
{

	return 0;
}

static int imx334_set_exposure(struct tegracam_device *tc_dev, s64 val)
{
	return 0;
}

static int imx334_set_frame_rate(struct tegracam_device *tc_dev, s64 val)
{
	return 0;

}


static int imx334_set_group_hold(struct tegracam_device *tc_dev, bool val)
{
	return 0;
}

Thank you!

  1. Try discontinuous_clk=yes
  2. Have some delay after sensor stream on REG programing.

Add 18ms delay after stream on , nothing changed.
Set discontinuous_clk=yes, argus_daemon crashed.

@ShaneCCC ,How can I do for this situation?
Why argus deamon hang OS?
Is there some logs to trace it?

Argus hang could be unable capture successfully from sensor and Nano didn’t implement recovery at some situation could cause OS hang.
Maybe consult with vendor if any sensor mode to try. And dump the device tree to confirm the tegra_sinterface is correct.

We found a way let argus satisfy.

Change the resolution to 1920 1080 in dts , and with certain line length, “gst-launch arguscamerasrc ! fakesink” not going die now, Although sensor register setting to 3840 2160.

And I found this post https://forums.developer.nvidia.com/t/arducam-imx-219-not-giving-4k-video/201367/42

Is there some relations between the post and my problem?

I’m really appreciate for your help!

It could be the sensor REG configure problem due to 1080p working without problem.

@ShaneCCC ,

Below is new info:

  1. 3840x2180 , 4 lane , 12bit, 891M / lane , line length 4400, pixel clock 297000000, set all pixel data to 0x555.

  2. capture raw data with:

v4l2-ctl -d /dev/video0 --set-fmt-video=width=3840,height=2160,pixelformat=RG12 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=10 --stream-to=ss.raw
  1. In the raw file , first 3 frames all zero, then one frame all 0x555, then 3frames all zero, then one frame all 0x555.

  2. When capture beginning, kernel log show:
    vi 54080000.vi: tegra_channel_error_status:error 20022 frame 0

  3. We capture the data on oscilloscope, all four lane data is 0x555.
    And line length is 14.81us .
    14.81 = 4400 / 4 lane * 12 bit / 891M.

  4. Argus still hang

Enable the debug print in csi2_fops.c to get the REG status.
After below command issue v4l2-ctl to capture and check the kernel message.

sudo su
echo file ov5693.c +p > /sys/kernel/debug/dynamic_debug/control
sudo su
echo file csi2_fops.c +p >  /sys/kernel/debug/dynamic_debug/control

kern.log

Jul 15 16:35:15 felix-imx kernel: [ 121.102096] vi 54080000.vi: Calibrate csi port 0
Jul 15 16:35:15 felix-imx kernel: [ 121.248739] vi 54080000.vi: cil_settingtime was autocalculated
Jul 15 16:35:15 felix-imx kernel: [ 121.248758] vi 54080000.vi: csi clock settle time: 13, cil settle time: 10
Jul 15 16:35:15 felix-imx kernel: [ 121.344542] vi 54080000.vi: tegra_channel_error_status:error 20022 frame 0

Log for break capture:
Jul 15 16:35:18 felix-imx kernel: [ 124.146397] video4linux video0: tegra_channel_capture_done: MW_ACK_DONE syncpoint time out!0
Jul 15 16:35:18 felix-imx kernel: [ 124.155013] vi 54080000.vi: TEGRA_CSI_PIXEL_PARSER_STATUS 0x00000000
Jul 15 16:35:18 felix-imx kernel: [ 124.155020] vi 54080000.vi: TEGRA_CSI_CIL_STATUS 0x00000000
Jul 15 16:35:18 felix-imx kernel: [ 124.155025] vi 54080000.vi: TEGRA_CSI_CILX_STATUS 0x00000000
Jul 15 16:35:18 felix-imx kernel: [ 124.155080] vi 54080000.vi: cil_settingtime was autocalculated
Jul 15 16:35:18 felix-imx kernel: [ 124.155088] vi 54080000.vi: csi clock settle time: 13, cil settle time: 10

The REG dump all 0 that tell there’s no error, that could be CSI/VI didn’t receive any frame data from sensor.

  1. In the raw file , first 3 frames all zero, then one frame all 0x555, then 3frames all zero, then one frame all 0x555.

CSI received few frames with correct data. But not for every frame.

Please check the kernel message to check if any TEGRA_CSI_* have none 0 value?

After few times v4l2-ctl capture stream, There are csi error in kernel log.

Jul 18 17:54:47 felix-imx kernel: [  611.837326] video4linux video0: TEGRA_VI_CSI_ERROR_STATUS 0x0000000b
Jul 18 17:54:47 felix-imx kernel: [  611.837364] vi 54080000.vi: TEGRA_CSI_PIXEL_PARSER_STATUS 0x00000034

There have short error FIFO overflow and payload CRC error.
Have a check the TRM to check the CSI_CSI_PIXEL_PARSER_A_STATUS_0 REG

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