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 phyBOARD-Rigel AM67x has four CSI camera connections on the carrier board, at X18 - X21. 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 phyBOARD-Rigel AM67x CSI/Camera interface, please see section 8 & 8.3 in the Hardware Manual.

phyCORE-AM67x Cameras

Requirements

Setting Up the Camera

  • With the board powered off, connect the phyCAM-M module to the camera connector X18 - X21 on the carrier board.

    1. Open the X18 - X21 connector by pulling the black tab backwards toward the center of the carrier board.

    2. Insert the ribbon cable into the connector, with the blue tape facing outward.

    3. 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.

sh-uboot:~# setenv overlays k3-am6754-phyboard-rigel-vm016-mipi-csi0.dtbo
sh-uboot:~# 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.

sh-phyboard-rigel-am67xx-1:~# 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]"
sh-phyboard-rigel-am67xx-1:~# media-ctl -d /dev/media0 -V "'ar0144 3-0010':0 [fmt:SGRBG8_1X8/1280x800 field:none colorspace:default xfer:default ycbcr:default quantization:default]"
sh-phyboard-rigel-am67xx-1:~# 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.

sh-phyboard-rigel-am67xx-1:~# 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<index>, 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:

sh-phyboard-rigel-am67xx-1:~# 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 Displaying Images for more details about HDMI display configuration and additional display options.