.. include:: ../substitutions.rst Camera ====== 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 |product-cb| has four CSI camera connections on the carrier board, at |camera-csi-ref|. This guide will show you how to connect and take pictures with a MIPI CSI-2 camera module (VM-016 phyCAM-M). To learn more information about the |product-cb| CSI/Camera interface, please see section |hw-ref-camera| in the |hw-manual-link|. .. image:: ../../images/phycore-am67x/interfaceguides/pb-08036_camera.webp :width: 800px :alt: phyCORE-AM67x Cameras Requirements ------------ * `VM-016 phyCAM-M `_ Setting Up the Camera --------------------- * With the board powered off, connect the phyCAM-M module to the camera connector |camera-csi-ref| on the carrier board. #. Open the |camera-csi-ref| connector by pulling the black tab backwards toward the center of the carrier board. #. Insert the ribbon cable into the connector, with the blue tape facing outward. #. Once the ribbon cable has been seated into the connector, pull the black tab back towards it's closed position. You should hear a small click when the connector has completely closed. * 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:: console :substitutions: |uboot-prompt| setenv overlays |intf-camera-overlay| |uboot-prompt| boot .. note:: For camera 0 we use -csi0, for camera 1 it is -csi1, for camera 2 it is -csi2, and for camera 3 it is -csi3. * Once in Linux, setup the camera pipelines. .. code-block:: console :substitutions: |target-prompt| media-ctl -d /dev/media0 -V "'ar0144 3-0010':0 [fmt:SGRBG8_1X8/1280x800 (0,4)/1280x800 field:none colorspace:default xfer:default ycbcr:default quantization:default]" |target-prompt| media-ctl -d /dev/media0 -V "'ar0144 3-0010':0 [fmt:SGRBG8_1X8/1280x800 field:none colorspace:default xfer:default ycbcr:default quantization:default]" |target-prompt| media-ctl -d /dev/media0 -V "'30102000.ticsi2rx':0 [fmt:SGRBG8_1X8/1280x800 field:none colorspace:default xfer:default ycbcr:default quantization:default]" .. note:: * These instructions are given for camera 0. Below are more details for using the other cameras. * "media-ctl" configures the camera pipeline by defining the format, resolution, and other settings for the image capture. * "/dev/media0" is the camera you are using. The cameras start at media0 and go up to media3 depending on how many cameras you have. * "ar0144" refers to the CMOS digital image sensor with the pixel array of 1280H x 800V being used to capture images. * "3-0010" refers to the I2C device being used. For camera 0 this is 3-0010, for camera 1 it is 4-0010, for camera 2 it is 5-0010 and for camera 3 it is 6-0010. * "30102000.ticsi2rx" refers to the TI CSI interface. For camera 1 it should be 30122000, for camera 2 it should be 30142000, and for camera 3 it is 30162000. Taking a Picture ---------------- * To capture a PNG picture named "smile.png", use the following gstreamer pipeline command. .. code-block:: console :substitutions: |target-prompt| gst-launch-1.0 v4l2src num-buffers=5 device=/dev/video2 ! video/x-bayer,format=grbg,depth=8,width=1280,height=800 ! bayer2rgb ! videoconvert ! pngenc ! multifilesink location=smile.png Setting pipeline to PAUSED ... Pipeline is live and does not need PREROLL ... Setting pipeline to PLAYING ... New clock: GstSystemClock Redistribute latency... Got EOS from element "pipeline0". Execution ended after 0:00:02.443544000 Setting pipeline to NULL ... Freeing pipeline ... .. note:: In /dev/video, the index starts at 2 when you have a single camera and each additional camera is populated at a later index. For example, if you have cameras 1 and 2 enabled, camera 1 would be /dev/video2 and camera 2 would be /dev/video8. Viewing Picture on HDMI ----------------------- After capturing an image, you can display it on an HDMI monitor connected to the board. The following command uses GStreamer to display the PNG image: .. code-block:: console :substitutions: |target-prompt| gst-launch-1.0 -v filesrc location=./smile.png ! pngdec ! imagefreeze ! kmssink driver-name="tidss" The pipeline reads the PNG file, decodes it, freezes the image (since it's a still image), and displays it on the HDMI output. The image will be shown until you press Ctrl+C to stop the GStreamer pipeline. See :ref:`hdmi-displaying-images` for more details about HDMI display configuration and additional display options.