Camera#
The Camera module will showcase how you can capture a video using a USB camera or a CSI-2 camera.
Video can be captured on the AM62Ax using either a USB UVC camera or a MIPI CSI-2 compliant camera. The CSI-2 camera driver is based on the Video for Linux 2 (V4L2) API. Examples are given below to show video capturing by a USB camera as well as a CSI-2 camera.
USB UVC Camera#
Plug in a USB UVC compliant camera and boot the EVM to Linux.
Use the v4l2-ctl command to verify the camera is detected:
# v4l2-ctl --list-devices
TI-CSI2RX (platform:30102000.ticsi2rx):
/dev/media0
wave5-dec (platform:wave5-dec):
/dev/video0
wave5-enc (platform:wave5-enc):
/dev/video1
HD Web Camera: HD Web Camera (usb-xhci-hcd.1.auto-1):
/dev/video2
/dev/video3
/dev/media1
GStreamer can be used to capture the video. The captured video can be
simultaneously sent to the HDMI display if a display is connected. Below is
an example of using GStreamer to stream video (make sure to change videoX
to the actual video device number):
# gst-launch-1.0 v4l2src device="/dev/videoX" ! video/x-raw, width=640, height=480 ! kmssink driver-name=tidss
The captured video can also be stored to a file and played out on the host PC. Instead of using kmssink as the GStreamer sink, a file sink can be used, for example:
# gst-launch-1.0 v4l2src num-buffers=50 device="/dev/videoX" ! video/x-raw, width=640, height=480 ! filesink location=cam-cap.yuv
Then the captured file can be played out on the host PC using an application such as mplayer:
$ mplayer -demuxer rawvideo -rawvideo w=640:h=480:format=yuy2 cam-cap.yuv
CSI-2 Camera#
AM62Ax supports MIPI CSI-2 compliant cameras. The AM62Ax starter kit (SK) EVM has a CSI-2 camera connector that is compatible with the Raspberry Pi camera interface.
Connect a CSI-2 Camera to the EVM
The CSI-2 camera connector is located at the bottom side of the EVM. A CSI-2 camera can be connected to the EVM as shown below:
Note
The CSI-2 camera connector on the AM62A SK EVM is a 22-pin FFC connector. For a camera with 15-pin FFC connector, a 15-pin to 22-pin flat flex cable is needed to connect the camera to the EVM.
Apply Device Tree Overlay
Since any camera can be connected to the EVM, the base dtb in the Processor SDK does not include the device tree node for any particular camera sensor. Therefore, the device tree node for a particular sensor should be added in as an overlay. The Processor SDK contains the device tree overlays for a few sensors, as shown below:
root@am62axx-evm:/boot/dtb/ti# ls k3-am62x-sk-csi2-*.dtbo
k3-am62x-sk-csi2-imx219.dtbo k3-am62x-sk-csi2-ov5640.dtbo k3-am62x-sk-csi2-tevi-ov5640.dtbo
The device tree overlay can be applied in either one of the following two ways:
Open file /run/media/BOOT-mmcblk1p1/uEnv.txt and add the following line at the end of the file, and reboot the EVM:
name_overlays=k3-am62x-sk-csi2-imx219.dtbo
Reboot the EVM and stop at U-Boot prompt, and add the following environment variable:
=>setenv name_overlays k3-am62x-sk-csi2-imx219.dtbo
=>saveenv
=>boot
Verify the Camera Is Detected
Boot the EVM to Linux and use the v4l2-ctl --list-devices command to verify the camera is detected.
The command should return something similar to below:
# v4l2-ctl --list-devices
j721e-csi2rx (platform:30102000.ticsi2rx):
/dev/video3
/dev/video4
/dev/video5
/dev/video6
/dev/video7
/dev/video8
/dev/media0
e5010 (platform:e5010):
/dev/video2
wave5-dec (platform:wave5-dec):
/dev/video0
wave5-enc (platform:wave5-enc):
/dev/video1
The above command displays multiple video nodes (/dev/videoX). Each of these video nodes corresponds to a logical stream of data. If the IMX219 camera is the only connected CSI-2 camera, then the first node under j721e-csi2rx is used.
Capture Video
Because the IMX219 is a raw image sensor, the ISP on the SoC needs to be used in order to stream video. Below commands first configure the format for the sensor and then stream video:
# media-ctl -V '"imx219 4-0010":0 [fmt:SRGGB10_1X10/1920x1080 field:none]'
# gst-launch-1.0 -v v4l2src device=/dev/video3 io-mode=dmabuf-import ! \
video/x-bayer, width=1920, height=1080, framerate=30/1, format=rggb10 ! \
tiovxisp sink_0::device=/dev/v4l-subdev2 sensor-name="SENSOR_SONY_IMX219_RPI" \
dcc-isp-file=/opt/imaging/imx219/dcc_viss_10b.bin sink_0::dcc-2a-file=/opt/imaging/imx219/dcc_2a_10b.bin format-msb=9 ! \
video/x-raw, format=NV12, width=1920, height=1080, framerate=30/1 ! kmssink driver-name=tidss
For more details on configuring the sensor to different formats, please refer to Camera Development section.
Tested CSI-2 Cameras#
The following CSI-2 camera modules have been tested with the AM62A starter kit.
OX05B1S
IMX390
D3 Engineering D3RCM-IMX390-953. The ArduCam V3Link d-ch Adapter Board is needed to test this camera with the AM62A starter kit.
OV2312
Leopard Imaging LI-OV2312-FPDLINKIII-110H. The ArduCam V3Link d-ch Adapter Board is needed to test this camera with the AM62A starter kit.
IMX219
OV5647