Camera (MIPI CSI-2)
======================
The Camera Serial Interface (CSI) is a specification of the Mobile Industry Processor Interface (MIPI) Alliance. It defines an interface between a camera and a host processor. The phyCORE-i.MX7 development kit has one CSI camera connection at X17. This guide will show you how to connect and take picture with a MIPI CSI-2 camera module.
.. image:: ../../images/phycore-imx7/pcm-061_camera-X17.webp
:width: 650px
Requirements
-------------
* `MIPI Camera (LI-OV5640) `_
* MIPI Expansion Module (PEB-AV-06-MIPI)
* `Contact Sales `_
* CAT5e cable (comes included with the development kit)
* See :ref:`eth-7` guide for setup instructions.
* Network switch connected to a DHCP enabled network
.. tip:: A USB drive could alternatively be used for file transfer to and from the phyCORE-i.MX7
Setting Up the Camera
-------------------------
.. image:: ../../images/phycore-imx7/pcm-061_camera-assembled-back.webp
:width: 450px
.. image:: ../../images/phycore-imx7/pcm-061_camera-assembled-front.webp
:width: 450px
* Power off the kit and remove power.
* Connect the MIPI camera to the MIPI expansion module at connector (X2).
* Connect the expansion module with the camera attached to the back side of phyBOARD-Zeta at connector X17.
* Attach the CAT5e cable to one of the ethernet port.
* Power on the development kit and stop in U-boot. Load the device tree overlay required for the parallel camera interface and then boot the board.
.. code-block:: none
:caption: Target (U-boot)
setenv overlays imx7d-phyboard-zeta-peb-av-06.dtbo
boot
.. note::
For more information about overlays see chapter :ref:`ConfiguringTheBootloader-7`.
Taking a Picture
------------------
* To capture a JPG picture named "smile.webp", use the following gstreamer pipeline command.
.. code-block:: none
:caption: Target (Linux)
gst-launch-1.0 v4l2src num-buffers=1 ! videoscale ! 'video/x-raw,format=(string)YUY2,width=640,height=360' ! jpegenc ! filesink location=smile.webp
.. code-block:: none
:caption: Target (Expected Output)
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 0:00:02.443544000
Setting pipeline to NULL ...
Freeing pipeline ...
Viewing Picture
-----------------
This example will use the Secure Copy Protocol (SCP), which requires a network connection. Discover more mediums that can assist in copying files by following the guide :ref:`cpyFiles-7`.
* Use a local network and copy the file from the development kit to your host machine (Ubuntu or Windows).
#. Connect the development kit to your local network using either ethernet port.
#. Confirm the development kit's ethernet IP address (DHCP). For more information on how to change the from a static IP address to a DHCP address, see the :ref:`eth-7` interface guide.
.. code-block:: none
:caption: Target (Linux)
ip addr
#. Transfer the image via Windows Command Prompt or Linux terminal.
.. code-block:: none
:caption: Host (Ubuntu or Windows)
sudo scp root@:/root/smile.webp ./Downloads/
* Open your host machine's Downloads folder. You should see an image named "smile.webp".