The video frame (raw file) captured by v4l2 is not right

  • 1 BSP environment
    TX2 jetpack 4.6 L4T R32.6.1 kernel 4.9 aarch64

  • 2 camera information

root@t-desktop:/home/t# v4l2-ctl --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
	Index       : 0
	Type        : Video Capture
	Pixel Format: 'GREY'
	Name        : 8-bit Greyscale
		Size: Discrete 640x400
			Interval: Discrete 0.017s (60.000 fps)
  • 3 problems
    use v4l2 command capture one frame, but the raw file is in a mess, and the size is 300KB. we communicated with camera FAE, and got replay that the size should be 250KB. what`s more FAE verified that all registors are setted well. So, can any one help to give advices?

Regards Henry

FYI

v4l2-ctl --set-fmt-video=width=640,height=400 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1 --stream-to=t.raw -d /dev/video0 

raw file captured by our sensor
t640400_8bit_511.raw (300 KB)
raw file given by sensor FAE
raw_8bit-0426.raw (250 KB)

Looks like the alignment was set as 256.
Have reference to below topic.

Hi @ShaneCCC
The media bus format of our sensor is “Y8_1X8”. The sensor works well at 1280X800 mode (Have reference to the topic). But, at 640X400 mode, the frame goes wrong.
So, I think the format is right. Could you give more advices.
Regards Henry

I didn’t say the format is wrong. What I want to tell is the alignment is 256 and the 1280 just 5*256 but 640 didn’t alignment 256.

Hi @ShaneCCC
How to config alignment, so that make the sensor fit for 640. Should DT, such as pixel clock, mclk multiplier, etc, be configed?
Regards Henry

Need modify the kernel VI driver for it.

Hi @ShaneCCC
Is there any examples for it. Such as files, and other introduction.
Regards
Henry

Check the …/kernel/nvidia/drivers/media/platform/tegra/camera/vi/channel.c

Hi @ShaneCCC

In the following camera architechture, sensor is connected directly to the V4l framework. So i wonder will the vi module influence the raw file?Because, we use V4L command to capture a frame.
Regards Henry
FYI

It doesn’t matter about the framework, it’s about the memory alignment.