TC358743 porting to Jetpack6.1 on Jetson Orin NX

Hi,
We have a driver for tc358743 that works great for Jetson Orin NX 16GB running Jetpack5.1.3.
We are using this driver with Jetson Orin NX EVM & B101 MIPI2CSI bridge which is connected to CSI port 2 (Cam0)

Driver Code:
tc358743-orin.zip (25.0 KB)

Device Tree changes:

      status = "okay";
      compatible = "tc358743";
      reg = <0x0F>; /* shifted by 2 */
      devnode = "video0";
      refclk_hz = <27000000>;  // refclk_hz -> regclk
      refclk = <27000000>;  // refclk_hz -> regclk

      reset-gpios = <&tegra_main_gpio CAM0_PWDN GPIO_ACTIVE_HIGH>;

      #clock-cells = <0>;
      clock-names = "refclk";
      clock-frequency = <27000000>;

      /* Physical dimensions of sensor */
      physical_w = "4.713";
      physical_h = "3.494";
      /* Sensor Model */
      sensor_model ="tc358743";
      use_sensor_mode_id = "true";

      num_lanes = "2";
      tegra_sinterface = "serial_c";
      phy_mode = "DPHY";
      discontinuous_clk = "no";

      ddc5v_delay = <2>;
      enable_hdcp = "false";

      lineinitcnt = <0xfa0>;
      lptxtimecnt = <0x05>;
      tclk_headercnt = <0x1603>;
      tclk_trailcnt = <0x01>;
      ths_headercnt = <0x0603>;
      twakeup = <0x32c8>;
      tclk_postcnt = <0x008>;
      ths_trailcnt = <0x02>;
      hstxvregcnt = <0x05>;

      ports {
              #address-cells = <1>;
              #size-cells = <0>;
              port@0 {
                      reg = <0>;
                      rbpcv2_imx219_out1: endpoint {
                              status = "okay";
                              port-index = <2>;
                              bus-width = <2>;
                              remote-endpoint = <&rbpcv2_imx219_csi_in1>;

                              phy_mode = "DPHY";
                              cil_settletime = "30";
                              data-lanes = <1 2>;
                              clock-lanes = <0>;
                              clock-noncontinuous;
                              link-frequencies = /bits/ 64 <297000000>; //<594000000>; // <297000000>;
                      };
              };
      };

We want to port this driver to Jetpack6.1.
This driver complies ok with kernel 5.15
We placed the driver code in nvidia-oot drivers directory and everything gets built fine
But when we try to insmod our driver the kernel crashes or hangs forever.

We read in the Sensor Driver Programming guide of 36.4 that in 36.4 we should switch to use the tegra camera infrastructure and not register the driver directly with v4l.
So we tried this approach also, our reference for our driver development was Lontium lt6911uxc driver that is present in SDK 6.1. in nvidia-oot.

Driver Code:
nv_tc358743.txt (72.6 KB)

Device Tree:

	compatible = "toshiba,tc358743";
	reg = <0x0f>;
	devnode ="video0";
	clock-names = "refclk";
	clock-frequency = <27000000>;
	mclk = "cam_mclk0";
	refclk_hz = <27000000>;
	physical_w = "4.713";
	physical_h = "3.494";
	sensor_model ="tc358743";
	ddc5v_delay = <2>;
	enable_hdcp = "false";
	lineinitcnt = <0xfa0>;
	lptxtimecnt = <0x05>;
	tclk_headercnt = <0x1603>;
	tclk_trailcnt = <0x01>;
	ths_headercnt = <0x0603>;
	twakeup = <0x32c8>;
	tclk_postcnt = <0x008>;
	ths_trailcnt = <0x02>;
	hstxvregcnt = <0x05>;
	use_sensor_mode_id = "true";

	mode0 {
		mclk_khz = "37125";
		num_lanes = "2";
		tegra_sinterface = "serial_c";
		phy_mode = "DPHY";
		discontinuous_clk = "yes";
		dpcm_enable = "true";
		cil_settletime = "0";
		active_w = "1280";
		active_h = "720";
		mode_type = "yuv";
		pixel_phase = "uyvy";
		csi_pixel_bit_depth = "16";
		readout_orientation = "0";
		line_length = "1280";
		inherent_gain = "1";
		mclk_multiplier = "2";
		pix_clk_hz = "74250000";
		lane_polarity = "0";							
		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 = "50000000"; /* 2.0 fps */
		max_framerate = "50000000"; /* 21.0 fps */
		step_framerate = "1";
		default_framerate = "50000000"; /* 21.0 fps */
		min_exp_time = "13"; /* us */
		max_exp_time = "683709"; /* us */
		step_exp_time = "1";
		default_exp_time = "2495"; /* us */
		embedded_metadata_height = "2";
	};					

	ports {
		#address-cells = <1>;
		#size-cells = <0>;
		port@0 {
			reg = <0>;
			rbpcv2_imx219_out1: endpoint {								
				status = "okay";
				port-index = <2>;
				bus-width = <2>;
				data-lanes = <1 2>;
				clock-lanes = <0>;
				clock-noncontinuous;
				link-frequencies = /bits/ 64 <297000000>;
				remote-endpoint = <&rbpcv2_imx219_csi_in1>;
			};
		};
	};

