JetPack 5.10.104 vi_capture_control_message: NULL VI channel received

Hi all,

Problem:
We are working on integrating imx412 into our custom Jetson Xavier NX. After adjusting the DT and implementing the driver, this is the dmesg log output when trying to acquire data from sensor using v4l-ctl command :

[  194.838683] vc_mipi 9-001a: vc_sen_set_exposure(): Set sensor exposure: 40 us
[  194.868862] vc_mipi 9-001a: vc_core_set_format(): Set format 0x300f (RG10)
[  194.869075] vc_mipi 9-001a: vc_core_try_format(): Try format 0x300f (RG10, format: 0x2b)
[  194.869111] vc_mipi 9-001a: vc_update_image_size_from_mode(): Update image size from mode0 (l: 0, t: 0, w: 4032, h: 3040)
[  194.869378] i2c 9-0010: vc_mod_set_mode(): Set module mode: 0 (lanes: 2, format: RG10, type: STREAM)
[  194.869649] i2c 9-0010: vc_mod_set_power(): Set module power: down
[  194.870709] i2c 9-0010: vc_mod_set_power(): Set module power: up
[  195.472512] vc_mipi 9-001a: vc_sen_set_roi(): Set sensor roi: (left: 0, top: 0, width: 4032, height: 3040)
[  195.479093] vc_mipi 9-001a: vc_sen_set_exposure(): Set sensor exposure: 40 us
[  195.481246] vc_mipi 9-001a: vc_sen_set_gain(): Set sensor gain: 0
[  195.482493] vc_mipi 9-001a: vc_core_get_num_lanes(): Get number of lanes: 2
[  195.482507] vc_mipi 9-001a: vc_sen_set_blacklevel(): Set sensor black level: 3906 (40/1023)
[  195.483669] vc_mipi 9-001a: vc_sen_start_stream(): Start streaming
[  199.905651] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 5000 ms
[  199.905974] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[  199.907231] (NULL device *): vi_capture_control_message: NULL VI channel received
[  199.907450] t194-nvcsi 13e10000.host1x:nvcsi@15a00000: csi5_stream_close: Error in closing stream_id=0, csi_port=0
[  199.907672] (NULL device *): vi_capture_control_message: NULL VI channel received
[  199.907855] t194-nvcsi 13e10000.host1x:nvcsi@15a00000: csi5_stream_open: VI channel not found for stream- 0 vc- 0
[  199.908941] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: successfully reset the capture channel
[  204.929580] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 5000 ms
[  204.929844] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[  204.931234] (NULL device *): vi_capture_control_message: NULL VI channel received
[  204.931448] t194-nvcsi 13e10000.host1x:nvcsi@15a00000: csi5_stream_close: Error in closing stream_id=0, csi_port=0
[  204.931679] (NULL device *): vi_capture_control_message: NULL VI channel received
[  204.931851] t194-nvcsi 13e10000.host1x:nvcsi@15a00000: csi5_stream_open: VI channel not found for stream- 0 vc- 0
[  204.932558] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: successfully reset the capture channel

This is the dtbo file we are using:

/dts-v1/;
/plugin/;

