Orin R36.3.0 1080P MIPI camera cap abnormal

Camera: 1920*1080 25fps, 74.25M, 4lane MIPI CSI
HBP:148 HFP:528
VBP: 36 VFP: 4

dts:

    mclk_khz = "24000";
                        num_lanes = "4";
                        tegra_sinterface = "serial_a";
                        phy_mode = "DPHY";
                        discontinuous_clk = "yes";
                        dpcm_enable = "false";
                        cil_settletime = "0";

                        active_w = "1920";
                        active_h = "1080";
                        mode_type = "yuv";
                        pixel_phase = "uyvy";
                        csi_pixel_bit_depth = "16";
                        //csi_pixel_bit_depth = "8";
                        readout_orientation = "0";
                        line_length = "2596";
                        inherent_gain = "1";
                        mclk_multiplier = "5";
                        pix_clk_hz = "145376000"; //2596*1120*25*2

                        gain_factor = "16";
                        framerate_factor = "1000000";
                        exposure_factor = "1000000";
                        min_gain_val = "16"; /* 1.00x */
                        max_gain_val = "170"; /* 10.66x */
                        step_gain_val = "1";
                        default_gain = "16"; /* 1.00x */
                        min_hdr_ratio = "1";
                        max_hdr_ratio = "1";
                        min_framerate = "1000000"; /* 1.0 fps */
                        max_framerate = "30000000"; /* 30 fps */
                        step_framerate = "1000000";
                        default_framerate = "30000000"; /* 30 fps */
                        min_exp_time = "13"; /* us */
                        max_exp_time = "333333"; /* us */
                        step_exp_time = "1";
                        default_exp_time = "2495"; /* us */

                        embedded_metadata_height = "0";

Problem Description:
(1)The first time the device was powered on, the output images were all normal, and the dmesg output was also normal.

cmd:
gst-launch-1.0 -v v4l2src device=“/dev/video0” ! video/x-raw,framerate=25/1,width=1920,height=1080,format=UYVY ! xvimagesink

(2)After closing gst-launch-1.0, and then restarting the capture process, the image became abnormal.

The “discarding” error appears in the dmesg output.

Occasionally, there may also be cases where no image is generated and it remains purely green.

Turn it off and then on again. Sometimes it will work normally again.

Basically, there are three states that randomly appear: normal/green/striped green.

It could be the improper pix_clk_hz cause the stability problem.

The sensor output size is not the final output size. It is the total number of pixels the sensor used to generate the final output size.

For example:

Sensor output size = 2200 × 1125

(actual output size 1920 × 1080)

Frame rate = 30 frames/second

pixel_clk_hz = 2200 × 1125 × 30 = 74250000

After I configured pix_clk-hz as 2596112025, the image simply wouldn’t display.

After configuring it to 2596112025*2, the image can be displayed successfully. However, sometimes the image may appear abnormal.

Then you may need to probe the sensor output clock to confirm it.

These are the parameters provided by the camera factory.

This document tell the pix_clk_hz should be 74.25M
Maybe try continues mode.

Should the “line_length” be set to = 1920 + 148 + 528 + 44 = 2640?

I don’t think the line_length would be the key.
Get the trace log while failed to check.

This is the trace log corresponding to the three output image scenarios.

Having tried the continuous clock mode, the situation was the same.

Check the document to set the cil_settle_time to try.

85 ns + 6×ui < (cil_settletime+6) × (lp_clock_period) < 145 ns + 10×ui

  • lp_clock_period is 1/(204 MHz).

According to the above formula, here is the setting
cil_settletime is respectively 30 / 25 / 20 / 18
The test revealed
After setting this parameter,
cannot capture image,
All are green images.

If that may need to check with sensor vendor to make sure the timing follow the MIPI spec.