But, when we are trying to capture video from the camera using v4l-ctl we get the following errors:

[   65.244901] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[   65.244914] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[   65.246437] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: successfully reset the capture channel
[   67.804715] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[   67.804733] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[   67.805366] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: successfully reset the capture channel
[   70.364716] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[   70.364731] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[   70.365421] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: successfully reset the capture channel
[   72.924716] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[   72.924735] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[   72.925357] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: successfully reset the capture channel
[   75.452714] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[   75.452732] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel

When we are trying to capture the video using nvgstcapture we get

Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:794 No cameras available

And the modes from the dts are not recognized.

Thanks
Ben

hello ben.r,

please refer to developer guide, Camera Driver Porting,
and also, Topic 310858 for known changes when porting DTS from JP-5 to JP-6

Thank you for your help, the link you have shared helped us a lot.
We are now able to insmod our driver successfully and we are able to see the video0 device node, when we try to grab frames with v4l2-ctl we get:

[ 65.244901] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[ 65.244914] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[ 65.246437] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: successfully reset the capture channel
[ 67.804715] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[ 67.804733] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[ 67.805366] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: successfully reset the capture channel

We have verified using a scope the on the MIPI bus transmission begins, is there a way to get more debug info from VI/NVCSI ?

hello ben.r,

it’s reporting timeout failure, which means VI engine cannot receive SOF/EOF correctly within 2500ms.

let’s enable VI tracing logs,
please note that, VI tracing logs /sys/kernel/debug/camrtc/log-level is disabled by default.
you should probe the debug module to enable it. i.e. $ modprobe rtcpu_debug
after that,
please follow the steps as below to enable VI tracing logs. you should enable camera stream again to gather more details,

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 > /sys/kernel/debug/tracing/trace

you should enable camera stream again to gather more details,
i.e. cat /sys/kernel/debug/tracing/trace

We have enabled VI logs and got the following from /sys/kernel/debug/tracing/trace:

