L4T 28.1 Error while using argus for image capture

Hi,
Setup details:
MT9M021 camera chip connected through i2c-mipi converter to CSI port A.
Our kernel is based on L4T 28.1.

Though I am able to capture images using v4l2-ctl as well as yavta, I am not able to use argus to obtain image captures from my MT9M021 camera. I observe error prints while attempting to open argus_camera. Can you please help us figure out the issue that we are facing with Argus.

According to the compliance test, there are no failures:

ubuntu@tegra-ubuntu:~$ v4l2-compliance -d /dev/video0
Driver Info:
	Driver name   : tegra-video
	Card type     : vi-output, mt9m021 6-0010
	Bus info      : platform:54080000.vi:0
	Driver version: 4.4.38
	Capabilities  : 0x84200001
		Video Capture
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps   : 0x04200001
		Video Capture
		Streaming
		Extended Pix Format

Compliance test for device /dev/video0 (not using libv4l2):

Required ioctls:
	test VIDIOC_QUERYCAP: OK

Allow for multiple opens:
	test second video open: OK
	test VIDIOC_QUERYCAP: OK
	test VIDIOC_G/S_PRIORITY: OK

Debug ioctls:
	test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
	test VIDIOC_LOG_STATUS: OK

Input ioctls:
	test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
	test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
	test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
	test VIDIOC_ENUMAUDIO: OK (Not Supported)
	test VIDIOC_G/S/ENUMINPUT: OK
	test VIDIOC_G/S_AUDIO: OK (Not Supported)
	Inputs: 1 Audio Inputs: 0 Tuners: 0

Output ioctls:
	test VIDIOC_G/S_MODULATOR: OK (Not Supported)
	test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
	test VIDIOC_ENUMAUDOUT: OK (Not Supported)
	test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
	test VIDIOC_G/S_AUDOUT: OK (Not Supported)
	Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
	test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
	test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
	test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
	test VIDIOC_G/S_EDID: OK (Not Supported)

Test input 0:

	Control ioctls:
		test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
		test VIDIOC_QUERYCTRL: OK
		test VIDIOC_G/S_CTRL: OK
		test VIDIOC_G/S/TRY_EXT_CTRLS: OK
		test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
		test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
		Standard Controls: 9 Private Controls: 14

	Format ioctls:
		test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
		test VIDIOC_G/S_PARM: OK (Not Supported)
		test VIDIOC_G_FBUF: OK (Not Supported)
		test VIDIOC_G_FMT: OK
		test VIDIOC_TRY_FMT: OK
		test VIDIOC_S_FMT: OK
		test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
		test Cropping: OK (Not Supported)
		test Composing: OK (Not Supported)
		fail: v4l2-test-formats.cpp(1486): node->can_scale && node->frmsizes_count[v4l_format_g_pixelformat(&cur)]
		test Scaling: OK

	Codec ioctls:
		test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
		test VIDIOC_G_ENC_INDEX: OK (Not Supported)
		test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

	Buffer ioctls:
		test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
		test VIDIOC_EXPBUF: OK

Test input 0:


Total: 42, Succeeded: 42, Failed: 0, Warnings: 0

But when I run argus using the following command:

argus_camera --device=0

The GUI opens and shows settings but doesn’t show any camera stream.
Here are the terminal prints:

ubuntu@tegra-ubuntu:~$ argus_camera --device=0
Executing Argus Sample Application (argus_camera)
Argus Version: 0.96.2 (multi-process)
Error generated. /home/ubuntu/argus/argus/samples/utils/EGLGlobal.cpp, initialize:97 Could not initialize EGL display
Error generated. /home/ubuntu/argus/argus/apps/camera/renderer/Composer.cpp, initialize:92 (propagating)
Error generated. /home/ubuntu/argus/argus/apps/camera/renderer/Composer.cpp, getInstance:78 Initalization failed
Error generated. /home/ubuntu/argus/argus/samples/utils/EGLGlobal.cpp, initialize:97 Could not initialize EGL display
Error generated. /home/ubuntu/argus/argus/apps/camera/renderer/Composer.cpp, initialize:92 (propagating)
Error generated. /home/ubuntu/argus/argus/apps/camera/renderer/Composer.cpp, getInstance:78 Initalization failed
Error generated. /home/ubuntu/argus/argus/samples/utils/EGLGlobal.cpp, initialize:97 Could not initialize EGL display
Error generated. /home/ubuntu/argus/argus/apps/camera/renderer/Composer.cpp, initialize:92 (propagating)
(Argus) Error NotSupported: Failed to initialize EGLDisplay (in src/eglutils/EGLUtils.cpp, function getDefaultDisplay(), line 75)
Error generated. /home/ubuntu/argus/argus/apps/camera/renderer/Composer.cpp, bindStream:132 Invalid stream
Error generated. /home/ubuntu/argus/argus/apps/camera/modules/tasks/StillCapture.cpp, start:132 (propagating)
Error generated. /home/ubuntu/argus/argus/apps/camera/ui/capture/AppModuleCapture.cpp, start:154 (propagating)
Error generated. /home/ubuntu/argus/argus/apps/camera/ui/camera/Main.cpp, onModuleChanged:344 (propagating)
Error generated. /home/ubuntu/argus/argus/samples/utils/Observed.cpp, registerObserver:62 (propagating)
Error generated. /home/ubuntu/argus/argus/apps/camera/ui/camera/Main.cpp, start:282 (propagating)