/ {

    fragment@0 {
        target-path = "/tegra-capture-vi";
        __overlay__ {
		num-channels = <0x1>;
		ports {
                        #address-cells = <1>;
                        #size-cells = <0>;
			vc_vi_port1: port@0 {
                        	reg = <0>;
                                vc_vi_in0: endpoint {
                                        port-index = <0>;
                                        bus-width = <2>;
                                        remote-endpoint = <&vc_csi_out0>;
                                	};
                        	};
			}; 
		};
	};	   
    fragment@1 {
        target-path = "/host1x@13e00000/nvcsi@15a00000";
        __overlay__ {
		num-channels = <0x1>;
		#address-cells = <1>;
                #size-cells = <0>;
                vc_csi_chan0: channel@0 {
                	reg = <0>;
                        ports {
                        	#address-cells = <1>;
                                #size-cells = <0>;
                                vc_csi_chan0_port0: port@0 {
                                	reg = <0>;
                                       	vc_csi_in0: endpoint@0 {
	                                	port-index = <0>;
                                                bus-width = <2>;
                                                remote-endpoint = <&vc_mipi_out0>;
                                                };
                                        };
                                vc_csi_chan0_port1: port@1 {
					reg = <1>;
                                        vc_csi_out0: endpoint@1 {
                                        	remote-endpoint = <&vc_vi_in0>;
                                                };
                                        };
                                };
                        };
		};
	};


    fragment@2 {
        target-path = "/cam_i2cmux/i2c@0";
        __overlay__ {
			#address-cells = <1>;
                	#size-cells=<0>;
			vc_mipi_cam0: vc_mipi@1a {
                                reg = <0x1a>;
                                compatible              = "nvidia,vc_mipi";
                                devnode                 = "video0";
                                use_sensor_mode_id      = "false";
                                sensor_model            = "vc_mipi";

                                num_lanes               = "2";
                                trigger_mode            = "0";
                                io_mode                 = "0";

				/* nvarguscamerasrc params  */
				physical_w              = "6.250";
                                physical_h              = "4.712";

				mode0 {
                                        num_lanes                = "2";
                                        tegra_sinterface         = "serial_a";
                                        embedded_metadata_height = "2";
                                        readout_orientation      = "0";

					/* nvarguscamerasrc params  */
					active_l                 = "0";
                                        active_t                 = "0";
                                        active_w                 = "4032";
                                        active_h                 = "3040";

					mode_type                = "bayer";
                                        pixel_phase              = "rggb";
                                        csi_pixel_bit_depth      = "10";

                                        min_gain_val             = "0";         // mdB
                                        max_gain_val             = "51000";     // mdB
                                        step_gain_val            = "50";	// mdB
                                        default_gain             = "0";         // mdB

                                        min_exp_time             = "1";         // us
                                        max_exp_time             = "1000000";   // us
                                        step_exp_time            = "1";         // us
                                        default_exp_time         = "10000";     // us

                                        min_framerate            = "1000";      // mHz
                                        max_framerate            = "20000";     // mHz
                                        step_framerate           = "100";       // mHz
                                        default_framerate        = "20000";     // mHz

                                        gain_factor              = "1000";
                                        exposure_factor          = "1000000";
                                        framerate_factor         = "1000";
                                        inherent_gain            = "1";
                                        min_hdr_ratio            = "1";
                                        max_hdr_ratio            = "1";

                                        line_length              = "0";
                                        phy_mode                 = "DPHY";
                                        discontinuous_clk        = "no";
                                        mclk_khz                 = "24000";

					pix_clk_hz               = "74250000";

					/*set_mode_delay = "100";*/
					
                                        mclk_multiplier          = "9.33";
                                        cil_settletime           = "0";
                                        dpcm_enable              = "false";
				};

                                ports {
                                        #address-cells = <1>;
                                        #size-cells = <0>;
                                        port@0 {
                                                reg = <0>;
                                                vc_mipi_out0: endpoint {
                                                        port-index = <0>;
                                                        bus-width = <2>;
                                                        remote-endpoint = <&vc_csi_in0>;
							};
							};
					};
				};

			};
		};

    fragment@3 {
        target-path = "/";
        __overlay__ {
		lens@vc_mipi {
                	min_focus_distance  = "0.0";
                	hyper_focal         = "0.0";
                	focal_length        = "6.0";
                	f_number            = "2.0";
                	aperture            = "0.0";
			};
		};
	};

    fragment@4 {
        target-path = "/tegra-camera-platform";
        __overlay__ {

                compatible = "nvidia, tegra-camera-platform";

                num_csi_lanes = <4>;
                max_lane_speed = <1500000>;
                min_bits_per_pixel = <10>;
                vi_peak_byte_per_pixel = <2>;
                vi_bw_margin_pct = <25>;
                max_pixel_rate = <240000>;
                isp_peak_byte_per_pixel = <5>;
                isp_bw_margin_pct = <25>;
		
		modules {
                        cam_module0: module0 {
                        status = "okay";
                        badge = "jakku_front_vc_mipi";
                        position = "front";
                        orientation = "1";

                        cam_module0_drivernode0: drivernode0 {
	                        status = "okay";
                                pcl_id = "v4l2_sensor";
				devname = "vc_mipi 9-001a";
                                proc-device-tree = "/proc/device-tree/cam_i2cmux/i2c@0/vc_mipi@1a";
				};
                                
			cam_module0_drivernode1: drivernode1 {
                                status = "okay";
                                pcl_id = "v4l2_lens";
                                proc-device-tree = "/proc/device-tree/lens@vc_mipi/";
                        	        };
				};
			};
		};
	};

    fragment@5 {
       target-path = "/cam_i2cmux";
       __overlay__ { 
                status = "okay";
                compatible = "i2c-mux-gpio";
                #address-cells = <1>;
                #size-cells = <0>;
                //mux-gpios = <&tegra_aon_gpio 19 1>; //<&tegra_aon_gpio CAM_I2C_MUX GPIO_ACTIVE_HIGH>
                mux-gpios = <&tca6416 12 1 &tca6416 13 1 &tca6416 2 1 &tca6416 3 1 &tca6416 14 1 &tca6416 15 1>;
		i2c-parent = <&cam_i2c>;

                i2c@0 {
	                status = "okay";
                        reg = <1>;
                        #address-cells = <1>;
                        #size-cells = <0>;
			vc_mipi@1a {
                                status = "okay";
                                reset-gpios = <&tegra_main_gpio 125 1>; // <&tegra_main_gpio CAM1_PWDN GPIO_ACTIVE_HIGH> 
				};
			};
		};
	};

    fragment@6 {
       target-path = "/gpio@2200000";
       __overlay__ {
                camera-control-output-low {
                        gpio-hog;
                        output-low;
                        gpios = <124 0 125 0>; // <CAM0_PWDN 0 CAM1_PWDN 0>
                        label = "cam0-pwdn","cam1-pwdn";
                	};
        	};
	};                   
};