# tracer: nop
#
# entries-in-buffer/entries-written: 91489/91489   #P:4
#
#                                _-------=> irqs-off
#                               / _------=> need-resched
#                              | / _-----=> need-resched-lazy
#                              || / _----=> hardirq/softirq
#                              ||| / _---=> preempt-depth
#                              |||| / _--=> preempt-lazy-depth
#                              ||||| / _-=> migrate-disable
#                              |||||| /     delay
#           TASK-PID     CPU#  |||||||  TIMESTAMP  FUNCTION
#              | |         |   |||||||      |         |
     kworker/2:2-147     [002] .......    91.366748: rtcpu_string: tstamp:3712428442 id:0x04010000 str:"VM0 deactivating."
     kworker/2:3-148     [002] .......   108.462458: rtcpu_string: tstamp:4246117117 id:0x04010000 str:"VM0 activating."
     kworker/2:3-148     [002] .......   108.518449: rtcpu_vinotify_event: tstamp:4246800675 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:135881169056 data:0x799d580010000000
     kworker/2:3-148     [002] .......   108.518450: rtcpu_vinotify_event: tstamp:4246800832 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:135881175456 data:0x0000000031000001
     kworker/2:3-148     [002] .......   108.518451: rtcpu_vinotify_event: tstamp:4246800986 cch:0 vi:0 tag:VIFALC_ACTIONLST channel:0x23 frame:0 vi_tstamp:135881178464 data:0x0000000007020001
     kworker/2:3-148     [002] .......   108.518452: rtcpu_vinotify_event: tstamp:4246801133 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:135881220704 data:0x799d550010000000
     kworker/2:3-148     [002] .......   108.518452: rtcpu_vinotify_event: tstamp:4246801287 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:135881227232 data:0x0000000031000002
     kworker/2:3-148     [002] .......   111.098438: rtcpu_vinotify_event: tstamp:4328724080 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:138503196608 data:0x799d580010000000
     kworker/2:3-148     [002] .......   111.098441: rtcpu_vinotify_event: tstamp:4328724237 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:138503238688 data:0x0000000031000001
     kworker/2:3-148     [002] .......   111.098442: rtcpu_vinotify_event: tstamp:4328724373 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:138503256864 data:0x799d550010000000
     kworker/2:3-148     [002] .......   111.098442: rtcpu_vinotify_event: tstamp:4328724526 cch:0 vi:0 tag:VIFALC_ACTIONLST channel:0x23 frame:0 vi_tstamp:138503277216 data:0x0000000007020001
     kworker/2:3-148     [002] .......   111.098443: rtcpu_vinotify_event: tstamp:4328724661 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:138503319584 data:0x0000000031000002
     kworker/2:3-148     [002] .......   113.674425: rtcpu_vinotify_event: tstamp:4408477991 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:141063295168 data:0x799d580010000000
     kworker/2:3-148     [002] .......   113.674428: rtcpu_vinotify_event: tstamp:4408478128 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:141063340320 data:0x0000000031000001
     kworker/2:3-148     [002] .......   113.674430: rtcpu_vinotify_event: tstamp:4408478315 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:141063358432 data:0x799d550010000000
     kworker/2:3-148     [002] .......   113.674430: rtcpu_vinotify_event: tstamp:4408478449 cch:0 vi:0 tag:VIFALC_ACTIONLST channel:0x23 frame:0 vi_tstamp:141063378816 data:0x0000000007020001
     kworker/2:3-148     [002] .......   113.674431: rtcpu_vinotify_event: tstamp:4408478600 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:141063421184 data:0x0000000031000002
     kworker/2:3-148     [002] .......   116.194420: rtcpu_nvcsi_intr: tstamp:4487258486 class:GLOBAL type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000004
     kworker/2:3-148     [002] .......   116.194423: rtcpu_nvcsi_intr: tstamp:4487258486 class:CORRECTABLE_ERR type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000004
     kworker/2:3-148     [002] .......   116.194424: rtcpu_nvcsi_intr: tstamp:4487258486 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00000110
     kworker/2:3-148     [002] .......   116.194425: rtcpu_nvcsi_intr: tstamp:4487261091 class:GLOBAL type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000004
     kworker/2:3-148     [002] .......   116.194426: rtcpu_nvcsi_intr: tstamp:4487261091 class:CORRECTABLE_ERR type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000004
     kworker/2:3-148     [002] .......   116.194426: rtcpu_nvcsi_intr: tstamp:4487261091 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00000110
     kworker/2:3-148     [002] .......   116.194427: rtcpu_nvcsi_intr: tstamp:4487267148 class:GLOBAL type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000008
     kworker/2:3-148     [002] .......   116.194427: rtcpu_nvcsi_intr: tstamp:4487267148 class:CORRECTABLE_ERR type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000008
     kworker/2:3-148     [002] .......   116.194428: rtcpu_nvcsi_intr: tstamp:4487267148 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00000110
     kworker/2:3-148     [002] .......   116.194429: rtcpu_nvcsi_intr: tstamp:4487268593 class:GLOBAL type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000004
     kworker/2:3-148     [002] .......   116.194429: rtcpu_nvcsi_intr: tstamp:4487268593 class:CORRECTABLE_ERR type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000004
     kworker/2:3-148     [002] .......   116.194430: rtcpu_nvcsi_intr: tstamp:4487268593 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00000110
     kworker/2:3-148     [002] .......   116.194430: rtcpu_nvcsi_intr: tstamp:4487276925 class:GLOBAL type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000004
     kworker/2:3-148     [002] .......   116.194431: rtcpu_nvcsi_intr: tstamp:4487276925 class:CORRECTABLE_ERR type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000004
     kworker/2:3-148     [002] .......   116.194432: rtcpu_nvcsi_intr: tstamp:4487276925 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00000110
     kworker/2:3-148     [002] .......   116.194432: rtcpu_nvcsi_intr: tstamp:4487285260 class:GLOBAL type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000004
     kworker/2:3-148     [002] .......   116.194433: rtcpu_nvcsi_intr: tstamp:4487285260 class:CORRECTABLE_ERR type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000004
     kworker/2:3-148     [002] .......   116.194433: rtcpu_nvcsi_intr: tstamp:4487285260 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00000110
     kworker/2:3-148     [002] .......   116.194434: rtcpu_nvcsi_intr: tstamp:4487293594 class:GLOBAL type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000004
     kworker/2:3-148     [002] .......   116.194435: rtcpu_nvcsi_intr: tstamp:4487293594 class:CORRECTABLE_ERR type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000004
     kworker/2:3-148     [002] .......   116.194435: rtcpu_nvcsi_intr: tstamp:4487293594 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00000110
     kworker/2:3-148     [002] .......   116.194436: rtcpu_nvcsi_intr: tstamp:4487301094 class:GLOBAL type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000004
     kworker/2:3-148     [002] .......   116.194436: rtcpu_nvcsi_intr: tstamp:4487301094 class:CORRECTABLE_ERR type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000004
     kworker/2:3-148     [002] .......   116.194437: rtcpu_nvcsi_intr: tstamp:4487301094 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00000110
     kworker/2:3-148     [002] .......   116.194438: rtcpu_nvcsi_intr: tstamp:4487309430 class:GLOBAL type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000004
     kworker/2:3-148     [002] .......   116.194438: rtcpu_nvcsi_intr: tstamp:4487309430 class:CORRECTABLE_ERR type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000004
     kworker/2:3-148     [002] .......   116.194439: rtcpu_nvcsi_intr: tstamp:4487309430 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00000110
     kworker/2:3-148     [002] .......   116.194440: rtcpu_nvcsi_intr: tstamp:4487317153 class:GLOBAL type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000008
     kworker/2:3-148     [002] .......   116.194440: rtcpu_nvcsi_intr: tstamp:4487317153 class:CORRECTABLE_ERR type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000008
     kworker/2:3-148     [002] .......   116.194441: rtcpu_nvcsi_intr: tstamp:4487317153 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00000110
     kworker/2:3-148     [002] .......   116.194441: rtcpu_nvcsi_intr: tstamp:4487318595 class:GLOBAL type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000004
     kworker/2:3-148     [002] .......   116.194442: rtcpu_nvcsi_intr: tstamp:4487318595 class:CORRECTABLE_ERR type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000004
     kworker/2:3-148     [002] .......   116.194443: rtcpu_nvcsi_intr: tstamp:4487318595 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00000110
     kworker/2:3-148     [002] .......   116.194443: rtcpu_nvcsi_intr: tstamp:4487324653 class:GLOBAL type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000008
     kworker/2:3-148     [002] .......   116.194444: rtcpu_nvcsi_intr: tstamp:4487324653 class:CORRECTABLE_ERR type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000008
     kworker/2:3-148     [002] .......   116.194444: rtcpu_nvcsi_intr: tstamp:4487324653 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00000110
     kworker/2:3-148     [002] .......   116.194445: rtcpu_nvcsi_intr: tstamp:4487325649 class:GLOBAL type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000008
     kworker/2:3-148     [002] .......   116.194446: rtcpu_nvcsi_intr: tstamp:4487325649 class:CORRECTABLE_ERR type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000008
     kworker/2:3-148     [002] .......   116.194446: rtcpu_nvcsi_intr: tstamp:4487325649 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00000110
     kworker/2:3-148     [002] .......   116.194447: rtcpu_nvcsi_intr: tstamp:4487326930 class:GLOBAL type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000004
     kworker/2:3-148     [002] .......   116.194447: rtcpu_nvcsi_intr: tstamp:4487326930 class:CORRECTABLE_ERR type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000004
     kworker/2:3-148     [002] .......   116.194448: rtcpu_nvcsi_intr: tstamp:4487326930 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00000110

