How to investigate csi stream flow

Hi,
Our Orin board use 4 Max9296 connect with Sensing-world’s 8 cameras on CSI lane x 4. Camera module use AR0231, AP0202, Max96705, and the resolution is 1920x1080, FPS is 20.
Now there are two board has two problems on camera:

  1. dmesg print:“tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 131072 chan_id 1” and lost this frame. It almost lost 1 frame every minutes;
  2. There is now frame capture after camera initialize, and dmesg print : “tegra-capture-vi: uncorr_err: request timed out after 2500 ms” always;

I hope there is a way to investigate NVCSI stream flow, for example: mipi packet, signal quality etc. Since it can help me to judge if it is a hardware problem.
Thanks for your help!
BR/Tim

hello ckt1010,

is it only happened with multi-cam use-case?
since it’s a SerDes chip, could you please enable test-pattern-generator?
this usually helps to narrow down the issue with bridge device configuration.

Thanks for you reply.
Since abnormal camera port is settled(lost frame board is 0-4 ports, no frame board is 6, 7 ports), multi-cam or single-cam has same behavior.
Would you please tell me how to enable test-pattern-generator?
Thanks!

hello ckt1010,

please see-also devleloper guide, Verifying the V4L2 Sensor Driver.

it’s usually the configuration on the serdes chip for creating color bar as testing purpose.
you may contact with vendor for the code snippets, and instructions.

Hi Jerry,
I read this register from AP0202:


and it is increasing, so I think ar0231->ap0202 has no problem.
And here is cat /sys/kernel/debug/tracing/trace output:

# tracer: nop
#
# entries-in-buffer/entries-written: 46/46   #P:12
#
#                                _-----=> irqs-off
#                               / _----=> need-resched
#                              | / _---=> hardirq/softirq
#                              || / _--=> preempt-depth
#                              ||| /     delay
#           TASK-PID     CPU#  ||||   TIMESTAMP  FUNCTION
#              | |         |   ||||      |         |
     kworker/1:6-222     [001] ....   172.242297: rtcpu_string: tstamp:6668199197 id:0x04010000 str:"VM0 activating."
     kworker/1:6-222     [001] ....   172.242300: rtcpu_string: tstamp:6668288252 id:0x04010000 str:"NVCSILP clock rate = 408000000 Hz.
"
     kworker/1:6-222     [001] ....   172.245918: rtcpu_dbg_set_loglevel: tstamp:6668315468 old:2 new:2
     kworker/1:6-222     [001] ....   175.270295: rtcpu_vinotify_event: tstamp:6763908159 cch:0 vi:1 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:216444051232 data:0x399e300010000000
     kworker/1:6-222     [001] ....   175.270297: rtcpu_vinotify_event: tstamp:6763908295 cch:0 vi:1 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:216444057664 data:0x0000000031000001
     kworker/1:6-222     [001] ....   175.270298: rtcpu_vinotify_event: tstamp:6763908448 cch:0 vi:1 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:216444098048 data:0x399e2d0010000000
     kworker/1:6-222     [001] ....   175.270298: rtcpu_vinotify_event: tstamp:6763908579 cch:0 vi:1 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:216444104608 data:0x0000000031000002
     kworker/1:6-222     [001] ....   175.270299: rtcpu_string: tstamp:6763960495 id:0x04010000 str:"tegra_nvcsi_stream_set_config(vm0, stream=5, csi"
     kworker/1:6-222     [001] ....   175.270300: rtcpu_string: tstamp:6763960599 id:0x04010000 str:"=6)
"
     kworker/1:6-222     [001] ....   175.273914: rtcpu_string: tstamp:6763960987 id:0x04010000 str:"MIPI clock = 400000 kHz, tHS-SETTLE = 0, tCLK-SE"
     kworker/1:6-222     [001] ....   175.273915: rtcpu_string: tstamp:6763961089 id:0x04010000 str:"TTLE = 0
"
     kworker/1:6-222     [001] ....   175.273917: rtcpu_string: tstamp:6763961307 id:0x04010000 str:"===== NVCSI Stream Configuration =====
"
     kworker/1:6-222     [001] ....   175.273918: rtcpu_string: tstamp:6763961559 id:0x04010000 str:"stream_id: PP 5, csi_port: PORT G
"
     kworker/1:6-222     [001] ....   175.273919: rtcpu_string: tstamp:6763961801 id:0x04010000 str:"Brick: PHY 3, Mode: D-PHY
