Can't produce pictures using mipi deskew

Hi All,
I use 2xLAN, the rate of each LAN is 2.5G, and I turn on the deskew function on the deserializer, but the picture cannot be drawn. Please help me take a look.

root@tegra:/home/robot# sudo su
cd /sys/kernel/debug/dynamic_debug/
echo file csi5_fops.c +p > control

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

echo 1 > /sys/kernel/debug/tracing/tracing_on
echo 30720 > /sys/kernel/debug/tracing/buffer_size_kb
echo 1 > /sys/kernel/debug/tracing/events/tegra_rtcpu/enable
echo 1 > /sys/kernel/debug/tracing/events/freertos/enable
echo 2 > /sys/kernel/debug/camrtc/log-level
echo 1 > /sys/kernel/debug/tracing/events/camera_common/enable
echo > /sys/kernel/debug/tracing/trace
cat /sys/kernel/debug/tracing/trace

echo 0 > /sys/kernel/debug/tracing/tracing_on
echo > /sys/kernel/debug/tracing/trace
echo 1 > /sys/kernel/debug/tracing/tracing_on
cat /sys/kernel/debug/tracing/traceroot@tegra:/home/robot# cd /sys/kernel/debug/dynamic_debug/
root@tegra:/sys/kernel/debug/dynamic_debug# echo file csi5_fops.c +p > control
root@tegra:/sys/kernel/debug/dynamic_debug#
root@tegra:/sys/kernel/debug/dynamic_debug# echo 1 > /sys/kernel/debug/bpmp/debug/clk/vi/mrq_rate_locked
root@tegra:/sys/kernel/debug/dynamic_debug# echo 1 > /sys/kernel/debug/bpmp/debug/clk/isp/mrq_rate_locked
root@tegra:/sys/kernel/debug/dynamic_debug# echo 1 > /sys/kernel/debug/bpmp/debug/clk/nvcsi/mrq_rate_locked
root@tegra:/sys/kernel/debug/dynamic_debug# echo 1 > /sys/kernel/debug/bpmp/debug/clk/emc/mrq_rate_locked
root@tegra:/sys/kernel/debug/dynamic_debug# cat /sys/kernel/debug/bpmp/debug/clk/vi/max_rate |tee /sys/kernel/debug/bpmp/debug/clk/vi/rate
832000000
root@tegra:/sys/kernel/debug/dynamic_debug# cat /sys/kernel/debug/bpmp/debug/clk/isp/max_rate | tee /sys/kernel/debug/bpmp/debug/clk/isp/rate
1011200000
root@tegra:/sys/kernel/debug/dynamic_debug# cat /sys/kernel/debug/bpmp/debug/clk/nvcsi/max_rate | tee /sys/kernel/debug/bpmp/debug/clk/nvcsi/rate
642900000
root@tegra:/sys/kernel/debug/dynamic_debug# cat /sys/kernel/debug/bpmp/debug/clk/emc/max_rate | tee /sys/kernel/debug/bpmp/debug/clk/emc/rate
3199000000
root@tegra:/sys/kernel/debug/dynamic_debug#
root@tegra:/sys/kernel/debug/dynamic_debug# echo 1 > /sys/kernel/debug/tracing/tracing_on
root@tegra:/sys/kernel/debug/dynamic_debug# echo 30720 > /sys/kernel/debug/tracing/buffer_size_kb
root@tegra:/sys/kernel/debug/dynamic_debug# echo 1 > /sys/kernel/debug/tracing/events/tegra_rtcpu/enable
root@tegra:/sys/kernel/debug/dynamic_debug# echo 1 > /sys/kernel/debug/tracing/events/freertos/enable
root@tegra:/sys/kernel/debug/dynamic_debug# echo 2 > /sys/kernel/debug/camrtc/log-level
root@tegra:/sys/kernel/debug/dynamic_debug# echo 1 > /sys/kernel/debug/tracing/events/camera_common/enable
root@tegra:/sys/kernel/debug/dynamic_debug# echo > /sys/kernel/debug/tracing/trace
root@tegra:/sys/kernel/debug/dynamic_debug# cat /sys/kernel/debug/tracing/trace
# tracer: nop
#
# entries-in-buffer/entries-written: 0/0   #P:8
#
#                                _-----=> irqs-off
#                               / _----=> need-resched
#                              | / _---=> hardirq/softirq
#                              || / _--=> preempt-depth
#                              ||| /     delay
#           TASK-PID     CPU#  ||||   TIMESTAMP  FUNCTION
#              | |         |   ||||      |         |
root@tegra:/sys/kernel/debug/dynamic_debug#
root@tegra:/sys/kernel/debug/dynamic_debug# echo 0 > /sys/kernel/debug/tracing/tracing_on
root@tegra:/sys/kernel/debug/dynamic_debug# echo > /sys/kernel/debug/tracing/trace
root@tegra:/sys/kernel/debug/dynamic_debug# echo 1 > /sys/kernel/debug/tracing/tracing_on
root@tegra:/sys/kernel/debug/dynamic_debug# cat /sys/kernel/debug/tracing/trace
# tracer: nop
#
# entries-in-buffer/entries-written: 0/0   #P:8
#
#                                _-----=> irqs-off
#                               / _----=> need-resched
#                              | / _---=> hardirq/softirq
#                              || / _--=> preempt-depth
#                              ||| /     delay
#           TASK-PID     CPU#  ||||   TIMESTAMP  FUNCTION
#              | |         |   ||||      |         |
root@tegra:/sys/kernel/debug/dynamic_debug# v4l2-ctl -d /dev/video0 --stream-mmap --stream-to-host 192.168.1.111
                VIDIOC_CROPCAP returned -1 (Inappropriate ioctl for device)
                VIDIOC_G_STD returned -1 (Inappropriate ioctl for device)
                VIDIOC_G_DV_TIMINGS returned -1 (Inappropriate ioctl for device)