Can you help us debug the issue?

Thanks

hello ben.r,

here’re PHY interrupts,

the error code 0x110 means… Data lane FIFO overflow, and also LP sequence error detected on data lane.
this should be the failure on the sensor side, please check you’re following CSI-2 standard for sending frames to Jetson platform.
besides, please see-also similar topics for digging into data-lane FIFO overflow failures.
such as… Topic 209574, and Topic 242054.

Hi Jerry,

Thank you.
We are investigating it.

But, I think its worth mentioning that JetPack5.1.3 we were able to capture frames correctly.
What could be the reason that in JetPack6.1 we suddenly get FIFO overflow?

Thanks

hello ben.r,

please see-also Camera Driver Porting to examine your driver since it’s driver porting issues.
let’s also narrow down the issue by Applications Using V4L2 IOCTL Directly, which using V4L2 IOCTL to verify basic camera functionality.

Thank you for the help,

We made a significant progress and now it seems like the timeout issues are gone.

But now we get the following errors when trying to capture the video using v4l2-ctl, it looks like timing issues:

nv@nv-desktop:~$ v4l2-ctl --set-fmt-video=width=1920,height=1080 --set-ctrl bypass_mode=0 --stream-mmap
New timings found
[  640.800048] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 131072
[  640.819998] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 131072
[  640.840015] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 131072
[  640.860059] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 131072
[  640.880071] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 131072
[  640.900011] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 131072
[  640.920018] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 131072
[  640.940066] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 131072
[  640.960079] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 131072
[  640.980022] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 131072
[  641.000037] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 131072
[  641.020067] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 131072
[  641.040080] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 131072
[  641.060020] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 131072
[  641.080036] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 131072
[  641.100068] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 131072
[  641.120090] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 131072
[  641.140036] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 131072
[  641.160050] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 131072
[  641.180077] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 131072
[  641.200094] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 131072
[  641.220199] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 131072
[  641.240037] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 131072
[  641.260076] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 131072
[  641.280089] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 131072
[  641.300039] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 131072