"
     kworker/1:6-222     [001] ....   175.273920: rtcpu_string: tstamp:6763962086 id:0x04010000 str:"Partition: CIL A, LP bypass: Enabled, Lanes: 4
"
     kworker/1:6-222     [001] ....   175.273921: rtcpu_string: tstamp:6763962269 id:0x04010000 str:"Clock information:
"
     kworker/1:6-222     [001] ....   175.273922: rtcpu_string: tstamp:6763962570 id:0x04010000 str:"MIPI clock rate: 400.00 MHz
"
     kworker/1:6-222     [001] ....   175.273924: rtcpu_string: tstamp:6763962828 id:0x04010000 str:"T_HS settle: 0, T_CLK settle: 0
"
     kworker/1:6-222     [001] ....   175.273925: rtcpu_string: tstamp:6763963059 id:0x04010000 str:"======================================
"
     kworker/1:6-222     [001] ....   175.326295: rtcpu_string: tstamp:6764605791 id:0x04010000 str:"tegra_nvcsi_stream_open(vm0, stream=5, csi=6)
"
     kworker/1:6-222     [001] ....   175.326299: rtcpu_string: tstamp:6764612199 id:0x04010000 str:"---nvcsi_task_msg: 5
"
     kworker/1:6-222     [001] ....   175.326301: rtcpu_string: tstamp:6764612478 id:0x04010000 str:"---nvcsi_task_msg:----> reinit  5
"
     kworker/1:6-222     [001] ....   175.326302: rtcpu_string: tstamp:6764613139 id:0x04010000 str:"nvcsi_calc_ths_settle ths_settle 61
"
     kworker/1:6-222     [001] ....   175.326303: rtcpu_string: tstamp:6764613409 id:0x04010000 str:"nvcsi_calc_ths_settle ths_settle 61
"
     kworker/1:6-222     [001] ....   175.326304: rtcpu_string: tstamp:6764613672 id:0x04010000 str:"nvcsi_calc_ths_settle ths_settle 61
"
     kworker/1:6-222     [001] ....   175.326305: rtcpu_string: tstamp:6764613960 id:0x04010000 str:"nvcsi_calc_tclk_settle tclk_settle 75
"
     kworker/1:6-222     [001] ....   175.326306: rtcpu_string: tstamp:6764614243 id:0x04010000 str:"settle_time: 0x4b -- 0x3d 0x3d 0x3d
"
     kworker/1:6-222     [001] ....   175.326307: rtcpu_string: tstamp:6764614806 id:0x04010000 str:"ISR PHY 3 CIL_A 0x110
"
     kworker/1:6-222     [001] ....   175.326309: rtcpu_nvcsi_intr: tstamp:6764614528 class:GLOBAL type:PHY_INTR0 phy:3 cil:0 st:0 vc:0 status:0x00000110
     kworker/1:6-222     [001] ....   175.326310: rtcpu_string: tstamp:6764615280 id:0x04010000 str:"---nvcsi_task_msg: 4
"
     kworker/1:6-222     [001] ....   175.326311: rtcpu_string: tstamp:6764615523 id:0x04010000 str:"---nvcsi_task_msg:----> reinit  4
"
     kworker/1:6-222     [001] ....   175.326312: rtcpu_string: tstamp:6764615936 id:0x04010000 str:"nvcsi_check_deskew mipi_clock_rate 400000
"
     kworker/1:6-222     [001] ....   175.326313: rtcpu_string: tstamp:6764616136 id:0x04010000 str:"nvcsi_check_deskew  --- no
"
     kworker/1:6-222     [001] ....   175.326314: rtcpu_string: tstamp:6764616393 id:0x04010000 str:"nvcsi_dphy_start_t234 set default gain/freqband
"
     kworker/1:6-222     [001] ....   175.326316: rtcpu_string: tstamp:6764623078 id:0x04010000 str:"nvcsi_calc_ths_settle ths_settle 61
"
     kworker/1:6-222     [001] ....   175.326317: rtcpu_string: tstamp:6764623340 id:0x04010000 str:"nvcsi_calc_ths_settle ths_settle 61
"
     kworker/1:6-222     [001] ....   175.326318: rtcpu_string: tstamp:6764623601 id:0x04010000 str:"nvcsi_calc_ths_settle ths_settle 61
"
     kworker/1:6-222     [001] ....   175.326319: rtcpu_string: tstamp:6764623855 id:0x04010000 str:"nvcsi_calc_tclk_settle tclk_settle 75
"
     kworker/1:6-222     [001] ....   175.326320: rtcpu_string: tstamp:6764624135 id:0x04010000 str:"settle_time: 0x4b -- 0x3d 0x3d 0x3d
