nvgstcapture-1.0 failed on my custom IMX185

Hello,everybody.
On my own designed TX2 carrier board (Jetpack 3.3), I used the custom IMX185 to capture images.

By modifying <b>tegra186-quill-p3310-1000-c03-00-base.dtb</b> (/home/nvidia/64_TX2/Linux_for_Tegra/kernel/dtb in 

this path of the virtual machine), flash the DTB with this commend to TX2 (sudo ./flash.sh -r -k kernel-dtb jetson-tx2

mmcblk0p1).https://elinux.org/Jetson/TX2_DTB

When I ls /dev/video*, I can find video0. But I executed nvgstcapture-1.0 and I get an error like

this:

nvidia@tegra-ubuntu:~$ nvgstcapture-1.0
Encoder null, cannot set bitrate!
Encoder Profile = High
Supported resolutions in case of ARGUS Camera
  (2) : 640x480
  (3) : 1280x720
  (4) : 1920x1080
  (5) : 2104x1560
  (6) : 2592x1944
  (7) : 2616x1472
  (8) : 3840x2160
  (9) : 3896x2192
  (10): 4208x3120
  (11): 5632x3168
  (12): 5632x4224

Runtime ARGUS Camera Commands:

  Help : 'h'
  Quit : 'q'
  Set Capture Mode:
      mo:<val>
          (1): image
          (2): video
  Get Capture Mode:
      gmo
  Set sensor orientation:
      so:<val>
          (0): none
          (1): Rotate counter-clockwise 90 degrees
          (2): Rotate 180 degrees
          (3): Rotate clockwise 90 degrees
  Get sensor orientation:
      gso
  Set Whitebalance Mode:
      wb:<val>
          (0): off
          (1): auto
          (2): incandescent
          (3): fluorescent
          (4): warm-fluorescent
          (5): daylight
          (6): cloudy-daylight
          (7): twilight
          (8): shade
          (9): manual
  Get Whitebalance Mode:
      gwb
  Set Saturation (0 to 2):
      st:<val> e.g., st:1.25
  Get Saturation:
      gst
  Capture: enter 'j' OR
           followed by a timer (e.g., jx5000, capture after 5 seconds) OR
           followed by multishot count (e.g., j:6, capture 6 images)
           timer/multihot values are optional, capture defaults to single shot with timer=0s
  Start Recording : enter '1'
  Stop Recording  : enter '0'
  Video snapshot  : enter '2' (While recording video)
  Get Preview Resolution:
      gpcr
  Get Image Capture Resolution:
      gicr
  Get Video Capture Resolution:
      gvcr

Runtime encoder configuration options:

  Set Encoding Bit-rate(in bytes):
      br:<val> e.g., br:4000000
  Get Encoding Bit-rate(in bytes):
      gbr
  Set Encoding Profile(only for H.264):
      ep:<val> e.g., ep:1
          (0): Baseline
          (1): Main
          (2): High
  Get Encoding Profile(only for H.264):
      gep
  Force IDR Frame on video Encoder(only for H.264):
      Enter 'f' 

bitrate = 4000000
Encoder Profile = High
** Message: <main:5684> iterating capture loop ....
GST_ARGUS: Running with following settings:
   Camera index = 0 
   Camera mode  = 0 
   Output Stream W = 640 H = 480 
   seconds to Run    = 0 
Framerate set to : 30 at NvxVideoEncoderSetParameterNvMMLiteOpen : Block : BlockType = 4 
===== MSENC =====
NvMMLiteBlockCreate : Block : BlockType = 4 
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:364 No cameras available
(Argus) Error EndOfFile: Unexpected error in reading socket (in src/rpc/socket/client/ClientSocketManager.cpp, function recvThreadCore(), line 214)
(Argus) Error EndOfFile: Receive worker failure, notifying 1 waiting threads (in src/rpc/socket/client/ClientSocketManager.cpp, function recvThreadCore(), line 289)
(Argus) Error InvalidState: Argus client is exiting with 1 outstanding client threads (in src/rpc/socket/client/ClientSocketManager.cpp, function recvThreadCore(), line 306)
(Argus) Error EndOfFile: Receiving thread terminated with error (in src/rpc/socket/client/ClientSocketManager.cpp, function recvThreadWrapper(), line 317)
(Argus) Error EndOfFile: Client thread received an error from socket (in src/rpc/socket/client/ClientSocketManager.cpp, function send(), line 149)
(Argus) Error EndOfFile:  (propagating from src/rpc/socket/client/SocketClientDispatch.cpp, function dispatch(), line 101)
^Z
[1]+  Stopped                 nvgstcapture-1.0