When enabling the VI debug we get the following from cat /sys/kernel/debug/tracing/trace:

# tracer: nop
#
# entries-in-buffer/entries-written: 1167/1167   #P:4
#
#                                _-------=> irqs-off
#                               / _------=> need-resched
#                              | / _-----=> need-resched-lazy
#                              || / _----=> hardirq/softirq
#                              ||| / _---=> preempt-depth
#                              |||| / _--=> preempt-lazy-depth
#                              ||||| / _-=> migrate-disable
#                              |||||| /     delay
#           TASK-PID     CPU#  |||||||  TIMESTAMP  FUNCTION
#              | |         |   |||||||      |         |
     kworker/2:1-58      [002] .......   640.825411: rtcpu_vinotify_event: tstamp:20887633466 cch:0 vi:1 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:668387107328 data:0x799e300010000000
     kworker/2:1-58      [002] .......   640.825414: rtcpu_vinotify_event: tstamp:20887633606 cch:0 vi:1 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:668387149376 data:0x0000000031000001
     kworker/2:1-58      [002] .......   640.825414: rtcpu_vinotify_event: tstamp:20887633763 cch:0 vi:1 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:668387167584 data:0x799e2d0010000000
     kworker/2:1-58      [002] .......   640.825415: rtcpu_vinotify_event: tstamp:20887633899 cch:0 vi:1 tag:VIFALC_ACTIONLST channel:0x23 frame:0 vi_tstamp:668387187936 data:0x0000000007020001
     kworker/2:1-58      [002] .......   640.825415: rtcpu_vinotify_event: tstamp:20887634052 cch:0 vi:1 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:668387230304 data:0x0000000031000002
     kworker/2:1-58      [002] .......   640.825415: rtcpu_vinotify_event: tstamp:20887634187 cch:0 vi:1 tag:FS channel:0x00 frame:0 vi_tstamp:668390028928 data:0x0000000000000012
     kworker/2:1-58      [002] .......   640.825416: rtcpu_vinotify_event: tstamp:20887634343 cch:0 vi:1 tag:ATOMP_FS channel:0x00 frame:0 vi_tstamp:668390029024 data:0x0000000800000000
     kworker/2:1-58      [002] .......   640.825416: rtcpu_vinotify_event: tstamp:20887634477 cch:0 vi:1 tag:CHANSEL_PXL_SOF channel:0x23 frame:0 vi_tstamp:668390030368 data:0x0000000000000001
     kworker/2:1-58      [002] .......   640.825417: rtcpu_vinotify_event: tstamp:20887634630 cch:0 vi:1 tag:VIFALC_ACTIONLST channel:0x23 frame:0 vi_tstamp:668390069920 data:0x0000000008020001
     kworker/2:1-58      [002] .......   640.825417: rtcpu_vinotify_event: tstamp:20887766473 cch:0 vi:1 tag:FE channel:0x00 frame:0 vi_tstamp:668408108352 data:0x0000000000000022
     kworker/2:1-58      [002] .......   640.825418: rtcpu_vinotify_event: tstamp:20887766627 cch:0 vi:1 tag:CHANSEL_SHORT_FRAME channel:0x04 frame:0 vi_tstamp:668408108384 data:0x0290200001000000
     kworker/2:1-58      [002] .......   640.825418: rtcpu_vinotify_event: tstamp:20887766763 cch:0 vi:1 tag:VIFALC_ACTIONLST channel:0x23 frame:0 vi_tstamp:668408174592 data:0x0000000001020001
     kworker/2:1-58      [002] .......   640.825418: rtcpu_vinotify_event: tstamp:20887766918 cch:0 vi:1 tag:CHANSEL_SHORT_FRAME channel:0x04 frame:0 vi_tstamp:668408108384 data:0x0000200000000000
     kworker/2:1-58      [002] .......   640.825419: rtcpu_vinotify_event: tstamp:20887767055 cch:0 vi:1 tag:ATOMP_FE channel:0x00 frame:0 vi_tstamp:668408108448 data:0x0000000800000000
     kworker/2:1-58      [002] .......   640.825419: rtcpu_vinotify_event: tstamp:20887768475 cch:0 vi:1 tag:VIFALC_ACTIONLST channel:0x23 frame:0 vi_tstamp:668408322880 data:0x0000000007020002
     kworker/2:1-58      [002] .......   640.825419: rtcpu_vinotify_event: tstamp:20887768609 cch:0 vi:1 tag:FS channel:0x00 frame:0 vi_tstamp:668408161664 data:0x0000000000000012
     kworker/2:1-58      [002] .......   640.825420: rtcpu_vinotify_event: tstamp:20888284870 cch:0 vi:1 tag:ATOMP_FS channel:0x00 frame:0 vi_tstamp:668408161728 data:0x0000000800000000
     kworker/2:1-58      [002] .......   640.825420: rtcpu_vinotify_event: tstamp:20888285006 cch:0 vi:1 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:668408606464 data:0x799e300010000000
     kworker/2:1-58      [002] .......   640.825421: rtcpu_vinotify_event: tstamp:20888285162 cch:0 vi:1 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:668408649184 data:0x0000000031000003
     kworker/2:1-58      [002] .......   640.825421: rtcpu_vinotify_event: tstamp:20888285302 cch:0 vi:1 tag:CHANSEL_PXL_SOF channel:0x23 frame:0 vi_tstamp:668408722272 data:0x0000000000000001
     kworker/2:1-58      [002] .......   640.825422: rtcpu_vinotify_event: tstamp:20888285454 cch:0 vi:1 tag:VIFALC_ACTIONLST channel:0x23 frame:0 vi_tstamp:668408732064 data:0x0000000008020002
     kworker/2:1-58      [002] .......   640.825422: rtcpu_vinotify_event: tstamp:20888403348 cch:0 vi:1 tag:FE channel:0x00 frame:0 vi_tstamp:668428110080 data:0x0000000000000022
     kworker/2:1-58      [002] .......   640.825422: rtcpu_vinotify_event: tstamp:20888403501 cch:0 vi:1 tag:CHANSEL_SHORT_FRAME channel:0x04 frame:0 vi_tstamp:668428110112 data:0x02c0200001000000
     kworker/2:1-58      [002] .......   640.825423: rtcpu_vinotify_event: tstamp:20888403636 cch:0 vi:1 tag:VIFALC_ACTIONLST channel:0x23 frame:0 vi_tstamp:668428176320 data:0x0000000001020002
     kworker/2:1-58      [002] .......   640.825423: rtcpu_vinotify_event: tstamp:20888403799 cch:0 vi:1 tag:CHANSEL_SHORT_FRAME channel:0x04 frame:0 vi_tstamp:668428110112 data:0x0000200000000000
     kworker/2:1-58      [002] .......   640.825423: rtcpu_vinotify_event: tstamp:20888403935 cch:0 vi:1 tag:ATOMP_FE channel:0x00 frame:0 vi_tstamp:668428110208 data:0x0000000800000000
     kworker/2:1-58      [002] .......   640.825424: rtcpu_vinotify_event: tstamp:20888404090 cch:0 vi:1 tag:VIFALC_ACTIONLST channel:0x23 frame:0 vi_tstamp:668428324672 data:0x0000000007020003
     kworker/2:1-58      [002] .......   640.825424: rtcpu_vinotify_event: tstamp:20888404226 cch:0 vi:1 tag:FS channel:0x00 frame:0 vi_tstamp:668428163424 data:0x0000000000000012
     kworker/2:1-58      [002] .......   640.825425: rtcpu_vinotify_event: tstamp:20888404380 cch:0 vi:1 tag:ATOMP_FS channel:0x00 frame:0 vi_tstamp:668428163520 data:0x0000000800000000
     kworker/2:1-58      [002] .......   640.825425: rtcpu_vinotify_event: tstamp:20888404516 cch:0 vi:1 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:668428579136 data:0x799e2d0010000000
     kworker/2:1-58      [002] .......   640.825425: rtcpu_vinotify_event: tstamp:20888404669 cch:0 vi:1 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:668428621888 data:0x0000000031000004
     kworker/2:1-58      [002] .......   640.825426: rtcpu_vinotify_event: tstamp:20888404831 cch:0 vi:1 tag:CHANSEL_PXL_SOF channel:0x23 frame:0 vi_tstamp:668428724096 data:0x0000000000000001
     kworker/2:1-58      [002] .......   640.881416: rtcpu_vinotify_event: tstamp:20888935831 cch:0 vi:1 tag:VIFALC_ACTIONLST channel:0x23 frame:0 vi_tstamp:668428742176 data:0x0000000008020003
     kworker/2:1-58      [002] .......   640.881419: rtcpu_vinotify_event: tstamp:20889478725 cch:0 vi:1 tag:FE channel:0x00 frame:0 vi_tstamp:668448111872 data:0x0000000000000022
     kworker/2:1-58      [002] .......   640.881419: rtcpu_vinotify_event: tstamp:20889478882 cch:0 vi:1 tag:CHANSEL_SHORT_FRAME channel:0x04 frame:0 vi_tstamp:668448111904 data:0x02c0200001000000
     kworker/2:1-58      [002] .......   640.881420: rtcpu_vinotify_event: tstamp:20889479021 cch:0 vi:1 tag:VIFALC_ACTIONLST channel:0x23 frame:0 vi_tstamp:668448178144 data:0x0000000001020003
     kworker/2:1-58      [002] .......   640.881420: rtcpu_vinotify_event: tstamp:20889479175 cch:0 vi:1 tag:CHANSEL_SHORT_FRAME channel:0x04 frame:0 vi_tstamp:668448111904 data:0x0000200000000000
     kworker/2:1-58      [002] .......   640.881421: rtcpu_vinotify_event: tstamp:20889479310 cch:0 vi:1 tag:ATOMP_FE channel:0x00 frame:0 vi_tstamp:668448111968 data:0x0000000800000000
     kworker/2:1-58      [002] .......   640.881422: rtcpu_vinotify_event: tstamp:20889479462 cch:0 vi:1 tag:VIFALC_ACTIONLST channel:0x23 frame:0 vi_tstamp:668448326464 data:0x0000000007020004
     kworker/2:1-58      [002] .......   640.881422: rtcpu_vinotify_event: tstamp:20889479595 cch:0 vi:1 tag:FS channel:0x00 frame:0 vi_tstamp:668448165184 data:0x0000000000000012
     kworker/2:1-58      [002] .......   640.881422: rtcpu_vinotify_event: tstamp:20889479750 cch:0 vi:1 tag:ATOMP_FS channel:0x00 frame:0 vi_tstamp:668448165280 data:0x0000000800000000
     kworker/2:1-58      [002] .......   640.881423: rtcpu_vinotify_event: tstamp:20889479883 cch:0 vi:1 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:668448566400 data:0x799e300010000000
     kworker/2:1-58      [002] .......   640.881423: rtcpu_vinotify_event: tstamp:20889480035 cch:0 vi:1 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:668448609152 data:0x0000000031000005
     kworker/2:1-58      [002] .......   640.881424: rtcpu_vinotify_event: tstamp:20889480167 cch:0 vi:1 tag:CHANSEL_PXL_SOF channel:0x23 frame:0 vi_tstamp:668448725856 data:0x0000000000000001
     kworker/2:1-58      [002] .......   640.881424: rtcpu_vinotify_event: tstamp:20889480324 cch:0 vi:1 tag:VIFALC_ACTIONLST channel:0x23 frame:0 vi_tstamp:668448735616 data:0x0000000008020004
     kworker/2:1-58      [002] .......   640.881425: rtcpu_vinotify_event: tstamp:20889641356 cch:0 vi:1 tag:FE channel:0x00 frame:0 vi_tstamp:668468113600 data:0x0000000000000022
     kworker/2:1-58      [002] .......   640.881425: rtcpu_vinotify_event: tstamp:20889641513 cch:0 vi:1 tag:CHANSEL_SHORT_FRAME channel:0x04 frame:0 vi_tstamp:668468113632 data:0x02c0200001000000
     kworker/2:1-58      [002] .......   640.881426: rtcpu_vinotify_event: tstamp:20889641648 cch:0 vi:1 tag:VIFALC_ACTIONLST channel:0x23 frame:0 vi_tstamp:668468179872 data:0x0000000001020004
     kworker/2:1-58      [002] .......   640.881426: rtcpu_vinotify_event: tstamp:20890129575 cch:0 vi:1 tag:CHANSEL_SHORT_FRAME channel:0x04 frame:0 vi_tstamp:668468113632 data:0x0000200000000000
     kworker/2:1-58      [002] .......   640.881426: rtcpu_vinotify_event: tstamp:20890129716 cch:0 vi:1 tag:ATOMP_FE channel:0x00 frame:0 vi_tstamp:668468113728 data:0x0000000800000000
     kworker/2:1-58      [002] .......   640.881427: rtcpu_vinotify_event: tstamp:20890129870 cch:0 vi:1 tag:VIFALC_ACTIONLST channel:0x23 frame:0 vi_tstamp:668468338720 data:0x0000000007020005
     kworker/2:1-58      [002] .......   640.881427: rtcpu_vinotify_event: tstamp:20890130005 cch:0 vi:1 tag:FS channel:0x00 frame:0 vi_tstamp:668468166976 data:0x0000000000000012
     kworker/2:1-58      [002] .......   640.881427: rtcpu_vinotify_event: tstamp:20890130162 cch:0 vi:1 tag:ATOMP_FS channel:0x00 frame:0 vi_tstamp:668468167040 data:0x0000000800000000
     kworker/2:1-58      [002] .......   640.881428: rtcpu_vinotify_event: tstamp:20890130298 cch:0 vi:1 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:668468620768 data:0x799e2d0010000000
     kworker/2:1-58      [002] .......   640.881428: rtcpu_vinotify_event: tstamp:20890130451 cch:0 vi:1 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:668468663488 data:0x0000000031000006
     kworker/2:1-58      [002] .......   640.881428: rtcpu_vinotify_event: tstamp:20890130586 cch:0 vi:1 tag:CHANSEL_PXL_SOF channel:0x23 frame:0 vi_tstamp:668468727584 data:0x0000000000000001
     kworker/2:1-58      [002] .......   640.881428: rtcpu_vinotify_event: tstamp:20890130740 cch:0 vi:1 tag:VIFALC_ACTIONLST channel:0x23 frame:0 vi_tstamp:668468737376 data:0x0000000008020005
     kworker/2:1-58      [002] .......   640.881429: rtcpu_vinotify_event: tstamp:20890266722 cch:0 vi:1 tag:FE channel:0x00 frame:0 vi_tstamp:668488115424 data:0x0000000000000022
     kworker/2:1-58      [002] .......   640.881429: rtcpu_vinotify_event: tstamp:20890266876 cch:0 vi:1 tag:CHANSEL_SHORT_FRAME channel:0x04 frame:0 vi_tstamp:668488115424 data:0x02c0200001000000
     kworker/2:1-58      [002] .......   640.881429: rtcpu_vinotify_event: tstamp:20890267014 cch:0 vi:1 tag:VIFALC_ACTIONLST channel:0x23 frame:0 vi_tstamp:668488181632 data:0x0000000001020005
     kworker/2:1-58      [002] .......   640.881429: rtcpu_vinotify_event: tstamp:20890267169 cch:0 vi:1 tag:CHANSEL_SHORT_FRAME channel:0x04 frame:0 vi_tstamp:668488115424 data:0x0000200000000000
     kworker/2:1-58      [002] .......   640.881429: rtcpu_vinotify_event: tstamp:20890267307 cch:0 vi:1 tag:ATOMP_FE channel:0x00 frame:0 vi_tstamp:668488115520 data:0x0000000800000000
     kworker/2:1-58      [002] .......   640.881430: rtcpu_vinotify_event: tstamp:20890267461 cch:0 vi:1 tag:VIFALC_ACTIONLST channel:0x23 frame:0 vi_tstamp:668488329920 data:0x0000000007020006
     kworker/2:1-58      [002] .......   640.881430: rtcpu_vinotify_event: tstamp:20890267597 cch:0 vi:1 tag:FS channel:0x00 frame:0 vi_tstamp:668488168704 data:0x0000000000000012

Can you help us clarify the issues?

Thanks,
Ben

hello ben.r,

it shows discarding frame messages, which mean capture buffers has dropped due to unsuccessful capture state.
there’s CHANSEL_SHORT_FRAME failure according to the VI tracing logs, it usually due to a frame (number of lines) sending to VI is less than expectation.

do you still working with device tree settings as mentioned by 1st comment?
for instance,
(1) you may double check the active_h settings, you may also reduce the settings for quick testing.
(2) is your bridge driver sending embedded metadata? otherwise, please configure it as 0 for further testing.