Here are the prints from dmesg:

[  +0.017319] mt9m021 6-0010: mt9m021_power_off: power off
[Nov 6 12:56] mt9m021 6-0010: mt9m021_power_on: power on
[  +0.016117] mt9m021 6-0010: mt9m021_power_off: power off
[  +0.014293] mt9m021 0-0010: mt9m021_power_on: power on
[  +0.013657] mt9m021 0-0010: mt9m021_power_off: power off
[  +0.015836] mt9m021 6-0010: mt9m021_power_on: power on
[  +0.016238] mt9m021 6-0010: mt9m021_power_off: power off
[  +0.015005] mt9m021 0-0010: mt9m021_power_on: power on
[  +0.013142] mt9m021 0-0010: mt9m021_power_off: power off
[  +0.066524] mt9m021 0-0010: mt9m021_power_on: power on
[  +0.013350] mt9m021 0-0010: mt9m021_power_off: power off
[  +0.014254] mt9m021 0-0010: mt9m021_power_on: power on
[  +0.013703] mt9m021 0-0010: mt9m021_power_off: power off
[  +0.014286] mt9m021 0-0010: mt9m021_power_on: power on
[  +0.013703] mt9m021 0-0010: mt9m021_g_input_status
[  +0.004817] mt9m021 0-0010: mt9m021_power_off: power off
[  +0.024384] mt9m021 0-0010: mt9m021_power_on: power on
[  +0.014816] mt9m021 0-0010: mt9m021_power_off: power off
[  +0.014357] mt9m021 6-0010: mt9m021_power_on: power on
[  +0.013633] mt9m021 6-0010: mt9m021_power_off: power off
[  +0.014430] mt9m021 6-0010: mt9m021_power_on: power on
[  +0.013740] mt9m021 6-0010: mt9m021_power_off: power off
[  +0.014279] mt9m021 6-0010: mt9m021_power_on: power on
[  +0.013733] mt9m021 6-0010: mt9m021_g_input_status
[  +0.004980] mt9m021 6-0010: mt9m021_power_off: power off

Following is the instantiation of cameera in my dtsi:

#include <dt-bindings/media/camera.h>
#include <dt-bindings/platform/t210/t210.h>

#define CAM0_RST      	TEGRA_GPIO(S, 4)
#define CAM1_RST        TEGRA_GPIO(S, 5)
#define CAM0_PWDN       TEGRA_GPIO(S, 7)
#define CAM1_PWDN       TEGRA_GPIO(T, 0)

/*
I2C Busses:

i2c0 = "/i2c@7000c000";
i2c1 = "/i2c@7000c400";
i2c2 = "/i2c@7000c500";
i2c3 = "/i2c@7000c700";
i2c4 = "/i2c@7000d000";
i2c5 = "/i2c@7000d100";
i2c6 = "/host1x/i2c@546c0000";
*/

