Non-i2c camera integration MIPI jetson orin nano

I have a camera that sends MIPI video. I have it connected on CAM1

these are my relevant .dts sections:

`i2c@3180000 {
#address-cells = <0x01>;
#size-cells = <0x00>;
iommus = <0x06 0x04>;
dma-coherent;
compatible = “nvidia,tegra234-i2c”;
reg = <0x00 0x3180000 0x00 0x100>;
nvidia,hw-instance-id = <0x02>;
interrupts = <0x00 0x1b 0x04>;
scl-gpio = <0x50 0x72 0x00>;
sda-gpio = <0x50 0x73 0x00>;
status = “okay”;
clock-frequency = <0x61a80>;
clocks = <0x02 0x32 0x02 0x66>;
clock-names = “div-clk\0parent”;
assigned-clocks = <0x02 0x32>;
assigned-clock-parents = <0x02 0x66>;
resets = <0x02 0x1e>;
reset-names = “i2c”;
dmas = <0x3f 0x17 0x3f 0x17>;
dma-names = “rx\0tx”;
nvidia,epl-reporter-id = <0x8052>;
phandle = <0x2c6>;

prod-settings {
	#prod-cells = <0x04>;

	prod {
		prod = <0x00 0x9c 0xffff 0x308 0x00 0xd4 0xff 0x00 0x00 0xd8 0xff 0x00 0x00 0xdc 0xffff 0x01 0x00 0xe0 0xffff 0x02>;
	};

	prod_c_fm {
		prod = <0x00 0x6c 0xffff0000 0x3c0000 0x00 0x94 0xffff 0x202 0x00 0x98 0xffffffff 0x2020202>;
	};

	prod_c_fmplus {
		prod = <0x00 0x6c 0xffff0000 0x160000 0x00 0x94 0xffff 0x202 0x00 0x98 0xffffffff 0x2020202>;
	};

	prod_c_hs {
		prod = <0x00 0x6c 0xffffffff 0x160002 0x00 0x94 0xffff 0x202 0x00 0x98 0xffffffff 0x2020202 0x00 0xa0 0xffffff 0x90909>;
	};

	prod_c_sm {
		prod = <0x00 0x6c 0xffff0000 0x4f0000 0x00 0x94 0xffff 0x708 0x00 0x98 0xffffffff 0x8080808>;
	};
};

sg_zcm2090nmi@10 {
compatible = “savgood,sg_zcm2090nmi”;
reg = <0x10>;
physical_w = “15.974”;
physical_h = “12.000”;
sensor_model = “sg_zcm2090nmi”;
devnode = “video0”;

	mode0 {
		num_lanes = "4";
		tegra_sinterface = "serial_c";
		phy_mode = "DPHY";
		discontinuous_clk = "no";
		dpcm_enable = "false";
		cil_settletime = "20";
		lane_polarity = "0";
		
		active_w = "1920";
		active_h = "1080";
		
		mode_type = "yuv";
		pixel_phase = "uyvy";
		csi_pixel_bit_depth = "16";
		dynamic_pixel_bit_depth = "16";
		
		readout_orientation = "0";
		line_length = "2200";
		frame_length = "1125";
		inherent_gain = "1";
		pix_clk_hz = "74250000";

		gain_factor = "1";
		framerate_factor = "1000000";
		exposure_factor = "1000000";
		min_gain_val = "1";
		max_gain_val = "1";
		default_gain = "1";
		min_framerate = "60000000";
		max_framerate = "60000000";
		default_framerate = "60000000";
		min_exp_time = "1";
		max_exp_time = "1";
		default_exp_time = "1";
		
		embedded_metadata_height = "0";
		step_gain_val = "1";
		step_framerate = "1";
		step_exp_time = "1";
	};


	ports {
		#address-cells = <0x01>;
		#size-cells = <0x00>;
		port@0 {
			reg = <0x00>;
			sg_zcm_out0: endpoint {
				port-index = <0x02>;
				bus-width = <0x04>;
				remote-endpoint = <&nvcsi_csi_in0>;
			};
		};
	};
};

};`