^C
root@tegra:/sys/kernel/debug/dynamic_debug# ^C
root@tegra:/sys/kernel/debug/dynamic_debug# ^C
ar0233_a@1b {
			compatible = "nvidia,ar0233";

			reg = <0x1b>;

			/* Physical dimensions of sensor */
			physical_w = "15.0";
			physical_h = "12.5";

			sensor_model ="ar0233";

			/* 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";

			/* Convert Gain to unit of dB (decibel) befor passing to kernel driver */
			//use_decibel_gain = "true";

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

			/**
			* A modeX node is required to support v4l2 driver
			* implementation with NVIDIA camera software stack
			*
			* mclk_khz = "";
			* Standard MIPI driving clock, typically 24MHz
			*
			* num_lanes = "";
			* Number of lane channels sensor is programmed to output
			*
			* tegra_sinterface = "";
			* The base tegra serial interface lanes are connected to
			*
			* vc_id = "";
			* The virtual channel id of the sensor.
			*
			* discontinuous_clk = "";
			* The sensor is programmed to use a discontinuous clock on MIPI lanes
			*
			* dpcm_enable = "true";
			* The sensor is programmed to use a DPCM modes
			*
			* cil_settletime = "";
			* MIPI lane settle time value.
			* A "0" value attempts to autocalibrate based on mclk_khz and pix_clk_hz
			*
			* active_w = "";
			* Pixel active region width
			*
			* active_h = "";
			* Pixel active region height
			*
			* dynamic_pixel_bit_depth = "";
			* sensor dynamic bit depth for sensor mode
			*
			* csi_pixel_bit_depth = "";
			* sensor output bit depth for sensor mode
			*
			* mode_type="";
			* Sensor mode type, For eg: yuv, Rgb, bayer, bayer_wdr_pwl
			*
			* pixel_phase="";
			* Pixel phase for sensor mode, For eg: rggb, vyuy, rgb888
			*
			* readout_orientation = "0";
			* Based on camera module orientation.
			* Only change readout_orientation if you specifically
			* Program a different readout order for this mode
			*
			* line_length = "";
			* Pixel line length (width) for sensor mode.
			* This is used to calibrate features in our camera stack.
			*
			* pix_clk_hz = "";
			* Sensor pixel clock used for calculations like exposure and framerate
			*
			*
			*
			*
			* inherent_gain = "";
			* Gain obtained inherently from mode (ie. pixel binning)
			*
			* min_gain_val = ""; (floor to 6 decimal places)
			* max_gain_val = ""; (floor to 6 decimal places)
			* Gain limits for mode
			* if use_decibel_gain = "true", please set the gain as decibel
			*
			* min_exp_time = ""; (ceil to integer)
			* max_exp_time = ""; (ceil to integer)
			* Exposure Time limits for mode (us)
			*
			*
			* min_hdr_ratio = "";
			* max_hdr_ratio = "";
			* HDR Ratio limits for mode
			*
			* min_framerate = "";
			* max_framerate = "";
			* Framerate limits for mode (fps)
			*
			* embedded_metadata_height = "";
			* Sensor embedded metadata height in units of rows.
			* If sensor does not support embedded metadata value should be 0.
			*/

			mode0 {/*mode ar0233_MODE_1920X1080_CROP_30FPS_LINEAR*/
				mclk_khz = "24000";
				num_lanes = "2";
				tegra_sinterface = "serial_a";
				vc_id = "0";
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = "0";
				dynamic_pixel_bit_depth = "16";
				csi_pixel_bit_depth = "16";
				mode_type = "yuv";
				pixel_phase = "yuyv";

				active_w = "1920";
				active_h = "1080";
				readout_orientation = "0";
				line_length = "2200";
				inherent_gain = "1";
				pix_clk_hz = "74250000";
				serdes_pix_clk_hz = "312500000";

				gain_factor = "100";
				min_gain_val = "100"; /* dB */
				max_gain_val = "1200"; /* dB */
				step_gain_val = "1";
				default_gain = "100";
				min_hdr_ratio = "1";
				max_hdr_ratio = "1";
				framerate_factor = "1000000";
				min_framerate = "10000000";
				max_framerate = "30000000";
				step_framerate = "1";
				default_framerate = "30000000";
				exposure_factor = "1000000";
				min_exp_time = "49"; /*us, 2 lines*/
				max_exp_time = "40000";
				step_exp_time = "1";
				default_exp_time = "12000";/* us */
				embedded_metadata_height = "0";
			};
			mode1 {/*mode ar0233_MODE_1920X1536_CROP_30FPS_LINEAR*/
				mclk_khz = "24000";
				num_lanes = "2";
				tegra_sinterface = "serial_a";
				vc_id = "0";
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = "0";
				dynamic_pixel_bit_depth = "16";
				csi_pixel_bit_depth = "16";
				mode_type = "yuv";
				pixel_phase = "yuyv";

				active_w = "1920";
				active_h = "1536";
				readout_orientation = "0";
				line_length = "2800";
				inherent_gain = "1";
				pix_clk_hz = "115500000";
				serdes_pix_clk_hz = "312500000";

				gain_factor = "100";
				min_gain_val = "100"; /* dB */
				max_gain_val = "1200"; /* dB */
				step_gain_val = "1";
				default_gain = "100";
				min_hdr_ratio = "1";
				max_hdr_ratio = "1";
				framerate_factor = "1000000";
				min_framerate = "10000000";
				max_framerate = "30000000";
				step_framerate = "1";
				default_framerate = "30000000";
				exposure_factor = "1000000";
				min_exp_time = "49"; /*us, 2 lines*/
				max_exp_time = "40000";
				step_exp_time = "1";
				default_exp_time = "12000";/* us */
				embedded_metadata_height = "0";
			};
			ports {
				#address-cells = <1>;
				#size-cells = <0>;
				port@0 {
					reg = <0>;
					ar0233_out0: endpoint {
						vc-id = <0>;
						port-index = <2>;
						bus-width = <2>;
						remote-endpoint = <&ar0233_csi_in0>;
					};
				};
			};
			gmsl-link {
				src-csi-port = "b";
				dst-csi-port = "a";
				serdes-csi-link = "a";
				csi-mode = "2x4";
				st-vc = <0>;
				vc-id = <0>;
				num-lanes = <2>;
				streams = "ued-u1", "raw12";
			};
		};

