.. include:: /keyword.rst .. _feature-g1200-cam-imgsensor-multi-sensor: ================================= Multi-Sensor (MediaTek Imgsensor) ================================= .. contents:: Sections :local: :depth: 2 .. note:: All command operations presented in this chapter are based on the IoT Yocto v24.0, |G1200-EVK-REF-BOARD| 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 |G1200-EVK|. Connect The Camera To The EVK ----------------------------- There are 3 MIPI-CSI slots on |G1200-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 the :ref:`bl33 (u-boot) section ` for more details. .. csv-filter:: Multi Camera DTBO for |G1200-EVK| :header-rows: 1 :file: ../../../../_asset/tables/camera-platform-sensor-dtbo.csv :include: {0: 'Genio 1200-EVK'} :exclude: {5: '[^2.*&^3.*&^4.*]', 6: '[^0.*]'} :included_cols: 0,1,2,3,4,7 .. prompt:: bash > auto > 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 ~~~~~~~~~~~~~~ #. Prepare 2x CAM-DTB-D2 and 2x Sony IMX214 sensors #. Connect the DTBs to CSI0 and CSI2 slots .. figure:: /_asset/sw_yocto_app-dev_camera_g1200_connect-dual-d2.png :align: center :scale: 30% |G1200-EVK| with 2x CAM-DTB-D2 and 2x Sony IMX214 sensors Software Setup ~~~~~~~~~~~~~~ #. Select the `dtbo` ``camera-imx214-csi0-imx214-csi2.dtbo`` through ``genio-flash`` .. prompt:: bash > auto > genio-flash --load-dtbo camera-imx214-csi0-imx214-csi2.dtbo --load-dtbo gpu-mali.dtbo --load-dtbo video.dtbo #. 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 |G1200-EVK|. .. prompt:: bash # auto # 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. #. Launch dual Sony IMX214 pipeline to show images on the Weston desktop .. prompt:: bash # auto # 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 |G1200-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.