Debugging:

Port binding:

Media device information
------------------------
driver          tegra-camrtc-ca
model           NVIDIA Tegra Video Input Device
serial          
bus info        
hw revision     0x3
driver version  5.10.104

Device topology
- entity 1: 13e10000.host1x:nvcsi@15a00000- (2 pads, 2 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev0
	pad0: Sink
		<- "vc_mipi 9-001a":0 [ENABLED]
	pad1: Source
		-> "vi-output, vc_mipi 9-001a":0 [ENABLED]

- entity 4: vc_mipi 9-001a (1 pad, 1 link)
            type V4L2 subdev subtype Sensor flags 0
            device node name /dev/v4l-subdev1
	pad0: Source
		[fmt:SRGGB10_1X10/4032x3040 field:none colorspace:srgb]
		-> "13e10000.host1x:nvcsi@15a00000-":0 [ENABLED]

- entity 6: vi-output, vc_mipi 9-001a (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video0
	pad0: Sink
		<- "13e10000.host1x:nvcsi@15a00000-":1 [ENABLED]

v4l2-compliance

Compliance test for tegra-video device /dev/video0:

Driver Info:
	Driver name      : tegra-video
	Card type        : vi-output, vc_mipi 9-001a
	Bus info         : platform:tegra-capture-vi:0
	Driver version   : 5.10.104
	Capabilities     : 0x84200001
		Video Capture
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps      : 0x04200001
		Video Capture
		Streaming
		Extended Pix Format
Media Driver Info:
	Driver name      : tegra-camrtc-ca
	Model            : NVIDIA Tegra Video Input Device
	Serial           : 
	Bus info         : 
	Media version    : 5.10.104
	Hardware revision: 0x00000003 (3)
	Driver version   : 5.10.104
Interface Info:
	ID               : 0x03000008
	Type             : V4L Video
Entity Info:
	ID               : 0x00000006 (6)
	Name             : vi-output, vc_mipi 9-001a
	Function         : V4L2 I/O
	Pad 0x01000007   : 0: Sink
	  Link 0x0200000c: from remote pad 0x1000003 of entity '13e10000.host1x:nvcsi@15a00000-': Data, Enabled

Required ioctls:
	test MC information (see 'Media Driver Info' above): OK
	test VIDIOC_QUERYCAP: OK

Allow for multiple opens:
	test second /dev/video0 open: OK
	test VIDIOC_QUERYCAP: OK
	test VIDIOC_G/S_PRIORITY: OK
	test for unlimited opens: OK

Debug ioctls:
	test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
	test VIDIOC_LOG_STATUS: OK

Input ioctls:
	test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
	test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
	test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
	test VIDIOC_ENUMAUDIO: OK (Not Supported)
	test VIDIOC_G/S/ENUMINPUT: OK
	test VIDIOC_G/S_AUDIO: OK (Not Supported)
	Inputs: 1 Audio Inputs: 0 Tuners: 0

Output ioctls:
	test VIDIOC_G/S_MODULATOR: OK (Not Supported)
	test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
	test VIDIOC_ENUMAUDOUT: OK (Not Supported)
	test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
	test VIDIOC_G/S_AUDOUT: OK (Not Supported)
	Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
	test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
	test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
	test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
	test VIDIOC_G/S_EDID: OK (Not Supported)

Control ioctls (Input 0):
		fail: v4l2-test-controls.cpp(108): non-zero min/max/step/def
		fail: v4l2-test-controls.cpp(208): invalid control 009a2011
	test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: FAIL
		fail: v4l2-test-controls.cpp(318): node->controls.find(qctrl.id) == node->controls.end()
	test VIDIOC_QUERYCTRL: FAIL
		fail: v4l2-test-controls.cpp(468): invalid maximum range check
	test VIDIOC_G/S_CTRL: FAIL
	test VIDIOC_G/S/TRY_EXT_CTRLS: OK
	test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
	test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
	Standard Controls: 1 Private Controls: 8

Format ioctls (Input 0):
		fail: v4l2-test-formats.cpp(91): invalid frameinterval 0 (1/0)
	test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: FAIL
	test VIDIOC_G/S_PARM: OK (Not Supported)
	test VIDIOC_G_FBUF: OK (Not Supported)
		fail: v4l2-test-formats.cpp(443): pixelformat 30314752 (RG10) for buftype 1 not reported by ENUM_FMT
	test VIDIOC_G_FMT: FAIL
		fail: v4l2-test-formats.cpp(443): pixelformat 30314752 (RG10) for buftype 1 not reported by ENUM_FMT
	test VIDIOC_TRY_FMT: FAIL
		fail: v4l2-test-formats.cpp(443): pixelformat 30314752 (RG10) for buftype 1 not reported by ENUM_FMT
	test VIDIOC_S_FMT: FAIL
	test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
		fail: v4l2-test-formats.cpp(1423): doioctl(node, VIDIOC_G_SELECTION, &sel) != EINVAL
	test Cropping: FAIL
	test Composing: OK (Not Supported)
	test Scaling: OK

Codec ioctls (Input 0):
	test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
	test VIDIOC_G_ENC_INDEX: OK (Not Supported)
	test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

Buffer ioctls (Input 0):
		fail: v4l2-test-buffers.cpp(715): q.create_bufs(node, 1, &fmt) != EINVAL
	test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL
	test VIDIOC_EXPBUF: OK
	test Requests: OK (Not Supported)

Total for tegra-video device /dev/video0: 45, Succeeded: 36, Failed: 9, Warnings: 0

v4l2-ctl -d /dev/video0 --list-formats-ext

ioctl: VIDIOC_ENUM_FMT
	Type: Video Capture

	[0]: 'RG10' (10-bit Bayer RGRG/GBGB)
		Size: Discrete 4032x3040
			Interval: Discrete infs (0.000 fps)

Framerate is set correctly in the device tree for 20000 mHz but the driver is not able to parse it.


Boosting clock

root@edgekit-new:/home/edgekit/Desktop/imx412# sudo su
root@edgekit-new:/home/edgekit/Desktop/imx412# echo 1 > /sys/kernel/debug/bpmp/debug/clk/vi/mrq_rate_locked
root@edgekit-new:/home/edgekit/Desktop/imx412# echo 1 > /sys/kernel/debug/bpmp/debug/clk/isp/mrq_rate_locked
root@edgekit-new:/home/edgekit/Desktop/imx412# echo 1 > /sys/kernel/debug/bpmp/debug/clk/nvcsi/mrq_rate_locked
root@edgekit-new:/home/edgekit/Desktop/imx412# cat /sys/kernel/debug/bpmp/debug/clk/vi/max_rate |tee /sys/kernel/debug/bpmp/debug/clk/vi/rate
460800000
root@edgekit-new:/home/edgekit/Desktop/imx412# cat /sys/kernel/debug/bpmp/debug/clk/isp/max_rate | tee  /sys/kernel/debug/bpmp/debug/clk/isp/rate
576000000
root@edgekit-new:/home/edgekit/Desktop/imx412# cat /sys/kernel/debug/bpmp/debug/clk/nvcsi/max_rate | tee /sys/kernel/debug/bpmp/debug/clk/nvcsi/rate
314000000


Tracing

 tracer: nop
#
# entries-in-buffer/entries-written: 26/26   #P:4
#
#                                _-----=> irqs-off
#                               / _----=> need-resched
#                              | / _---=> hardirq/softirq
#                              || / _--=> preempt-depth
#                              ||| /     delay
#           TASK-PID     CPU#  ||||   TIMESTAMP  FUNCTION
#              | |         |   ||||      |         |
     kworker/2:2-87      [002] ....  1672.933109: rtcpu_string: tstamp:53019154843 id:0x04010000 str:"VM0 deactivating."
       v4l2-test-2465    [000] ....  1854.865869: tegra_channel_open: vi-output, vc_mipi 9-001a
       v4l2-test-2465    [000] ....  1854.882870: tegra_channel_set_power: vc_mipi 9-001a : 0x1
       v4l2-test-2465    [000] ....  1854.882886: camera_common_s_power: status : 0x1
       v4l2-test-2465    [000] ....  1854.882895: tegra_channel_set_power: 13e10000.host1x:nvcsi@15a00000- : 0x1
       v4l2-test-2465    [000] ....  1854.882898: csi_s_power: enable : 0x1
       v4l2-test-2465    [000] ....  1854.883536: tegra_channel_capture_setup: vnc_id 0 W 4032 H 3040 fmt c4
       v4l2-test-2465    [001] ....  1854.890414: tegra_channel_set_stream: enable : 0x1
       v4l2-test-2465    [001] ....  1854.891806: tegra_channel_set_stream: 13e10000.host1x:nvcsi@15a00000- : 0x1
       v4l2-test-2465    [001] ....  1854.891809: csi_s_stream: enable : 0x1
       v4l2-test-2465    [000] ....  1854.892210: tegra_channel_set_stream: vc_mipi 9-001a : 0x1
     kworker/2:2-87      [002] ....  1854.941037: rtcpu_string: tstamp:58705277247 id:0x04010000 str:"VM0 activating."
     kworker/2:2-87      [002] ....  1854.941041: rtcpu_vinotify_event: tstamp:58705725163 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:1878572838912 data:0xcd9ce50010000000
     kworker/2:2-87      [002] ....  1854.941042: rtcpu_vinotify_event: tstamp:58705725321 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:1878572850656 data:0x0000000031000001
     kworker/2:2-87      [002] ....  1854.941043: rtcpu_vinotify_event: tstamp:58705725498 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:1878572905792 data:0xcd9ce20010000000
     kworker/2:2-87      [002] ....  1854.941043: rtcpu_vinotify_event: tstamp:58705725649 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:1878572917760 data:0x0000000031000002
 vi-output, vc_m-2467    [001] ....  1860.067090: tegra_channel_capture_setup: vnc_id 0 W 4032 H 3040 fmt c4
     kworker/2:2-87      [002] ....  1860.093089: rtcpu_vinotify_event: tstamp:58867469870 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:1883750224928 data:0xcd9ce50010000000
     kworker/2:2-87      [002] ....  1860.093093: rtcpu_vinotify_event: tstamp:58867470027 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:1883750236704 data:0x0000000031000001
     kworker/2:2-87      [002] ....  1860.093094: rtcpu_vinotify_event: tstamp:58867470202 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:1883750471680 data:0xcd9ce20010000000
     kworker/2:2-87      [002] ....  1860.093095: rtcpu_vinotify_event: tstamp:58867470352 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:1883750483648 data:0x0000000031000002
 vi-output, vc_m-2467    [000] ....  1865.187499: tegra_channel_capture_setup: vnc_id 0 W 4032 H 3040 fmt c4
     kworker/2:2-87      [002] ....  1865.249068: rtcpu_vinotify_event: tstamp:59027519219 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:1888870322432 data:0xcd9ce50010000000
     kworker/2:2-87      [002] ....  1865.249071: rtcpu_vinotify_event: tstamp:59027519376 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:1888870334208 data:0x0000000031000001
     kworker/2:2-87      [002] ....  1865.249073: rtcpu_vinotify_event: tstamp:59027519551 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:1888870390016 data:0xcd9ce20010000000
     kworker/2:2-87      [002] ....  1865.249074: rtcpu_vinotify_event: tstamp:59027519704 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:1888870401984 data:0x0000000031000002

Does this have to do with pix_clk_frequency or mclk_khz params ?

Appreciate your help!
Ahmed

Looks like NVCSI/VI didn’t receive any validate data from the sensor.
Maybe probe the signal and confirm the sensor initial sequency like power sequency and timing.

Thanks

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