`	nvcsi@15a00000 {
compatible = “nvidia,tegra194-nvcsi”;
clocks = <0x02 0x51>;
clock-names = “nvcsi”;
status = “okay”;
num-channels = <0x01>;
#address-cells = <0x01>;
#size-cells = <0x00>;
phandle = <0x43f>;

	channel@0 {
		reg = <0x00>;
		phandle = <0x500>;

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

			port@0 {
				reg = <0x00>;
				phandle = <0x501>;
				nvcsi_csi_in0: endpoint@0 {
					port-index = <0x02>;
					bus-width = <0x04>;
					remote-endpoint = <&sg_zcm_out0>;
					phandle = <0x502>;
				};
			};

			port@1 {
				reg = <0x01>;
				phandle = <0x503>;
				nvcsi_csi_out0: endpoint@1 {
					bus-width = <0x04>;
					remote-endpoint = <&sg_zcm_vi_in0>;
					phandle = <0x504>;
				};
			};
		};
	};
};`

`tegra-capture-vi {
compatible = “nvidia,tegra-camrtc-capture-vi”;
nvidia,vi-devices = <0x27c 0x27e>;
nvidia,vi-mapping-size = <0x06>;
nvidia,vi-mapping = <0x00 0x00 0x01 0x00 0x02 0x00 0x03 0x01 0x04 0x00 0x05 0x01>;
nvidia,vi-mapping-names = “csi-stream-id\0vi-unit-id”;
nvidia,vi-max-channels = <0x48>;
num-channels = <0x01>;

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

	port@0 {
		reg = <0x00>;
		phandle = <0x42d>;
		sg_zcm_vi_in0: endpoint@0 {
			port-index = <0x02>;
			bus-width = <0x04>;
			remote-endpoint = <&nvcsi_csi_out0>;
			phandle = <0x4d4>;
		};
	};
};

};`

`tegra-camera-platform {
compatible = “nvidia, tegra-camera-platform”;
num_csi_lanes = <0x04>;
max_lane_speed = <0x16e360>;
min_bits_per_pixel = <0x10>;  // 16-bit for YUV
vi_peak_byte_per_pixel = <0x02>;
vi_bw_margin_pct = <0x19>;
max_pixel_rate = <0x3a980>;
isp_peak_byte_per_pixel = <0x05>;
isp_bw_margin_pct = <0x19>;

modules {
	module0 {
		badge = "sg_zcm2090nmi_cam";
		position = "rear";
		orientation = "1";
		
		drivernode0 {
			pcl_id = "v4l2_sensor";
			devname = "sg_zcm2090nmi 2-0010";
			proc-device-tree = "/proc/device-tree/bus@0/i2c@3180000/sg_zcm2090nmi@10";
		};
	};
};

};`

`tegra-capture-vi {
compatible = “nvidia,tegra-camrtc-capture-vi”;
nvidia,vi-devices = <0x27c 0x27e>;
nvidia,vi-mapping-size = <0x06>;
nvidia,vi-mapping = <0x00 0x00 0x01 0x00 0x02 0x00 0x03 0x01 0x04 0x00 0x05 0x01>;
nvidia,vi-mapping-names = “csi-stream-id\0vi-unit-id”;
nvidia,vi-max-channels = <0x48>;
num-channels = <0x01>;

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

	port@0 {
		reg = <0x00>;
		phandle = <0x42d>;
		sg_zcm_vi_in0: endpoint@0 {
			port-index = <0x02>;
			bus-width = <0x04>;
			remote-endpoint = <&nvcsi_csi_out0>;
			phandle = <0x4d4>;
		};
	};
};

};`

i will also attach my driver c code

when i try to open a stream with
v4l2-ctl -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat=UYVY --stream-mmap --stream-count=1

i get the following on dmesg:

[ 708.952533] sg_zcm2090nmi 2-0010: sg_zcm_set_mode: called
[ 708.956172] sg_zcm2090nmi 2-0010: sg_zcm_start_streaming: called
[ 711.636085] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[ 711.645258] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[ 711.654876] (NULL device *): vi_capture_control_message: NULL VI channel received
[ 711.662667] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_close: Error in closing stream_id=2, csi_port=2
[ 711.673375] (NULL device *): vi_capture_control_message: NULL VI channel received
[ 711.681681] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: successfully reset the capture channel
[ 714.195739] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[ 714.204891] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[ 714.214499] (NULL device *): vi_capture_control_message: NULL VI channel received
[ 714.222298] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_close: Error in closing stream_id=2, csi_port=2
[ 714.233008] (NULL device *): vi_capture_control_message: NULL VI channel received
[ 714.240761] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_open: VI channel not found for stream- 2 vc- 0
[ 714.251604] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: successfully reset the capture channel
[ 717.011611] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[ 717.020779] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[ 717.030390] (NULL device *): vi_capture_control_message: NULL VI channel received
[ 717.038186] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_close: Error in closing stream_id=2, csi_port=2
[ 717.048893] (NULL device *): vi_capture_control_message: NULL VI channel received
[ 718.067520] tegra194-vi5 13e40000.host1x:vi0@15c00000: capture control message timed out
[ 718.075865] tegra194-vi5 13e40000.host1x:vi0@15c00000: vi_capture_control_send_message: failed to send IVC control message
[ 719.091466] tegra194-vi5 13e40000.host1x:vi0@15c00000: capture control message timed out
[ 719.099983] tegra-camrtc-capture-vi tegra-capture-vi: vi capture setup failed
[ 719.107617] tegra-camrtc-capture-vi tegra-capture-vi: fatal: error recovery failed

sg_zcm2090nmi_tegracam_debug (copy).c.txt (9.6 KB)

along with:

kworker/4:3-577 [004] … 125.252745: rtcpu_nvcsi_intr: tstamp:4504342524 class:GLOBAL type:PHY_INTR0 phy:1 cil:0 st:0 vc:0 status:0x10000000
kworker/4:3-577 [004] … 125.252746: rtcpu_nvcsi_intr: tstamp:4504342524 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00001000
kworker/4:3-577 [004] … 125.252746: rtcpu_nvcsi_intr: tstamp:4504343450 class:GLOBAL type:PHY_INTR0 phy:1 cil:0 st:0 vc:0 status:0x10000000
kworker/4:3-577 [004] … 125.252746: rtcpu_nvcsi_intr: tstamp:4504343450 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00001000
kworker/4:3-577 [004] … 125.252747: rtcpu_nvcsi_intr: tstamp:4504344373 class:GLOBAL type:PHY_INTR0 phy:1 cil:0 st:0 vc:0 status:0x10000000
kworker/4:3-577 [004] … 125.252749: rtcpu_nvcsi_intr: tstamp:4504344373 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00001000
kworker/4:3-577 [004] … 125.252749: rtcpu_nvcsi_intr: tstamp:4504348074 class:GLOBAL type:PHY_INTR0 phy:1 cil:0 st:0 vc:0 status:0x00000040
kworker/4:3-577 [004] … 125.252750: rtcpu_nvcsi_intr: tstamp:4504348074 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00000040
kworker/4:3-577 [004] … 125.252750: rtcpu_nvcsi_intr: tstamp:4504348998 class:GLOBAL type:PHY_INTR0 phy:1 cil:0 st:0 vc:0 status:0x10000000
kworker/4:3-577 [004] … 125.252750: rtcpu_nvcsi_intr: tstamp:4504348998 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00001000
kworker/4:3-577 [004] … 125.252751: rtcpu_nvcsi_intr: tstamp:4504349929 class:GLOBAL type:PHY_INTR0 phy:1 cil:0 st:0 vc:0 status:0x10000000
kworker/4:3-577 [004] … 125.252751: rtcpu_nvcsi_intr: tstamp:4504349929 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00001000
kworker/4:3-577 [004] … 125.252752: rtcpu_nvcsi_intr: tstamp:4504350844 class:GLOBAL type:PHY_INTR0 phy:1 cil:0 st:0 vc:0 status:0x10000000
kworker/4:3-577 [004] … 125.252752: rtcpu_nvcsi_intr: tstamp:4504350844 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00001000
kworker/4:3-577 [004] … 125.252752: rtcpu_nvcsi_intr: tstamp:4504355487 class:GLOBAL type:PHY_INTR0 phy:1 cil:0 st:0 vc:0 status:0x10000040
kworker/4:3-577 [004] … 125.252753: rtcpu_nvcsi_intr: tstamp:4504355487 class:GLOBAL type:PHY_INTR0 phy:1 cil:1 st:0 vc:0 status:0x00000040
kworker/4:3-577 [004] … 125.252753: rtcpu_nvcsi_intr: tstamp:4504355487 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00001040
kworker/4:3-577 [004] … 125.252753: rtcpu_nvcsi_intr: tstamp:4504355487 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:1 st:0 vc:0 status:0x00000040
kworker/4:3-577 [004] … 125.252754: rtcpu_nvcsi_intr: tstamp:4504356925 class:GLOBAL type:PHY_INTR0 phy:1 cil:0 st:0 vc:0 status:0x10000000
kworker/4:3-577 [004] … 125.252754: rtcpu_nvcsi_intr: tstamp:4504356925 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00001000
kworker/4:3-577 [004] … 125.252754: rtcpu_nvcsi_intr: tstamp:4504357818 class:GLOBAL type:PHY_INTR0 phy:1 cil:0 st:0 vc:0 status:0x10000000
kworker/4:3-577 [004] … 125.252755: rtcpu_nvcsi_intr: tstamp:4504357818 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00001040
kworker/4:3-577 [004] … 125.252755: rtcpu_nvcsi_intr: tstamp:4504357818 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:1 st:0 vc:0 status:0x00000040
kworker/4:3-577 [004] … 125.252756: rtcpu_nvcsi_intr: tstamp:4504358979 class:GLOBAL type:PHY_INTR0 phy:1 cil:0 st:0 vc:0 status:0x10000040
kworker/4:3-577 [004] … 125.252756: rtcpu_nvcsi_intr: tstamp:4504358979 class:GLOBAL type:PHY_INTR0 phy:1 cil:1 st:0 vc:0 status:0x00000040
kworker/4:3-577 [004] … 125.252756: rtcpu_nvcsi_intr: tstamp:4504363820 class:GLOBAL type:PHY_INTR0 phy:1 cil:0 st:0 vc:0 status:0x10000000
kworker/4:3-577 [004] … 125.252757: rtcpu_nvcsi_intr: tstamp:4504363820 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00001000
kworker/4:3-577 [004] … 125.252757: rtcpu_nvcsi_intr: tstamp:4504364745 class:GLOBAL type:PHY_INTR0 phy:1 cil:0 st:0 vc:0 status:0x10000000
kworker/4:3-577 [004] … 125.252757: rtcpu_nvcsi_intr: tstamp:4504364745 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00001000
kworker/4:3-577 [004] … 125.252758: rtcpu_nvcsi_intr: tstamp:4504367518 class:GLOBAL type:PHY_INTR0 phy:1 cil:0 st:0 vc:0 status:0x00000004
kworker/4:3-577 [004] … 125.252758: rtcpu_nvcsi_intr: tstamp:4504367518 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00000004
kworker/4:3-577 [004] … 125.252758: rtcpu_nvcsi_intr: tstamp:4504369373 class:GLOBAL type:PHY_INTR0 phy:1 cil:0 st:0 vc:0 status:0x10000000
kworker/4:3-577 [004] … 125.252759: rtcpu_nvcsi_intr: tstamp:4504369373 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00001000
kworker/4:3-577 [004] … 125.252759: rtcpu_nvcsi_intr: tstamp:4504370291 class:GLOBAL type:PHY_INTR0 phy:1 cil:0 st:0 vc:0 status:0x10000040
kworker/4:3-577 [004] … 125.252760: rtcpu_nvcsi_intr: tstamp:4504370291 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00001040
kworker/4:3-577 [004] … 125.252760: rtcpu_nvcsi_intr: tstamp:4504371226 class:GLOBAL type:PHY_INTR0 phy:1 cil:0 st:0 vc:0 status:0x10000000
kworker/4:3-577 [004] … 125.252760: rtcpu_nvcsi_intr: tstamp:4504371226 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00001000
kworker/4:3-577 [004] … 125.252761: rtcpu_nvcsi_intr: tstamp:4504373075 class:GLOBAL type:PHY_INTR0 phy:1 cil:1 st:0 vc:0 status:0x00000040
kworker/4:3-577 [004] … 125.252761: rtcpu_nvcsi_intr: tstamp:4504373075 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:1 st:0 vc:0 status:0x00000040
kworker/4:3-577 [004] … 125.252761: rtcpu_nvcsi_intr: tstamp:4504376781 class:GLOBAL type:PHY_INTR0 phy:1 cil:0 st:0 vc:0 status:0x10000000
kworker/4:3-577 [004] … 125.252762: rtcpu_nvcsi_intr: tstamp:4504376781 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00001000

