Jetson Xavier yuv422 camera driver [one camera] no reply from camera processor

Hi,
I want to develop one yuv422 camera driver for jetson agx xavier board.

Sensor[AR0233+ISP(GW5200)] + Max9295A => Max9296A => CSI-A

And now i can access the /dev/video0, and format looks ok, but when i use v4l2-ctl to capture image , command is v4l2-ctl -d /dev/video0 --verbose --set-fmt-video=width=1920,height=1080,pixelformat=UYVY --stream-mmap --stream-count=1 --set-ctrl=bypass_mode=0 --stream-to=ar0233.raw, it failed.

dev@dev-desktop:~/work$ v4l2-ctl -d /dev/video0 --list-formats
ioctl: VIDIOC_ENUM_FMT
        Index       : 0
        Type        : Video Capture
        Pixel Format: 'UYVY'
        Name        : UYVY 4:2:2

        Index       : 1
        Type        : Video Capture
        Pixel Format: 'NV16'
        Name        : Y/CbCr 4:2:2

        Index       : 2
        Type        : Video Capture
        Pixel Format: 'UYVY'
        Name        : UYVY 4:2:2

Media controller API version 0.1.0

Media device information
------------------------
driver          tegra194-vi5
model           NVIDIA Tegra Video Input Device
serial          
bus info        
hw revision     0x3
driver version  0.0.0

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

- entity 4: ar0233 30-001b (1 pad, 1 link)
            type V4L2 subdev subtype Sensor flags 0
            device node name /dev/v4l-subdev1
        pad0: Source
                [fmt:UYVY8_1X16/1920x1080 field:none colorspace:srgb]
                -> "15a00000.nvcsi--2":0 [ENABLED]

