The phyCORE-i.MX7 development kit brings out a Camera Serial Interface (CSI-2) to the X17 connector. This guide will show how to take video with the MIPI Camera. 


MIPI Camera (LI-OV5640) 

USB storage device

A network connection could alternatively be used for file transfer to and from the phyCORE-i.MX7


This is a pre-compiled script for video capture

Step-by-Step Guide

It is always a good idea to completely poweroff target hardware and remove power supplies before making hardware connections. The following guide will include steps that will walk you through the proper installation of the MIPI Camera and Expansion Board.

Setting up

  • Using your Host Machine, download the mx6s_v4l2_capture.out and save it to your USB drive.
  • Safely eject the USB drive from your Host Machine.
  • With the phyCORE-i.MX7 booted in Linux, insert the USB drive into the USB port X9. Now use the following command to transfer the file to your development kit. (Afterwards, just leave the USB drive connected).

    Target (Linux)

    cp /run/media/sda1/mx6s_v4l2_capture.out /unit_tests
  • Modify the permissions of the file such that you, as the root user, can execute it: 

    Target (Linux)

    chmod +x /unit_tests/mx6s_v4l2_capture.out
  • Power off the phyCORE-i.MX7 and remove the the power supply using the following command BEFORE connecting your camera and MIPI Expansion Board: 

    Target (Linux)


Connecting Hardware

  • Connect the MIPI camera to the MIPI Expansion Module at connector (X2).

  • Then connect the whole assembly to the back side of phyBOARD-Zeta at connector X17. (Ensure that connector X17 on the phyBOARD-Zeta mates with the connector X1 on the MIPI Expansion Module)

  • Reconnect the power supply and boot back into Linux.

Taking Video

  • Enter the following command to take a short video: 

    Target (Linux)

    /unit_tests/mx6s_v4l2_capture.out -d /dev/video0 -m 0 -of video1.yuv -t 5
  • Copy the newly generated video file back to the Flash drive: 

    Target (Linux)

    cp video1.yuv /run/media/sda1
  • Run this command before physically disconnecting the Flash drive to avoid data corruption: 

    Target (Linux)

    umount /dev/sda1

Insert your Flash drive into your host machine to check out the video! You may find that most common video players do not support raw video formats such as .yuv files. For this reason, I recommend the open source .yuv video player found HERE.

The output of the mx6s_v4l2_capture.out script above will format your video to the VGA graphics standard and YUYV color format. These will have to be set in your video player's settings to properly view the video.

Known Issue With Taking Pictures

It will be required to use the above mx6s_v4l2_capture.out script capturing a short video to properly initialize the camera before attempting to take still images. After running the mx6s_v4l2_capture.out upon booting into Linux you will then be able to capture still images using the following command.

Target (Linux)

gst-launch-1.0 v4l2src num-buffers=1 ! videoscale ! 'video/x-raw,format=(string)YUY2,width=640,height=360' ! jpegenc ! filesink location=test.jpg

This will save images to the current working directory under the file name "test.jpg".