"
     kworker/1:6-222     [001] ....   175.326321: rtcpu_string: tstamp:6764624634 id:0x04010000 str:"nvcsi_check_deskew mipi_clock_rate 400000
"
     kworker/1:6-222     [001] ....   175.326322: rtcpu_string: tstamp:6764624834 id:0x04010000 str:"nvcsi_check_deskew  --- no
"
     kworker/1:6-222     [001] ....   175.326323: rtcpu_string: tstamp:6764625086 id:0x04010000 str:"nvcsi_dphy_start_t234 set default gain/freqband
"
     kworker/1:6-222     [001] ....   175.326325: rtcpu_string: tstamp:6764625284 id:0x04010000 str:"---check_reinit_stream  --- yes
"
     kworker/1:6-222     [001] ....   175.326326: rtcpu_string: tstamp:6764625573 id:0x04010000 str:"---nvcsi_task_msg: 5
"
     kworker/1:6-222     [001] ....   175.326327: rtcpu_string: tstamp:6764625818 id:0x04010000 str:"---nvcsi_task_msg:----> reinit  5
"
     kworker/1:6-222     [001] ....   183.606286: rtcpu_string: tstamp:7023598907 id:0x04010000 str:"VM0 deactivating."

Can you see any problem here?
Thanks!

hello ckt1010,

your VI tracing logs did not present camera related signaling.
if you confirm there’s packets on the CSI channel, it might be issues with device tree settings.
besides, did you have issue a reset signal to SerDes chip when s_stream has called?

Hi jerry,
I am ckt1010’s colleague,Please help us check the device tree settings: AR0231_MAX96705 → MAX9296,4 lane MIPI with 800MHz,dts related to camera is below:
reg = <0x1b>;
devnode = “video0”;
nvidia,gmsl-dser-device = <&dser_a>;
serdes-csi-link = “a”;

physical_w = “15.0”;
physical_h = “12.5”;

sensor_model =“imx185”;
post_crop_frame_drop = “0”;
use_decibel_gain = “true”;
delayed_gain = “true”;
use_sensor_mode_id = “true”;
limit_analog_gain = “true”;

mode0 {/mode IMX185_MODE_1920X1080_CROP_30FPS/
mclk_khz = “37125”;
num_lanes = “4”;
tegra_sinterface = “serial_a”;
vc_id = “0”;
phy_mode = “DPHY”;
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 = "3886";
  inherent_gain = "1";
  mclk_multiplier = "2.68";
  pix_clk_hz = "99600000";
  serdes_pix_clk_hz = "200000000";


  gain_factor = "10";
  min_gain_val = "0"; /* 0dB */
  max_gain_val = "480"; /* 48dB */
  step_gain_val = "3"; /* 0.3 */
  default_gain = "0";
  min_hdr_ratio = "1";
  max_hdr_ratio = "1";
  framerate_factor = "1000000";
  min_framerate = "1500000"; /* 1.5 */
  max_framerate = "30000000"; /* 30 */
  step_framerate = "1";
  default_framerate= "30000000";
  exposure_factor = "1000000";
  min_exp_time = "30"; /* us */
  max_exp_time = "660000"; /* us */
  step_exp_time = "1";
  default_exp_time = "33334";/* us */
  embedded_metadata_height = "0";

};

The timing sequence of the camera is as follows: AR0231 1920x1080@22fps

hello slh1223,

may I also confirm the Jetpack release version you’re working with.
there’re some update with the latest release, you may see-also Release Notes (r35.4.1).

re-cap as below…
1.2. What’s New
● Camera
○ Enhanced error resiliency for improved stability in Argus.
○ Added support for multiple camera synchronization (added sample argus_syncstereo).
○ Added support for Deskew calibration for high data rate sensors (> 1.5 Gbps).

so,
please moving to the latest release version for confirmation.

Hi Jerry,
Our board come from TzTek, they provide kernel to us. Jetpack release version is 5.1.1 and L4T 35.3.1.
And since we didn’t use Argus and Deskew (800Mps), they think we don’t need update kernel.
BTW could you check our dts if it is valid?
Thanks!

hello ckt1010,

let’s narrow down the issue,
please simplify the connection to leave only single camera on the system, and also revise the DT to keep only vc-id=0 in the node definition.
can the device node (i.e. $ /dev/video0) register to linux kernel correctly?
if yes, please refer to SerDes Pixel Clock section to double check the clock settings.
if no, there might be something wrong in the port bindings, you may check Port Binding to review the settings.

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