Driver problems with plugging a black and white sensor into jetson nano

Hi, I’m currently plugging a black and white mipi camera into a jetson nano.
I added support for GRAY format in struct camera_common_colorfmt,

// Grayscale 8bit support
	// Grayscale 10bit support
	// Grayscale 12bit support

and extract_pixel_format functions

else if (strncmp(pixel_t, "raw_y88", size) == 0)
         *format = V4L2_PIX_FMT_GREY; //Grayscale
    else if (strncmp(pixel_t, "raw_y1010", size) == 0)
         *format = V4L2_PIX_FMT_Y10; //
    else if (strncmp(pixel_t, "raw_y1212", size) == 0)
         *format = V4L2_PIX_FMT_Y12; //

and struct tegra_video_format.

    TEGRA_VIDEO_FORMAT(RAW8, 8, Y8_1X8, 1, 1, T_L8,
				RAW8, GREY, "GREY8"),
    TEGRA_VIDEO_FORMAT(RAW10, 10, Y10_1X10, 2, 1, T_R16_I,
				RAW10, Y10, "GREY10"),
	TEGRA_VIDEO_FORMAT(RAW12, 12, Y12_1X12, 2, 1, T_R16_I,
				RAW10, Y12, "GRAY12"),

And I defined the corresponding patterns in dts.

active_w = "3088";
active_h = "2064";
mode_type = "raw";
csi_pixel_bit_depth = "8";
pixel_phase = "y8";
readout_orientation = "0";
line_length = "3088";
inherent_gain = "1";
mclk_multiplier = "2";
pix_clk_hz = "375000000";

Now using v4l2-ctl to get the image.

v4l2-ctl --set-fmt-video=width=3088,height=2064,pixelformat=GREY --set-ctrl bypass_mode=0 --stream-mmap --stream-count=10 --stream-to=y8-3136x2064.raw

I encountered the following error.

[ 4704.934920] video4linux video0: Syncpoint already enabled at capture done!0
[ 4705.136906] video4linux video0: tegra_channel_capture_done: MW_ACK_DONE syncpoint time out!0
[ 4705.146053] video4linux video0: TEGRA_VI_CSI_ERROR_STATUS 0x00000004
[ 4705.146081] vi TEGRA_CSI_PIXEL_PARSER_STATUS 0x00000080
[ 4705.146100] vi TEGRA_CSI_CIL_STATUS 0x00000000
[ 4705.146116] vi TEGRA_CSI_CILX_STATUS 0x00000000
[ 4705.146252] vi cil_settingtime was autocalculated
[ 4705.146274] vi csi clock settle time: 13, cil settle time: 10

I can actually get one correct frame, then get 3 black frames, then another correct frame, and so on.
The camera output is right as it works fine on the Raspberry Pi.
I checked the camera bring up material, but I didn’t find a solution idea. Please help me, thanks!

The log tell PPA_SHORT_FRAME that means the output size didn’t as expected.

[ 4705.146081] vi TEGRA_CSI_PIXEL_PARSER_STATUS 0x00000080

I saw the instructions on the TRM. So I want to read the value of the register when the problem occurs. Is there any way, or command to do that?
Thanks agagin!

I would suggest to do it in the csi2_fops.c kernel driver.

I have to say, jeton’s hardware and software are doing a great job.
The image output from the camera is indeed missing 1 line, which caused the error.

Also, I have a question for you.
I’m using jetpack 4.6.1 and I’ve added .set_selection and .get_selection functions to struct v4l2_subdev_pad_ops in the camera driver in order to achieve some flexibility in image sizesetting.
But for some reason,

v4l2-ctl --set-selection=target=crop,top=0,left=0,width=3088,height=2064

It will report an error.

VIDIOC_G_SELECTION returned -1 (Inappropriate ioctl for device)

Sorry, I don’t have experience for this implement.
I would suggest to trace the v4l2 call stack to figure out the problem.

Thanks! I will close this post.

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