The dmesg information of the IMX185 is as follows

nvidia@tegra-ubuntu:~$ dmesg | grep -i imx185
[    2.769574] imx185 1-001a: [IMX185]: probing v4l2 sensor at addr 0x1a.
[    2.769974] imx185 1-001a: sensor_common_parse_image_props:pixel_t property missing
[    2.769991] imx185 1-001a: sensor_common_parse_image_props:pixel_t property missing
[    2.770007] imx185 1-001a: sensor_common_parse_image_props:pixel_t property missing
[    2.770022] imx185 1-001a: sensor_common_parse_image_props:pixel_t property missing
[    2.770038] imx185 1-001a: sensor_common_parse_image_props:pixel_t property missing
[    2.770719] [<ffffffc0007714fc>] imx185_power_on+0x6c/0xe8
[    2.770727] [<ffffffc000772704>] imx185_probe+0x54c/0x6e8
[    2.770756] [<ffffffc001114408>] imx185_i2c_driver_init+0x18/0x20
[    2.771035] [<ffffffc000771518>] imx185_power_on+0x88/0xe8
[    2.771042] [<ffffffc000772704>] imx185_probe+0x54c/0x6e8
[    2.771066] [<ffffffc001114408>] imx185_i2c_driver_init+0x18/0x20
[    2.772679] imx185 1-001a: imx185_fuse_id_setup,  fuse id: 000085010101
[    2.772841] [<ffffffc000771438>] imx185_power_off+0x70/0xc8
[    2.772849] [<ffffffc0007727bc>] imx185_probe+0x604/0x6e8
[    2.772873] [<ffffffc001114408>] imx185_i2c_driver_init+0x18/0x20
[    2.772966] imx185 1-001a: Detected IMX185 sensor
[    5.701321] tegra-vi4 15700000.vi: subdev imx185 1-001a bound
[    8.396223] [<ffffffc0007714fc>] imx185_power_on+0x6c/0xe8
[    8.396574] [<ffffffc000771518>] imx185_power_on+0x88/0xe8
[    8.399834] [<ffffffc000771438>] imx185_power_off+0x70/0xc8
[ 1647.032532] [<ffffffc0007714fc>] imx185_power_on+0x6c/0xe8
[ 1647.269123] [<ffffffc000771518>] imx185_power_on+0x88/0xe8
[ 1647.507280] [<ffffffc000771438>] imx185_power_off+0x70/0xc8
[ 1647.724941] [<ffffffc0007714fc>] imx185_power_on+0x6c/0xe8
[ 1647.961068] [<ffffffc000771518>] imx185_power_on+0x88/0xe8
[ 1648.197254] [<ffffffc000771438>] imx185_power_off+0x70/0xc8

This is my adjusted dtb information about IMX185 as follows:

i2c@c240000 {
		#address-cells = <0x1>;
		#size-cells = <0x0>;
		#stream-id-cells = <0x1>;
		compatible = "nvidia,tegra186-i2c";
		reg = <0x0 0xc240000 0x0 0x100>;
		interrupts = <0x0 0x1a 0x4>;
		scl-gpio = <0x1c 0x30 0x0>;
		sda-gpio = <0x1c 0x31 0x0>;
		status = "okay";
		clock-frequency = <0x61a80>;
		clocks = <0xd 0xda 0xd 0x10d 0xd 0xdd>;
		clock-names = "div-clk", "parent", "slow-clk";
		resets = <0xd 0x14>;
		reset-names = "i2c";
		dmas = <0x19 0x16 0x19 0x16>;
		dma-names = "rx", "tx";
		linux,phandle = <0x85>;
		phandle = <0x85>;

		imx185_a@1a {
			compatible = "nvidia,imx185";
			reg = <0x1a>;
			devnode = "video0";
			physical_w = "15.0";
			physical_h = "12.5";
			sensor_model = "imx185";
			post_crop_frame_drop = "0";
			#gpio-cells = <0x2>;
			use_decibel_gain = "true";
			delayed_gain = "true";
			use_sensor_mode_id = "true";
			clocks = <0xd 0x59 0xd 0x10d>;
          		clock-names = "extperiph1", "pllp_grtba";
			mclk = "extperiph1";
			reset-gpios = <0x8d 0x0 0x89 0x0>;
			status = "okay";
			linux,phandle = <0x16e>;
			phandle = <0x16e>;

			mode0 {
				mclk_khz = "37125";
				num_lanes = "4";
				tegra_sinterface = "serial_a";
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = "0";
				dynamic_pixel_bit_depth = "12";
				csi_pixel_bit_depth = "12";
				mode_type = "bayer";

				pixel_phase = "rggb";
				active_w = "1920";
				active_h = "1080";
				readout_orientation = "0";
				line_length = "2200";
				inherent_gain = "1";
				mclk_multiplier = "2";
				pix_clk_hz = "74250000";
				min_gain_val = "0";
				max_gain_val = "48";
				min_hdr_ratio = "1";
				max_hdr_ratio = "1";
				min_framerate = "1.5";
				max_framerate = "30";
				min_exp_time = "30";
				max_exp_time = "660000";
				embedded_metadata_height = "1";
			};

			mode1 {
				mclk_khz = "37125";
				num_lanes = "4";
				tegra_sinterface = "serial_a";
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = "0";
				dynamic_pixel_bit_depth = "10";
				csi_pixel_bit_depth = "10";
				mode_type = "bayer";

				pixel_phase = "rggb";
				active_w = "1920";
				active_h = "1080";
				readout_orientation = "0";
				line_length = "2640";
				inherent_gain = "1";
				mclk_multiplier = "2.4";
				pix_clk_hz = "89100000";
				min_gain_val = "0";
				max_gain_val = "48";
				min_hdr_ratio = "1";
				max_hdr_ratio = "1";
				min_framerate = "1.5";
				max_framerate = "30";
				min_exp_time = "30";
				max_exp_time = "660000";
				embedded_metadata_height = "1";
			};

			mode2 {
				mclk_khz = "37125";
				num_lanes = "4";
				tegra_sinterface = "serial_a";
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = "0";
				dynamic_pixel_bit_depth = "12";
				csi_pixel_bit_depth = "12";
				mode_type = "bayer";

				pixel_phase = "rggb";
				active_w = "1920";
				active_h = "1080";
				readout_orientation = "0";
				line_length = "2200";
				inherent_gain = "1";
				mclk_multiplier = "4";
				pix_clk_hz = "148500000";
				min_gain_val = "0";
				max_gain_val = "48";
				min_hdr_ratio = "1";
				max_hdr_ratio = "1";
				min_framerate = "1.5";
				max_framerate = "60";
				min_exp_time = "30";
				max_exp_time = "660000";
				embedded_metadata_height = "1";
			};

			mode3 {
				mclk_khz = "37125";
				num_lanes = "4";
				tegra_sinterface = "serial_a";
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = "0";
				dynamic_pixel_bit_depth = "10";
				csi_pixel_bit_depth = "10";
				mode_type = "bayer";

				pixel_phase = "rggb";
				active_w = "1920";
				active_h = "1080";
				readout_orientation = "0";
				line_length = "2640";
				inherent_gain = "1";
				mclk_multiplier = "4.8";
				pix_clk_hz = "178200000";
				min_gain_val = "0";
				max_gain_val = "48";
				min_hdr_ratio = "1";
				max_hdr_ratio = "1";
				min_framerate = "1.5";
				max_framerate = "60";
				min_exp_time = "30";
				max_exp_time = "660000";
				embedded_metadata_height = "1";
			};

			mode4 {
				mclk_khz = "37125";
				num_lanes = "4";
				tegra_sinterface = "serial_a";
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = "0";
				dynamic_pixel_bit_depth = "16";
				csi_pixel_bit_depth = "12";
				mode_type = "bayer_wdr_pwl";

				pixel_phase = "rggb";
				active_w = "1920";
				active_h = "1080";
				readout_orientation = "0";
				line_length = "2200";
				inherent_gain = "1";
				mclk_multiplier = "2";
				pix_clk_hz = "74250000";
				min_gain_val = "0";
				max_gain_val = "12";
				min_hdr_ratio = "16";
				max_hdr_ratio = "16";
				min_framerate = "1.5";
				max_framerate = "30";
				min_exp_time = "30";
				max_exp_time = "660000";
				embedded_metadata_height = "1";
				num_control_point = "4";
				control_point_x_0 = "0";
				control_point_x_1 = "2048";
				control_point_x_2 = "16384";
				control_point_x_3 = "65536";
				control_point_y_0 = "0";
				control_point_y_1 = "2048";
				control_point_y_2 = "2944";
				control_point_y_3 = "3712";
			};

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

				port@0 {
					reg = <0x0>;

					liimx185_imx185_out0: endpoint {
						csi-port = <0x0>;
						bus-width = <0x4>;
						remote-endpoint = <&liimx185_csi_in0>;
						//linux,phandle = <0x21>;
						//phandle = <0x21>;
					};
				};
			};
		};