/ {
	i2c@7000c000 {
		status = "okay";
		#address-cells = <1>;
		#size-cells = <0>;

		mt9m021_b@10 {
			compatible = "nvidia,mt9m021";

			/* I2C device address */
			reg = <0x10>;

			/* Physical dimensions of sensor */
			physical_w = "10";
			physical_h = "10";

			/* Sensor Model */
			sensor_model ="mt9m021";

			/* Defines number of frames to be dropped by driver internally after applying */
			/* sensor crop settings. Some sensors send corrupt frames after applying */
			/* crop co-ordinates */
			post_crop_frame_drop = "0";

			/* when set true analog gain value expressed in decibels." */
			use_decibel_gain = "false";

			/* if true, delay gain setting by one frame to be in sync with exposure */
			delayed_gain = "true";

			/* enable CID_SENSOR_MODE_ID for sensor modes selection */
			use_sensor_mode_id = "true";

			/* slave or master mode */
			trigger_mode = "master";

			/* Device */
			devnode = "video1";

			/* input clock for the device in MHz*/
			clocks = <&tegra_car TEGRA210_CLK_CLK_OUT_3>;
			clock-names = "clk_out_3";
			clock-frequency = <24000000>;
			mclk = "clk_out_3";
			reset-gpios = <&gpio CAM1_RST GPIO_ACTIVE_HIGH>;
			/* Define any required hw resources needed by driver */
			/* ie. clocks, io pins, power sources */
			vana-supply = <&battery_reg>;     // analog 2.8v
			vif-supply = <&battery_reg>;             // interface 1.8v
			vdig-supply = <&battery_reg>;    // digital 1.2v

			avdd-reg = "vana";
			iovdd-reg = "vana";
			dvdd-reg = "vana";
			has-eeprom = <0>;


			mode0 {
				mclk_khz = "24000";
				num_lanes = "1";
				tegra_sinterface = "serial_b";
				discontinuous_clk = "yes";
				dpcm_enable = "false";
				cil_settletime = "0";

				active_w = "1280";
				active_h = "720";
				dynamic_pixel_bit_depth = "12";
				csi_pixel_bit_depth = "12";
				mode_type="bayer";
				pixel_phase="rggb";
				pixel_t = "bayer_rggb12";
				readout_orientation = "0";
				line_length = "1650";
				inherent_gain = "1";
				mclk_multiplier = "3.094";
				pix_clk_hz = "74250000";

				min_gain_val = "4";
				max_gain_val = "3200";
				min_hdr_ratio = "";
				max_hdr_ratio = "";
				min_framerate = "1";
				max_framerate = "60";
				min_exp_time = "1";
				max_exp_time = "0xffff";
				embedded_metadata_height = "0";
			};
			ports {
				#address-cells = <0x1>;
				#size-cells = <0x0>;

				port@0 {
					reg = <0x0>;
					mt9m021_slave: endpoint {
						csi-port = <0x1>;
						bus-width = <0x1>;
						remote-endpoint = <&mt9m021_slave_nvcsi_port0>;
					};
				};
			};
		};
	};

	host1x {
		
		i2c@546c0000 {
			status = "okay";
            #address-cells = <1>;
            #size-cells = <0>;

			mt9m021_a@10 {
				compatible = "nvidia,mt9m021";

				/* I2C device address */
				reg = <0x10>;

				/* Physical dimensions of sensor */
				physical_w = "10";
				physical_h = "10";

				/* Sensor Model */
				sensor_model ="mt9m021";

				/* Defines number of frames to be dropped by driver internally after applying */
				/* sensor crop settings. Some sensors send corrupt frames after applying */
				/* crop co-ordinates */
				post_crop_frame_drop = "0";

				/* when set true analog gain value expressed in decibels." */
				use_decibel_gain = "false";

				/* if trae, delay gain setting by one frame to be in sync with exposure */
				delayed_gain = "true";

				/* enable CID_SENSOR_MODE_ID for sensor modes selection */
				use_sensor_mode_id = "true";

				/* slave or master mode */
				trigger_mode = "master";

				/* Device */
				devnode = "video0";

				/* input clock for the device in MHz*/
				clocks = <&tegra_car TEGRA210_CLK_CLK_OUT_3>;
				clock-names = "clk_out_3";
				clock-frequency = <24000000>;
				mclk = "clk_out_3";
				reset-gpios = <&gpio CAM0_RST GPIO_ACTIVE_HIGH>;
				/* Define any required hw resources needed by driver */
				/* ie. clocks, io pins, power sources */
				vana-supply = <&battery_reg>;     // analog 2.8v
				vif-supply = <&battery_reg>;             // interface 1.8v
				vdig-supply = <&battery_reg>;    // digital 1.2v

				avdd-reg = "vana";
				iovdd-reg = "vana";
				dvdd-reg = "vana";
				has-eeprom = <0>;


				mode0 {
					mclk_khz = "24000";
					num_lanes = "1";
					tegra_sinterface = "serial_a";
					discontinuous_clk = "yes";
					dpcm_enable = "false";
					cil_settletime = "0";

					active_w = "1280";
					active_h = "720";
					pixel_t = "bayer_rggb12";
					readout_orientation = "0";
					line_length = "1650";
					inherent_gain = "1";
					mclk_multiplier = "3.094";
					pix_clk_hz = "74250000";

					min_gain_val = "4";
					max_gain_val = "3200";
					min_hdr_ratio = "";
					max_hdr_ratio = "";
					min_framerate = "1";
					max_framerate = "60";
					min_exp_time = "1";
					max_exp_time = "0xffff";
					embedded_metadata_height = "0";
				};
				ports {
					#address-cells = <0x1>;
					#size-cells = <0x0>;

					port@0 {
						reg = <0x0>;
						mt9m021_master: endpoint {
							csi-port = <0x0>;
							bus-width = <0x1>;
							remote-endpoint = <&mt9m021_master_nvcsi_port0>;
						};
					};
				};
			};
		};
	};

	tegra-camera-platform {
		compatible = "nvidia, tegra-camera-platform";
		num_csi_lanes = <0x4>;
		modules {
			module0 {
				status = "okay";
				badge = "mt9m021_master";
				position = "front";
				orientation = "1";
				drivernode0 {
					status = "okay";
					pcl_id = "v4l2_sensor";
					devname = "mt9m021 6-0010";
					proc-device-tree = "/proc/device-tree/host1x/i2c@546c0000/mt9m021_a@10";
				};
			};
			module1 {
				status = "okay";
				badge = "mt9m021_slave";
				position = "rear";
				orientation = "1";
				drivernode0 {
					status = "okay";
					pcl_id = "v4l2_sensor";
					devname = "mt9m021 0-0010";
proc-device-tree = "/proc/device-tree/i2c@7000c000/mt9m021_b@10";
				};
			};
		};
	};
};

