Problem for capture CSI data using the V4L2 driver

Hello,
Recently, I need to use the V4L2 driver to capture GRB565 data, The data emulated by the FPGA, I also created 2 device
(/dev/video0 and /dev/video1) nodes successfully, But when I use the V4L2 interface to get the data, I get empty data.
My video size is 1280x720@50fps, the pixel clock is 125MHz, which parameter I also set into the drive, I confirmed that the CSI data and clock are normal, so I guess the problem should be in the driver, but I do not know where to start the investigation.
Really hope someone can help me.
Thank you

hello shrambo,

seems the color format GRB565 isn’t the typical V4L2 supported color format.
could you please check below path and add them in the camera_common_color_fmts structure.

R28.1/kernel/kernel-4.4/drivers/media/platform/tegra/camera/camera_common.c

BTW, may i know which JetPack release you’re working on,
thanks

hello JerryChang,
I am using the LT4-R24.2.2 JetPack. I know V4L2 driver does not support RGB565 format, so I will transmit it as a 16bit yuv image, the final application layer according to RGB565 to deal with, the amount of data is the same, is that OK?
Thank you

hello shrambo,

you may also extended V4L2 supported color format, adding yuv formats.
you should be able to use below commands to dump your stream in to raw files for verification.
for example,

v4l2-ctl --set-fmt-video=width=1280,height=720,pixelformat="UYVY" --device=/dev/video0 --stream-count=100 --stream-mmap --stream-to=test.UYVY

hello JerryChang,
I run the command you provided, below is the printed information:
[ 1605.919678] camera_common_g_fmt entry
[ 1605.923344] camera_common_g_fmt done
[ 1605.926953] tegra_channel_set_format entry the pix=1498831189
[ 1605.932780] tc358748_set_fmt:entry,format->which 0
[ 1605.937664] camera_common_try_fmt entry
[ 1605.941497] camera_common_try_fmt: mf :width 1280 height 720 maxframerate 0 hdr_en 0
[ 1605.949336] camera_common_try_fmt: s_data :width 1280 height 720 maxframerate 0 hdr_en 0
VIDIOC_S_FMT: failed: Invalid argument
[ 1605.966352] tegra_channel_ec_init:418 ----timeOut=1000ms—
[ 1605.972120] tc358748_s_stream++
[ 1605.975255] tc358748_s_stream–
[ 1605.978498] vi vi: SH[csi_port: 0, numlanes:4, total_ports:1]
[ 1605.985354] tegra_mipi_cal 700e3000.mipical: Mipi cal timeout:130597
[ 1605.991717] tegra_mipi_cal 700e3000.mipical: Mipi cal timeout,val:115790, lanes:300000
[ 1605.999634] tegra_mipi_cal 700e3000.mipical: Fixed clk 68MHz
[ 1606.997048] video4linux video0: frame start syncpt timeout!0
[ 1607.003999] vi vi: SH[csi_port: 0, numlanes:4, total_ports:1]
[ 1607.012923] tegra_mipi_cal 700e3000.mipical: Mipi cal timeout:130700
[ 1608.017028] video4linux video0: frame start syncpt timeout!0
[ 1608.024510] vi vi: SH[csi_port: 0, numlanes:4, total_ports:1]
[ 1608.032895] tegra_mipi_cal 700e3000.mipical: Mipi cal timeout:130802
[ 1609.037121] video4linux video0: frame start syncpt timeout!0
[ 1609.043844] vi vi: SH[csi_port: 0, numlanes:4, total_ports:1]
[ 1609.052220] tegra_mipi_cal 700e3000.mipical: Mipi cal timeout:130904
[ 1610.057383] video4linux video0: frame start syncpt timeout!0
[ 1610.064133] vi vi: SH[csi_port: 0, numlanes:4, total_ports:1]
[ 1610.073010] tegra_mipi_cal 700e3000.mipical: Mipi cal timeout:131006
[ 1611.077126] video4linux video0: frame start syncpt timeout!0
[ 1611.083918] vi vi: SH[csi_port: 0, numlanes:4, total_ports:1]
[ 1611.092353] tegra_mipi_cal 700e3000.mipical: Mipi cal timeout:131108
[ 1612.097026] video4linux video0: frame start syncpt timeout!0
[ 1612.103853] vi vi: SH[csi_port: 0, numlanes:4, total_ports:1]
[ 1612.112701] tegra_mipi_cal 700e3000.mipical: Mipi cal timeout:131210
[ 1613.117122] video4linux video0: frame start syncpt timeout!0
[ 1613.123866] vi vi: SH[csi_port: 0, numlanes:4, total_ports:1]
[ 1613.132252] tegra_mipi_cal 700e3000.mipical: Mipi cal timeout:131312
[ 1614.136959] video4linux video0: frame start syncpt timeout!0
[ 1614.143691] vi vi: SH[csi_port: 0, numlanes:4, total_ports:1]
[ 1614.152513] tegra_mipi_cal 700e3000.mipical: Mipi cal timeout:131414
[ 1615.157062] video4linux video0: frame start syncpt timeout!0
[ 1615.163783] vi vi: SH[csi_port: 0, numlanes:4, total_ports:1]
[ 1615.171944] tegra_mipi_cal 700e3000.mipical: Mipi cal timeout:131516
[ 1616.177082] video4linux video0: frame start syncpt timeout!0
[ 1616.184536] vi vi: SH[csi_port: 0, numlanes:4, total_ports:1]
[ 1616.198857] tegra_mipi_cal 700e3000.mipical: Mipi cal timeout:131619
[ 1617.197214] video4linux video0: frame start syncpt timeout!0
[ 1617.203785] vi vi: SH[csi_port: 0, numlanes:4, total_ports:1]
[ 1617.212626] tegra_mipi_cal 700e3000.mipical: Mipi cal timeout:131720

hello shrambo,

please check your sensor device tree settings,
thanks

  1. the sensor frame rate seems not correct, it should not be zero.
[ 1605.949336] camera_common_try_fmt: s_data :width 1280 height 720 maxframerate 0 hdr_en 0
  1. please check which ioctl caused this failure.
VIDIOC_S_FMT: failed: Invalid argument
  1. there’s syncpt timeout for waiting for sensor frame start signaling, please co-work with your hardware engineer to measuring the signaling with oscilloscope.
[ 1606.997048] video4linux video0: frame start syncpt timeout!0