dmesg.log (81.9 KB)
trace.log (75.8 MB)

Capture without problem with > 1.5G without deskew?


PHY_INTR0 phy:0 cil:0 st:0 vc:0 status:0x00000080

LP sequence error. normally, it should follow by LP11->LP01->LP00->LP11 sequence. so, it's more like a hardware issue.

PHY_INTR0 phy:0 cil:1 st:0 vc:0 status:0x00000044
the error code 0x44 indicate there're more than one bit error has detected on data-lane;
PHY_INTR0 phy:0 cil:0 st:0 vc:0 status:0x0e000000, or, 0x06000000
this is due to DPHY deskew calibration not complete, it happened when the calibration sequence length is not long enough.
try to configure cil_settletime, and please also review the serdes_pix_clk_hz settings.

The settings are as follows:

serdes_pix_clk_hz = “312500000”; //2500000000 × 2 ÷ 16 = 312500000
cil_settletime = “0”;

softversion:

root@tegra:/home/robot# cat /etc/nv_tegra_release
# R35 (release), REVISION: 4.1, GCID: 33958178, BOARD: t186ref, EABI: aarch64, DATE: Tue Aug  1 19:57:35 UTC 2023

MAX96712


0x0903 = 0x80
0x0943 = 0x80
0x0983 = 0x80
0x09C3 = 0x80