@EV
Does gstreamer work? Any other syncpt timeout message from kernel? Looks like have problem to initial EGL.

Here are the results while running gstreamer:
Command used:

ubuntu@tegra-ubuntu:~$ gst-launch-1.0 nvcamerasrc sensor-id=0 ! 'video/x-raw(memory:NVMM),width=1280, height=720, framerate=60/1, format=NV12' ! nvoverlaysink -ev
Setting pipeline to PAUSED ...
Socket read error. Camera Daemon stopped functioning.....
gst_nvcamera_open() failed ret=0
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstPipeline:pipeline0/GstNvCameraSrc:nvcamerasrc0: GStreamer error: state change failed and some element failed to post a proper error message with the reason for the failure.
Additional debug info:
gstbasesrc.c(3354): gst_base_src_start (): /GstPipeline:pipeline0/GstNvCameraSrc:nvcamerasrc0:
Failed to start
Setting pipeline to NULL ...
Freeing pipeline ...
ubuntu@tegra-ubuntu:~$ ^C
ubuntu@tegra-ubuntu:~$ gst-launch-1.0 nvcamerasrc sensor-id=1 ! 'video/x-raw(memory:NVMM),width=1280, height=720, framerate=60/1, format=NV12' ! nvoverlaysink -ev
Setting pipeline to PAUSED ...

Available Sensor modes : 
1280 x 720 FR=60.000000 CF=0x1009208a10 SensorModeType=4 CSIPixelBitDepth=12 DynPixelBitDepth=12
Pipeline is live and does not need PREROLL ...

NvCameraSrc: Trying To Set Default Camera Resolution. Selected sensorModeIndex = 0 WxH = 1280x720 FrameRate = 60.000000 ...

Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstNvCameraSrc:nvcamerasrc0.GstPad:src: caps = "video/x-raw\(memory:NVMM\)\,\ width\=\(int\)1280\,\ height\=\(int\)720\,\ format\=\(string\)NV12\,\ framerate\=\(fraction\)60/1"
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = "video/x-raw\(memory:NVMM\)\,\ width\=\(int\)1280\,\ height\=\(int\)720\,\ format\=\(string\)NV12\,\ framerate\=\(fraction\)60/1"
/GstPipeline:pipeline0/GstNvOverlaySink-nvoverlaysink:nvoverlaysink-nvoverlaysink0.GstPad:sink: caps = "video/x-raw\(memory:NVMM\)\,\ width\=\(int\)1280\,\ height\=\(int\)720\,\ format\=\(string\)NV12\,\ framerate\=\(fraction\)60/1"
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = "video/x-raw\(memory:NVMM\)\,\ width\=\(int\)1280\,\ height\=\(int\)720\,\ format\=\(string\)NV12\,\ framerate\=\(fraction\)60/1"

Attached is the dmesg log.
Document.txt (95.9 KB)

@EV
Try to modify the discontinuous_clk and cil_settletime combination. The cil_settletime is from 0 - 15

mode1 { //OV5693_MODE_2592X1458
                                                        mclk_khz = "24000";
                                                        num_lanes = "2";
                                                        tegra_sinterface = "serial_a";
                                                        discontinuous_clk = "no";
                                                        dpcm_enable = "false";
                                                        cil_settletime = "0";

                                                        active_w = "2592";
                                                        active_h = "1458";
                                                        pixel_t = "bayer_bggr";
                                                        readout_orientation = "90";
                                                        line_length = "2688";
                                                        inherent_gain = "1";
                                                        mclk_multiplier = "6.67";
                                                        pix_clk_hz = "160000000";

                                                        min_gain_val = "1.0";
                                                        max_gain_val = "16";
                                                        min_hdr_ratio = "1";
                                                        max_hdr_ratio = "64";
                                                        min_framerate = "1.816577";
                                                        max_framerate = "30";
                                                        min_exp_time = "34";
                                                        max_exp_time = "550385";
                                                };

Hi EV,

Have you tried our suggestion? Any result can be shared?

Thanks