Multi-Sensor (MediaTek Imgsensor)

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.0, Genio 700-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 510/700-EVK.

Connect The Camera To The EVK

There are 2 MIPI-CSI slots on Genio 510/700-EVK, which are CSI0 and CSI1. 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 510/700-EVK

Platform

CSI0

CSI1

DTBO

Usage

Genio 510/700-EVK

AP1302+ AR0830

AP1302+ AR0830

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

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

Genio 510/700-EVK

AP1302+ AR0830

IMX214

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

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

Genio 510/700-EVK

IMX214

IMX214

camera-imx214-csi0-imx214-csi1.dtbo

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

Genio 510/700-EVK

IMX214

AP1302+ AR0830

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-flash --list-dtbo
List of available DTBO:
        - camera-ar0830-ap1302-csi0-ar0830-ap1302-csi1.dtbo
        - camera-ar0830-ap1302-csi0-imx214-csi1.dtbo
        - camera-imx214-csi0-imx214-csi1.dtbo
        - camera-imx214-csi0-ar0830-ap1302-csi1.dtbo
        - ...
genio-flash --load-dtbo camera-imx214-csi0-imx214-csi1.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 camera is connected to the CSI0 slot and the AR0830/AP1302 camera is connected to the CSI1 slot, please load the dtbo camera-imx214-csi0-ar0830-ap1302-csi1.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 CSI1 slots

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

    Genio 510/700-EVK with 2x CAM-DTB-D2 and 2x Sony IMX214 sensors

Software Setup

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

    genio-flash --load-dtbo camera-imx214-csi0-imx214-csi1.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 510/700-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 &
    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 &
    

    Note

    Compared with Genio 1200-EVK, the control pins on Genio 510/700-EVK are independent for each slot, so the sensors can be opened simultaneously.