0x0904 = 0x91
0x0944 = 0x91
0x0984 = 0x91
0x09C4 = 0x91

trace:
trace.log (1.4 MB)
dts:
dts.txt (426.7 KB)

sensor info:

It could be the timing issue.
Please probe to make sure of it.

Sorry, the reply time is a little late, high-speed oscilloscope, it is a little difficult for us to coordinate, check the max96712 string solver, pipe has video lock, I first from the code analysis:

serdes_pix_clk_hz = “250000000”; //2000000000 × 2 ÷ 16 = 250000000


Log:

/*
 * deskew should be run when the sensor data rate is >= 1.5 gbps
 * data is sent on both rising/falling edges of clock, so /2
 */
#define CLK_HZ_FOR_DESKEW ((1500*1000*1000)/2)

I tried to set the rate of PHY to 2G, and when I added the log, the following deskew setting function did not reach:
nvcsi_deskew_setup(deskew_ctx);
So, i’m using the deskew feature. How do I set the following parameters?

serdes_pix_clk_hz
pix_clk_hz

Please check below NOTE.

Skew calibration is required if sensor or deserializer is using DPHY, and the output data rate is > 1.5Gbps.
An initiation deskew signal should be sent by sensor or deserializer to perform the skew calibration. If the deskew signals is not sent, the receiver will stall, and the capture will time out.
You can calculate the output data rate with the following equation:

Output data rate = (sensor or deserializer pixel clock in hertz) * (bits per pixel) / (number of CSI lanes)

According to the above calculation method, it is sufficient to exceed 1.5G. Why in the code, deskew is enabled, but CLK_HZ_FOR_DESKEW is used for comparison, causing nvcsi_deskew setup to be unable to be executed.
serdes_pix_clk_hz = “250000000”; //2000000000 × 2 ÷ 16 = 250000000
serdes_pix_clk_hz < CLK_HZ_FOR_DESKEW

Suppose Orin NX run the deskew by RTCPU(RCE firmware) instead of NVHOST_NVCSI_IOCTL_DESKEW_SETUP

Can I understand it this way?
That is, the software does not need to turn on deskew in dts or by issuing commands. When the set serdes_pix_clk_hz or pix_clk_hz reaches the value that requires turning on deskew, RTCPU (RCE firmware) will automatically turn on deskew, right?

Right, only need sensor send deskew word before streaming.

Thanks

OK, thank you. I’ll check for hardware issues.

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