Multi-Sensor (MediaTek Imgsensor)

Note

All command operations presented in this chapter are based on the IoT Yocto v24.0, Genio 1200-EVK and Sony IMX214 sensor. You might get different operation results depending on the platform you use.

This chapter shows how to operate multi sensors under MediaTek Imgsensor architecture on Genio 1200-EVK.

Connect The Camera To The EVK

There are 3 MIPI-CSI slots on Genio 1200-EVK, which are CSI0, CSI1 and CSI2. RAW camera DTB and YUV camera DTB can run together.

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.

Multi Camera DTBO for Genio 1200-EVK

Platform

CSI0

CSI1

CSI2

DTBO

Usage

Genio 1200-EVK

AP1302+ AR0830

x

AP1302+ AR0830

camera-ar0830-ap1302-csi0-ar0830-ap1302-csi2.dtbo

Enable 4-lane CAM-DTB-D6 w/ Onsemi AR0830 on CSI0 and CSI2

Genio 1200-EVK

IMX214

x

IMX214

camera-imx214-csi0-imx214-csi2.dtbo

Enable 4-lane CAM-DTB-D2 w/ Sony IMX214 on CSI0 and CSI2

Genio 1200-EVK

IMX214

AP1302+ AR0830

x

camera-imx214-csi0-ar0830-ap1302-csi1.dtbo

Enable 4-lane CAM-DTB-D2 w/ Sony IMX214 on CSI0, and 4-lane CAM-DTB-D6 w/ Onsemi AR0830 on CSI1

Genio 1200-EVK

IMX214

x

AP1302+ AR0830

camera-imx214-csi0-ar0830-ap1302-csi2.dtbo

Enable 4-lane CAM-DTB-D2 w/ Sony IMX214 on CSI0, and 4-lane CAM-DTB-D6 w/ Onsemi AR0830 on CSI2

Genio 1200-EVK

IMX214

AP1302+ AR0830

AP1302+ AR0830

camera-imx214-csi0-ar0830-ap1302-csi1-ar0830-ap1302-csi2.dtbo

Enable 4-lane CAM-DTB-D2 w/ Sony IMX214 on CSI0, 4-lane CAM-DTB-D6 w/ Onsemi AR0830 on CSI1, and 4-lane CAM-DTB-D6 w/ Onsemi AR0830 on CSI2

Genio 1200-EVK

IMX214

AP1302+ AR0830

IMX214

camera-imx214-csi0-ar0830-ap1302-csi1-imx214-csi2.dtbo

Enable 4-lane CAM-DTB-D2 w/ Sony IMX214 on CSI0, 4-lane CAM-DTB-D6 w/ Onsemi AR0830 on CSI1, and 4-lane CAM-DTB-D2 w/ Sony IMX214 on CSI2

genio-flash --list-dtbo
List of available DTBO:
        - camera-ar0830-ap1302-csi0-ar0830-ap1302-csi2.dtbo
        - camera-imx214-csi0-imx214-csi2.dtbo
        - camera-imx214-csi0-ar0830-ap1302-csi1.dtbo
        - camera-imx214-csi0-ar0830-ap1302-csi2.dtbo
        - camera-imx214-csi0-ar0830-ap1302-csi1-ar0830-ap1302-csi2.dtbo
        - camera-imx214-csi0-ar0830-ap1302-csi1-imx214-csi2.dtbo
        - ...
genio-flash --load-dtbo camera-imx214-csi0-imx214-csi2.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 IMX214 cameras are connected to the CSI0 and CSI2 slot, please load the dtbo camera-imx214-csi0-imx214-csi2.dtbo. Otherwise, the camera initialization will fail.

Dual Sony IMX214

Hardware Setup

  1. Prepare 2x CAM-DTB-D2 and 2x Sony IMX214 sensors

  2. Connect the DTBs to CSI0 and CSI2 slots

    ../../../../_images/sw_yocto_app-dev_camera_g1200_connect-dual-d2.png

    Genio 1200-EVK with 2x CAM-DTB-D2 and 2x Sony IMX214 sensors

Software Setup

  1. Select the dtbo camera-imx214-csi0-imx214-csi2.dtbo through genio-flash

    genio-flash --load-dtbo camera-imx214-csi0-imx214-csi2.dtbo --load-dtbo gpu-mali.dtbo --load-dtbo video.dtbo
    
  2. Find the video and media device of the camera system

    One sensor corresponds to one mtkcam media device. For example, the first IMX214 sensor corresponds to mtkcam0, and the second one corresponds to mtkcam1. In the following example, there are 2x IMX214 enabled on the Genio 1200-EVK.

    v4l2-ctl -z platform:mtkcam0 --list-devices
    /dev/media3
    /dev/video36
    /dev/video37
    /dev/video40
    declare -a CAM0_VIDEO_DEV=($(v4l2-ctl -z platform:mtkcam0 --list-devices | grep video | tr "\n" " "))
    echo ${CAM0_VIDEO_DEV[*]}
    /dev/video36 /dev/video37 /dev/video40
    
    v4l2-ctl -z platform:mtkcam1 --list-devices
    /dev/media2
    /dev/video28
    /dev/video30
    /dev/video32
    declare -a CAM1_VIDEO_DEV=($(v4l2-ctl -z platform:mtkcam1 --list-devices | grep video | tr "\n" " "))
    echo ${CAM1_VIDEO_DEV[*]}
    /dev/video28 /dev/video30 /dev/video32
    

    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.

  3. Launch dual Sony IMX214 pipeline to show images on the Weston desktop

    gst-launch-1.0 v4l2src device=${CAM0_VIDEO_DEV[0]} ! video/x-raw,width=640,height=480,format=YUY2 ! waylandsink sync=false &
    gst-launch-1.0 v4l2src device=${CAM0_VIDEO_DEV[1]} ! video/x-raw,width=640,height=480,format=NV12 ! waylandsink sync=false &
    gst-launch-1.0 v4l2src device=${CAM0_VIDEO_DEV[2]} ! image/jpeg,width=640,height=480,format=JPEG ! jpegdec ! waylandsink sync=false &
    killall gst-launch-1
    gst-launch-1.0 v4l2src device=${CAM1_VIDEO_DEV[0]} ! video/x-raw,width=640,height=480,format=YUY2 ! waylandsink sync=false &
    gst-launch-1.0 v4l2src device=${CAM1_VIDEO_DEV[1]} ! video/x-raw,width=640,height=480,format=NV12 ! waylandsink sync=false &
    gst-launch-1.0 v4l2src device=${CAM1_VIDEO_DEV[2]} ! image/jpeg,width=640,height=480,format=JPEG ! jpegdec ! waylandsink sync=false &
    

    Warning

    On Genio 1200-EVK, some control pins are shared between each slot, so the sensors cannot be opened simultaneously. The working sensor MUST be turned off before the other one starts. Otherwise, the sensor controls will conflict and lead to an unstable state.