and frequent kernel crashes.

i tried to play with cil_settletime but to no avail

am I missing something obvious?

i will add the datasheets of the camera.
i have set the MIPI format to 1080P30 using the VISCA serial command

MIPI Digital Camera Module User Guide_20250331.pdf (610.3 KB)

can anobody help?

thanks

Hello @yankeegohome366,

Did a bit of research, and found this thread. It seems to be similar to the issue you are experiencing.

The issue ended up being caused by a time delay between the moment the board requests buffers and the time that video started being received. See this other thread as reference.

This week I have some free time, so let me know if you would like me to help you debug.

best regards,
Andrew
Embedded Software Engineer at ProventusNova

You may need probe the 4 lanes output to confirm the signal.

Thanks

hi, thanks for your fast reply

im struggling to find any officiall sources to decode these nvcsi error messages. i do notice that they only occur on cil 0. actually when i set the cil_settletime anywhere less than 28 it will have errors on both cil

the camera has a 30 pin adapter which i soldered to a raspberry pi camera cable. i checked the output and all lanes send data as well as the clock on an oscilloscope

the camera hasnt any i2c so i made the device probe regardless of that.

im starting to wonder if my adapter has some problems? knowing exactly what these status codes mean and why they occur might help a lot.

hi, thanks for replying

i have checked the output on an oscilloscope and it seems the send data on all 4 lanes.
as well as clock output from the camera

the camera only sends out 4 lanes and clock. it doesnt accept a clock input

update:

I was correct in doubting my self-made adapter and found a missing connection which was csi3_data0_n. moving it around after checking may have loosened it

after resoldering i got the following:

kworker/4:3-347 [004] … 146.265910: rtcpu_nvcsi_intr: tstamp:5158972429 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00000e00
kworker/4:3-347 [004] … 146.265911: rtcpu_nvcsi_intr: tstamp:5158972429 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:1 st:0 vc:0 status:0x00000600
kworker/4:3-347 [004] … 146.265911: rtcpu_nvcsi_intr: tstamp:5158975571 class:GLOBAL type:PHY_INTR0 phy:1 cil:0 st:0 vc:0 status:0x0e000000
kworker/4:3-347 [004] … 146.265911: rtcpu_nvcsi_intr: tstamp:5158975571 class:GLOBAL type:PHY_INTR0 phy:1 cil:1 st:0 vc:0 status:0x06000000

so the error has totally changed now.

cil_settletime set to 0 that using the calculation depend on the pix_clk_hz. Have below for the calculation.

Also you can check the NVCSI_PHY_1_CILA_INTR_0_STATUS_CILA_0 from the TRM to know the error bit.

I found the problem. It turned out that the physical clock frequency on was not the same as the mentioned ‘pixel clock’ on the datasheet. I totally missed that, thinking that that would be the actual frequency on CSI2_CLK

after measuring the actual frequency with an oscilloscope I changed the pix_clk_hz accordingly (to 175 MHz instead of 74.25, and after playing around a bit with cil_settletime it worked flawlessly

thanks for your support!