Trouble enabling eight CSI cameras on TX2 NX

We have a custom camera card with two TP2855 analog video decoders, each supporting four channels. I’m using a driver provided by Techpoint and it works fine for one chip / four cameras. But while four cameras works I’m having trouble getting the CSI side of the driver to work when I try to use both chips / eight cameras. I think the problem’s related to my device tree settings for “vi” and “nvcsi”.

With eight channels set up when I try to read video from any video input I get these console errors and I receive no video:

[14696.047610] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[14696.255589] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[14696.262661] nvcsi 150c0000.nvcsi: csi4_stream_check_status (0) INTR_STATUS 0x00002000
[14696.270638] nvcsi 150c0000.nvcsi: csi4_stream_check_status (0) ERR_INTR_STATUS 0x00002000
[14696.483606] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[14696.691557] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[14696.698508] nvcsi 150c0000.nvcsi: csi4_stream_check_status (0) INTR_STATUS 0x00000040
[14696.706488] nvcsi 150c0000.nvcsi: csi4_stream_check_status (0) ERR_INTR_STATUS 0x00000040
[14696.919478] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[14696.926127] nvcsi 150c0000.nvcsi: csi4_stream_check_status (0) INTR_STATUS 0x00000080
[14696.934082] nvcsi 150c0000.nvcsi: csi4_stream_check_status (0) ERR_INTR_STATUS 0x00000080

Here are some relevant parts of the device tree when it’s working correctly with four cameras:

/ {
	host1x {
		vi@15700000 {
			num-channels = <4>;
			ports {
				#address-cells = <1>;
				#size-cells = <0>;
				port@0 {
					reg = <0>;
					status = "okay";
					tp2854_vi_in0: endpoint {
						status = "okay";
						vc-id = <0>;
						port-index = <0>;
						bus-width = <4>;
						remote-endpoint = <&tp2854_csi_out0>;
					};
				};
				...(three more ports)...
			};
		};

		nvcsi@150c0000 {
			num-channels = <4>;
			#address-cells = <1>;
			#size-cells = <0>;
			channel@0 {
				reg = <0>;
				status = "okay";
				ports {
					#address-cells = <1>;
					#size-cells = <0>;
					port@0 {
						reg = <0>;
						status = "okay";
						tp2854_csi_in0: endpoint@0 {
							status = "okay";
							port-index = <0>;
							bus-width = <4>;
							remote-endpoint = <&tp2854_out0>;
						};
					};
					port@1 {
						reg = <1>;
						status = "okay";
						tp2854_csi_out0: endpoint@1 {
							status = "okay";
							remote-endpoint = <&tp2854_vi_in0>;
						};
					};
				};
			};
			...(three more ports)...
		};
	};

That much works ok. But when I change the num_channels on vi@15700000 and nvcsi@150c0000 to 8 it doesn’t go so well. I added four additional vi ports like this:

				port@4 {
					reg = <0>;
					status = "okay";
					tp2854_vi_in4: endpoint {
						status = "okay";
						vc-id = <0>;
						port-index = <2>;
						bus-width = <4>;
						remote-endpoint = <&tp2854_csi_out4>;
					};
				};

This sets the port_index to 2 which I think is correct. (The codecs are connected to csi0 through csi3).

I also added additional nvcsi ports like:

			channel@4 {
				reg = <4>;
				status = "okay";
				ports {
					#address-cells = <1>;
					#size-cells = <0>;
					port@0 {
						reg = <0>;
						status = "okay";
						tp2854_csi_in4: endpoint@8 {
							status = "okay";
							port-index = <2>;
							bus-width = <4>;
							remote-endpoint = <&tp2854_out4>;
						};
					};
					port@1 {
						reg = <1>;
						status = "okay";
						tp2854_csi_out4: endpoint@9 {
							status = "okay";
							remote-endpoint = <&tp2854_vi_in4>;
						};
					};
				};
			};

I also changed num_csi_lanes in tegra-camera-platform to 8 and added modules:

	tegra-camera-platform {
		compatible = "nvidia, tegra-camera-platform";
		num_csi_lanes = <8>;
		max_lane_speed = <1500000>;
		min_bits_per_pixel = <10>;
		vi_peak_byte_per_pixel = <2>;
		vi_bw_margin_pct = <25>;
		max_pixel_rate = <148500>;
		isp_peak_byte_per_pixel = <2>;
		isp_bw_margin_pct = <25>;

		modules {
			module0 {
				badge = "tp2854_rear";
				position = "rear";
				status = "okay";
				orientation = "1";
				drivernode0 {
					/* Declare PCL support driver (classically known as guid)  */
					pcl_id = "v4l2_sensor";
					devname = "tp2854 2-0046";
					status = "okay";
					/* Declare the device-tree hierarchy to driver instance */
					proc-device-tree = "/proc/device-tree/i2c@3180000/tp2854_a@44";
				};
			};
			...(eight module definitions all up)...
	};

We’re running JetPack 4.6.4/L4T 32.7.4.

Any suggestions where I might be going wrong with my CSI setup?

hello zsaleeba,

I assume they’re 4-lane sensors, you should have camera connected to CSI-A/B, CSI-C/D, or CSI-E/F.
you may see-also Jetson TX2 NX Product Design Guide, and please refer to [Table 8-3. CSI Configuration] and [Figure 8-3. CSI Connection Options].

furthermore,
PXL_SOF syncpt timeout it means VI engine cannot receive start-of-frame.
this may due to incorrect clock configurations,
please give it a try with below commands to boost all the VI/CSI/ISP clocks.
for example,

sudo su
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
echo 1 > /sys/kernel/debug/bpmp/debug/clk/emc/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
cat /sys/kernel/debug/bpmp/debug/clk/emc/max_rate | tee /sys/kernel/debug/bpmp/debug/clk/emc/rate

Thanks Jerry. I’ll check these ideas out when I’m back from my holiday break.

Thanks for the help. As it happened the problem turned out to be something else. It was due to the numbering of the “reg” entries in our “vi” section.

/ {
	host1x {
		vi@15700000 {
			num-channels = <8>;
			ports {
				port@0 {
					...
					reg = <0>;

The device tree we received from Techpoint had numbered these incorrectly, not sequentially as they should have been.

Thanks for your help.

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