tegra-camera-platform {
		compatible = "nvidia, tegra-camera-platform";
		num_csi_lanes = <4>;
		max_lane_speed = <1500000>;
		min_bits_per_pixel = <0xa>;
		vi_peak_byte_per_pixel = <0x2>;
		vi_bw_margin_pct = <0x19>;
		//max_pixel_rate = <0xb71b0>;
		isp_peak_byte_per_pixel = <0x5>;
		isp_bw_margin_pct = <25>;
		tpg_max_iso = <0x3bc400>;
		linux,phandle = <0x132>;
		phandle = <0x132>;

		modules {

			module0 {
				badge = "imx185_bottom_liimx185";
				position = "bottom";
				orientation = [30 00];
				status = "okay";

				drivernode0 {
					pcl_id = "v4l2_sensor";
					devname = "imx185 30-001a";
					proc-device-tree = "/proc/device-tree/i2c@3180000/imx185_e@1a";
					status = "okay";
				};
			};
			module1 {
				badge = "imx185_bottom_liimx185";
				position = "bottom";
				orientation = "0";
				status = "okay";

				drivernode0 {
					pcl_id = "v4l2_sensor";
					devname = "imx185 1-001a";
					proc-device-tree = "/proc/device-tree/i2c@c240000/imx185_a@1a";
					status = "okay";
				};
			};
		};
	};
nvcsi@150c0000 {
			compatible = "nvidia,tegra186-nvcsi";
			power-domains = <0xa4>;
			reg = <0x0 0x150c0000 0x0 0x40000>;
			resets = <0xd 0x58>;
			clocks = <0xd 0xb4 0xd 0xb5 0xd 0x20e 0xd 0x10d>;
			clock-names = "nvcsi", "nvcsilp", "nvcsi_parent", "nvcsilp_parent";
			interrupts = <0x0 0x77 0x4>;
			#stream-id-cells = <0x1>;
			status = "okay";
			num-ports = <0x6>;
			nvidia,csi_regulator = "avdd_dsi_csi";
			num-channels = <0x1>;
			#address-cells = <0x1>;
			#size-cells = <0x0>;
			linux,phandle = <0x4d>;
			phandle = <0x4d>;

			channel@0 {
				reg = <0x0>;
				status = "okay";

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

					port@0 {
						reg = <0x0>;
						status = "okay";

						liimx185_csi_in0: endpoint@0 {
							csi-port = <0x0>;
							bus-width = <0x4>;
							remote-endpoint = <&liimx185_imx185_out0>;
							status = "okay";
						};
					};

					port@1 {
						reg = <0x1>;
						status = "okay";

						liimx185_csi_out0: endpoint@1 {
							remote-endpoint = <&liimx185_vi_in0>;
							//linux,phandle = <0x26>;
							//phandle = <0x26>;
						};
					};
				};
			};
		};

		vi@15700000 {
			compatible = "nvidia,tegra186-vi";
			power-domains = <0xa4>;
			reg = <0x0 0x15700000 0x0 0x100000>;
			interrupts = <0x0 0xc9 0x4 0x0 0xca 0x4 0x0 0xcb 0x4>;
			resets = <0xd 0x33 0xd 0x8f>;
			reset-names = "vi", "tsctnvi";
			clocks = <0xd 0x33 0xd 0xb4 0xd 0xb5>;
			clock-names = "vi", "nvcsi", "nvcsilp";
			#stream-id-cells = <0x1>;
			iommus = <0x46 0x12>;
			status = "okay";
			avdd_dsi_csi-supply = <0x2d>;
			num-channels = <0x3>;
			linux,phandle = <0x43>;
			phandle = <0x43>;

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

				/*port@0 {
					reg = <0x0>;
					status = "okay";

					endpoint {
						csi-port = <0x0>;
						bus-width = <0x2>;
						remote-endpoint = <0x27>;
						status = "okay";
						//linux,phandle = <0x26>;
						//phandle = <0x26>;
					};
				};*/
				port@1 {
					reg = <0x1>;
					status = "okay";

					liimx185_vi_in0: endpoint {
						csi-port = <0x1>;
						bus-width = <0x2>;
						remote-endpoint = <&liimx185_csi_out0>;
						status = "okay";
						//linux,phandle = <0x24>;
						//phandle = <0x24>;
					};
				};

		      };
		};

