RAW Sensor (V4L2 Sensor)
Important
All the bash commands shown here are based on Genio 510/700-EVK. For Genio 510-EVK, users can follow the same step to do the whole setup by changing the naming term from 700 to 510.
Note
All command operations presented in this chapter are based on the IoT Yocto v24.1, Genio 700-EVK and Sony IMX214 sensor. You might get different operation results depending on the platform you use.
This chapter shows how to receive RAW (bayer) sensor data and directly dump it to the DRAM under V4L2 Sensor architecture on Genio 510/700-EVK. There are 8x camera DMA engines in Genio 510/700.
Note
The purpose of capturing bayer frames is to verify the hardware pathway before getting started with imgsensor integration for a given sensor.
Camera Package and Specification
The RAW camera DTB for Genio 510/700-EVK is CAM DTB-D2
.
It contains a SONY IMX214 CMOS Image Sensor.
Connect The Camera to the EVK
There are 2 MIPI-CSI slots on Genio 510/700-EVK, which are CSI0
and CSI1
.
In the following figure, the camera DTB is connected to the CSI0
slot.
Note
All three CSI slots are available. The user can connect the camera sensor to any slot.
Select Camera Device Tree Blob Overlay
The camera device is inactive by default, so the kernel has to load a specific device tree blob overlay to enable it. Please refer to bl33u-boot for more details.
Platform |
CSI0 |
CSI1 |
DTBO |
Usage |
---|---|---|---|---|
Genio 510/700-EVK |
IMX214 |
x |
camera-imx214-csi0-std.dtbo |
Enable 4-lane CAM-DTB-D2 w/ Sony IMX214 on CSI0 using standard V4L2 driver |
Genio 510/700-EVK |
x |
IMX214 |
camera-imx214-csi1-std.dtbo |
Enable 4-lane CAM-DTB-D2 w/ Sony IMX214 on CSI1 using standard V4L2 driver |
genio-flash --list-dtbo
List of available DTBO:
- camera-imx214-csi0-std.dtbo
- camera-imx214-csi1-std.dtbo
- ...
genio-flash --load-dtbo camera-imx214-csi0-std.dtbo --load-dtbo gpu-mali.dtbo --load-dtbo apusys.dtbo --load-dtbo video.dtbo
Warning
Please select the DTBO according to the CSI slot to which the camera sensor is connected.
For example, if the camera is connected to the CSI0
slot, please load the dtbo camera-imx214-csi0-std.dtbo
.
Otherwise, the camera initialization will fail.
Supported Formats and Sizes
The array of supported formats and sizes depends on the IMX214 driver in the linux kernel.
Supported sizes:
4096x2304
1920x1080
Supported formats:
SRGGB10
Media Device
The media device represents the internal topology of a media system like ISP. The topology setting including links, pads, and entities can be set through the media device. Therefore, the first step is to find the target media device node.
export MEDIA_DEV=$(v4l2-ctl -z platform:$(basename `find /sys/bus/platform/devices/ -name "*camisp"`) --list-devices | grep media)
echo ${MEDIA_DEV}
/dev/media3
Warning
The assigned node number for the media device may vary depending on the sequence of the probing process during the boot-up phase. As such, it is crucial to ensure the accuracy of the media device node before using the camera.
Video Device
The video device is the interface for users to obtain the images. On Genio 510/700-EVK, they are called mtk-cam camsv-* main-stream
.
The media-ctl
is a useful tool to list video devices.
declare -a VIDEO_DEV=(`for i in {0..7}; do media-ctl -d ${MEDIA_DEV} --entity "mtk-cam camsv-$i main-stream"; done | tr "\n" " "`)
echo ${VIDEO_DEV[*]}
/dev/video53 /dev/video54 /dev/video55 /dev/video56 /dev/video57 /dev/video58 /dev/video59 /dev/video60
Warning
The assigned node number for the video device may vary depending on the sequence of the probing process during the boot-up phase. As such, it is crucial to ensure the accuracy of the video device node before using the camera.
Launch Camera
The initial step is to link all the necessary components within the media device. The structure of the RAW camera pipeline is quite straightforward. It fundamentally incorporates only three components: the sensor, SENINF, and CAMSV.
media-ctl -d ${MEDIA_DEV} -l "'seninf-0':1 -> 'mtk-cam camsv-0':0 [5]"
media-ctl -d ${MEDIA_DEV} -l "'imx214 5-001a':0 -> 'seninf-0':0 [1]"
The second step is to assign the correct format and size to each component incorporated in the camera pipeline.
media-ctl -d ${MEDIA_DEV} -V "'imx214 5-001a':0 [fmt:SRGGB10_1X10/1920x1080 field:none]"
media-ctl -d ${MEDIA_DEV} -V "'seninf-0':1 [fmt:SRGGB10_1X10/1920x1080 field:none]"
media-ctl -d ${MEDIA_DEV} -V "'mtk-cam camsv-0':1 [fmt:SRGGB10_1X10/1920x1080 field:none]"
For the third step, it’s necessary to identify the correct video device node. For further information on this, please refer to Video Device.
declare -a VIDEO_DEV=(`for i in {0..7}; do media-ctl -d ${MEDIA_DEV} --entity "mtk-cam camsv-$i main-stream"; done | tr "\n" " "`)
echo ${VIDEO_DEV[*]}
/dev/video53 /dev/video54 /dev/video55 /dev/video56 /dev/video57 /dev/video58 /dev/video59 /dev/video60
Important
You have to select the video node that corresponds to the CAMSV instance linked in the second step.
In this given example, mtk-cam camsv-0
is the linked instance, hence the video device node should be ${VIDEO_DEV[0]}
or /dev/video53
.
Lastly, to activate the camera, the user can use v4l2-ctl
, gst-launch-1.0
, or other V4L2 applications.
Use
v4l2-ctl
v4l2-ctl -d ${VIDEO_DEV[0]} --set-fmt-video=width=1920,height=1080,pixelformat=MBRA --stream-mmap --stream-count=10 --stream-to=/tmp/imx214.raw --verbose
Use
gst-launch-1.0
gst-launch-1.0 v4l2src device=${VIDEO_DEV[0]} ! video/x-bayer,width=1920,height=1080,format=rggb ! bayer2rgb ! waylandsink sync=false
Note
The output captured or displayed through the raw sensor pipeline may appear discolored or dark because it lacks ISP processing.