- entity 6: vi-output, ar0233 30-001b (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video0
        pad0: Sink
                <- "15a00000.nvcsi--2":1 [ENABLED]

I enable the trace with command

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

error log:

[ 63.547113] max9296 30-0048: max9296_write_reg:i2c write ok, reg addr 0x50 = 0
[ 63.547252] max9296 30-0048: max9296_read_reg reg addr 0x50, val = 0x0
[ 82.263970] ---- jefby 1 v4l2sd_set_fmt format->code 8207
[ 82.263977] ---- jefby 2 v4l2sd_set_fmt format->code 8207
[ 82.263989] ---- jefby 1 v4l2sd_set_fmt format->code 8207
[ 82.263993] ---- jefby 3 v4l2sd_set_fmt format->code 8207
[ 82.264004] ar0233 30-001b: – jefby camera_common_s_fmt(8207) size 1920 x 1080
[ 82.264013] ar0233 30-001b: — jefby camera_common_s_fmt mf->code 0x200f
[ 82.307485] misc tegra_camera_ctrl: tegra_camera_update_isobw: Warning, Requested ISO BW 1627604 has been capped to VI’s max BW 1250000
[ 82.311354] [RCE] Configuring VI GoS.
[ 82.311381] [RCE] VM GOS[#0] addr=0xc2100000
[ 82.311399] [RCE] VM GOS[#1] addr=0xc2101000
[ 82.311416] [RCE] VM GOS[#2] addr=0xc2102000
[ 82.311430] [RCE] VM GOS[#3] addr=0xc2103000
[ 82.311445] [RCE] VM GOS[#4] addr=0xc2104000
[ 82.311459] [RCE] VM GOS[#5] addr=0xc2105000
[ 82.311523] [RCE] vi5_hwinit: firmware CL2018101701 protocol version 2.2
[ 82.311540] [RCE] VI GOS[#0] set to VM GOS[4] base 0xc2104000
[ 82.313235] max9296 30-0048: max9296_write_reg:i2c write ok, reg addr 0x50 = 2
[ 82.313368] max9296 30-0048: max9296_read_reg reg addr 0x50, val = 0x2
[ 84.822216] tegra194-vi5 15c10000.vi: no reply from camera processor
[ 84.822381] tegra194-vi5 15c10000.vi: uncorr_err: request timed out after 2500 ms
[ 84.822531] tegra194-vi5 15c10000.vi: err_rec: attempting to reset the capture channel
[ 84.825764] tegra194-vi5 15c10000.vi: err_rec: successfully reset the capture channel
[ 84.830278] [RCE] Configuring VI GoS.
[ 84.830291] [RCE] VM GOS[#0] addr=0xc2100000
[ 84.830300] [RCE] VM GOS[#1] addr=0xc2101000

How to solve it ? Thanks very much.
[ 84.830309] [RCE] VM GOS[#2] addr=0xc2102000
[ 84.830316] [RCE] VM GOS[#3] addr=0xc2103000
[ 84.830324] [RCE] VM GOS[#4] addr=0xc2104000
[ 84.830348] [RCE] VM GOS[#5] addr=0xc2105000
[ 87.382066] tegra194-vi5 15c10000.vi: no reply from camera processor
[ 87.382236] tegra194-vi5 15c10000.vi: uncorr_err: request timed out after 2500 ms

Have reference to below link to analysis the trace log.

https://elinux.org/Jetson/l4t/Camera_BringUp

Hi

what’s the meaning of RESERVED_18 ?

     kworker/0:2-12622 [000] .... 12097.264335: rtos_queue_send_from_isr_failed: tstamp:378354363686 queue:0x0bcbc160
     kworker/0:2-12622 [000] .... 12097.264336: rtcpu_vinotify_event: tstamp:378354365571 tag:RESERVED_18 channel:0x23 frame:0 vi_tstamp:377775477312 data:0x10000000
     kworker/0:2-12622 [000] .... 12097.264337: rtcpu_vinotify_event: tstamp:378354365746 tag:RESERVED_18 channel:0x23 frame:0 vi_tstamp:377775481280 data:0x31000001
     kworker/0:2-12622 [000] .... 12097.264338: rtcpu_vinotify_event: tstamp:378354365892 tag:RESERVED_19 channel:0x23 frame:0 vi_tstamp:377775482272 data:0x07020001
     kworker/0:2-12622 [000] .... 12097.264339: rtcpu_vinotify_event: tstamp:378354366016 tag:RESERVED_18 channel:0x23 frame:0 vi_tstamp:377775557440 data:0x10000000
     kworker/0:2-12622 [000] .... 12097.264340: rtcpu_vinotify_event: tstamp:378354366156 tag:RESERVED_18 channel:0x23 frame:0 vi_tstamp:377775564480 data:0x31000002

If didn’t saw any FS/FE or some tag from the wiki only these message that tell the NVCSI/VI didn’t receive any validate data from MIPI bus.

@ShaneCCC

Hi, I changed the max9296/max9295 register config, and now i can find the FS/FE tag in trace log Now.
full log is :
trace (234.3 KB)

I found some err like below:

     kworker/0:3-2153  [000] ....    87.186095: rtcpu_vinotify_event: tstamp:3039368625 tag:CHANSEL_FAULT channel:0x23 frame:0 vi_tstamp:3039367139 data:0x04380040

it means VI receiveds more lines than expected. 0x438=1080 but I don’t know how to fix it.

Do you know how to fix it ? Thanks.

My camera dtsi is

i2c@3180000 {
		tca9546@70 {
			i2c@0 {
			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. mclk_khz*/
					mclk_khz = "24000";
					num_lanes = "4";
					tegra_sinterface = "serial_a";
					vc_id = "0";
					discontinuous_clk = "no";
					dpcm_enable = "false";
					cil_settletime = "0";
					//dynamic_pixel_bit_depth = "8";//这块存疑,jefby
					csi_pixel_bit_depth = "8";//这块存疑,jefby
					mode_type = "yuv";
					pixel_phase = "uyvy";

					active_w = "1920";
					active_h = "1080";
					readout_orientation = "0";
					line_length = "2200";
					inherent_gain = "1";
					pix_clk_hz = "74250000";
					serdes_pix_clk_hz = "833333333";//这块暂时使用IMX390的原始值

					gain_factor = "10";
					min_gain_val = "0"; /* dB */
					max_gain_val = "300"; /* dB */
					step_gain_val = "3"; /* 0.3 */
					default_gain = "0";
					min_hdr_ratio = "1";
					max_hdr_ratio = "1";
					framerate_factor = "1000000";
					min_framerate = "30000000";
					max_framerate = "30000000";
					step_framerate = "1";
					default_framerate = "30000000";
					exposure_factor = "1000000";
					min_exp_time = "59"; /*us, 2 lines*/
					max_exp_time = "33333";
					step_exp_time = "1";
					default_exp_time = "33333";/* us */
					embedded_metadata_height = "0";
				};
				ports {
					#address-cells = <1>;
					#size-cells = <0>;
					port@0 {
						reg = <0>;
						ar0233_ar0233_out0: endpoint {
							vc-id = <0>;
							port-index = <0>;
							bus-width = <4>;
							remote-endpoint = <&ar0233_csi_in0>;
							};
						};
					};
				gmsl-link {
					src-csi-port = "b";// Port at which sensor is conntected to its serializer device
					dst-csi-port = "a";//Destination CSI port on the Jetson side, connected at deserializer.
					serdes-csi-link = "a"; // GMSL link sensor/serializer connected
					csi-mode = "1x4";// to sensor CSI mode
					st-vc = <0>;// sensor source default VC ID: 0 unless overridden by sensor
					vc-id = <0>;// Destination  VC ID, assigned  to sensor stream by deserializer
					num-lanes = <4>; // Number of CSI lanes used
					streams = "uyvy"; // Types of streams sensor is streaming, 这里我们使用自定义的类型yuv422,max9295里面对应0x1E
					//这里原始的是"ued-u1", "raw",删除掉ued-u1试试
					};
				};
			};
		};
	};
};

Increase active_h in dts to try.

Thanks.

Hi , I add active_h from 1080 to 1088 in dts, but it failed yet.
and I print active_h in kernel it’s 1088, but tracing log is 0x0438=1080

  kworker/0:2-1645  [000] ....    33.701787: rtcpu_vinotify_event: tstamp:1366345388 tag:CHANSEL_FAULT channel:0x23 frame:0 vi_tstamp:1366323738 data:0x04380040

[ 22.598216] ar0233 30-001b: – jefby sensor_common_parse_image_props:active_h property 1088

0x0438 means 1081 the first line is 0, what the error for 1088?
What the v4l2-ctl --list-formats-ext after modify to 1088

root@dev-desktop:/home/dev/work# v4l2-ctl --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
Index : 0
Type : Video Capture
Pixel Format: ‘UYVY’
Name : UYVY 4:2:2
Size: Discrete 1920x1080
Interval: Discrete 0.033s (30.000 fps)

Index       : 1
Type        : Video Capture
Pixel Format: 'NV16'
Name        : Y/CbCr 4:2:2
	Size: Discrete 1920x1080
		Interval: Discrete 0.033s (30.000 fps)

Index       : 2
Type        : Video Capture
Pixel Format: 'UYVY'
Name        : UYVY 4:2:2
	Size: Discrete 1920x1080
		Interval: Discrete 0.033s (30.000 fps)

Error like 1080
I upload the log trace (54.8 KB)

Looks like still 1920x1080 that tell the driver didn’t report as 1920x1088 so the error still the same.
You may need to modify the sensor kernel driver too.

Hi

I changed the ar0233.c
static const struct camera_common_frmfmt ar0233_frmfmt = {

{{1920, 1344}, ar0233_30fps, 1, 0, AR0233_MODE_1920X1080_CROP_30FPS},

};

change to 1344, now trace print no error, but dmesg shows

[  102.028603] tegra194-vi5 15c10000.vi: corr_err: discarding frame 0, flags: 6, err_data 131072
[  102.061943] tegra194-vi5 15c10000.vi: corr_err: discarding frame 0, flags: 0, err_data 131072
[  102.095259] tegra194-vi5 15c10000.vi: corr_err: discarding frame 0, flags: 0, err_data 131072
[  102.128607] tegra194-vi5 15c10000.vi: corr_err: discarding frame 0, flags: 0, err_data 131072
[  102.161920] tegra194-vi5 15c10000.vi: corr_err: discarding frame 0, flags: 0, err_data 131072

trace log
trace (712.1 KB)

My YUV sensor output is 1920x1080 UYVY(YUV422) - 8bit

Looks like the size report from sensor driver didn’t modify correctly.

tegra_channel_capture_setup: vnc_id 0 W 1920 H 1080 fmt 13

trace_1344 (1.3 MB)
Hi

I changed the driver and tegra_channel_capture_setup is v4l2-ctl-7835 [000] … 65.970202: tegra_channel_capture_setup: vnc_id 0 W 1920 H 1344 fmt 13

but it failed yet.
[ 75.818086] tegra194-vi5 15c10000.vi: vi_capture_request: sending chan_id 0 msg_id 1 buf:1
[ 75.851188] tegra194-vi5 15c10000.vi: vi_capture_ivc_status_callback: status chan_id 0 msg_id 2
[ 75.851199] tegra194-vi5 15c10000.vi: corr_err: discarding frame 0, flags: 0, err_data 131072
[ 75.851380] tegra194-vi5 15c10000.vi: vi_capture_status: waiting for status, timeout:2500 ms
[ 75.851409] tegra194-vi5 15c10000.vi: vi_capture_request: sending chan_id 0 msg_id 1 buf:2
[ 75.884478] tegra194-vi5 15c10000.vi: vi_capture_ivc_status_callback: status chan_id 0 msg_id 2
[ 75.884499] tegra194-vi5 15c10000.vi: corr_err: discarding frame 0, flags: 0, err_data 131072

full log is

I use 4 lane for one camera

@ShaneCCC

What’s the trace log for W 1920 H 1344 fmt 13

Hi, I upload the full trace log as trace_1344.

trace_1344 (1.3 MB)
@ShaneCCC

Thanks

Get short frame in this trace try the 1080 - 1344

CHANSEL_SHORT_FRAME

1 Like

ok

I have a similar situation, but I can use VLC to open the image is ok

but use the command
gst-launch-1.0 -vvv nvarguscamerasrc sensor-id=0!‘video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, framerate=30/1, format=(string )NV12’! Nvvidconv flip-method=0! Nvoverlaysink -e

There will be an error. Unable to open the image

Is there a correct command format?