Can someone help me explain what is wrong with doing this?

It looks like kernel panic from your log.
Please check the sensor programing guide to implement your DT and remove the plugin manager instead of modify the tegra186-quill-p3310-1000-c03-00-base.dtb

Do you referring this following:

Removing this ?

#include <t18x-common-plugin-manager/tegra186-quill-camera-plugin-manager.dtsi"

Yes,

To register a device using main-platform device tree files

  1. Locate and edit the following file:
    • TX1:
    hardware/nvidia/platform/t210/jetson/kernel-dts/tegra210-jetson-cv-base-p25970-2180-a00.dts
    • TX2:
    hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-p3310-1000-a00-00-base.dtsi
  2. In the DTSI, remove the following line:
    • TX1:
    #include “jetson-plugin-manager/tegra210-jetson-cv-camera-plugin-manager.dtsi”
    • TX2:
    #include <t18x-common-plugin-manager/tegra186-quill-camera-plugin-manager.dtsi"
  3. Locate and edit the following file:
    TX1:
    hardware/nvidia/platform/t210/jetson/kernel-dts/tegra210-jetson-cv-base-p2597-2180-a00.dts
    TX2:
    hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-p3310-1000-a00-00-base.dts
  4. In the DTS file, replace the following line:
    • TX1:
    #include “jetson-platforms/tegra210-jetson-cv-camera-modules.dtsi”
    • TX2:
    #include <t18x-common-platforms/tegra186-quill-camera-modules.dtsi>
    With an #include statement specifying the DTSI file for your new device.

I have modified it according to this process, but there is still a problem.

nvidia@tegra-ubuntu:~$ dmesg | grep -i imx185
[    2.958607] imx185 2-001a: [IMX185]: probing v4l2 sensor at addr 0x1a.
[    2.959003] imx185 2-001a: sensor_common_parse_image_props:pixel_t property missing
[    2.959022] imx185 2-001a: sensor_common_parse_image_props:pixel_t property missing
[    2.959038] imx185 2-001a: sensor_common_parse_image_props:pixel_t property missing
[    2.959054] imx185 2-001a: sensor_common_parse_image_props:pixel_t property missing
[    2.959071] imx185 2-001a: sensor_common_parse_image_props:pixel_t property missing
[    2.959861] imx185_fuse_id_setup: can not read fuse id
[    2.959864] imx185 2-001a: Error -22 reading fuse id data
[    2.959908] imx185: probe of 2-001a failed with error -22

Could you tell me how can I modify my DTS about IMX185?

Your board design should not have fuse id. You may remove them.

Where should I remove fuse_id?In imx185.c(kernel/kernel-4.4/drivers/media/i2c)?

Yes, it is.

Thank you for your reply.