Skip to main content
QCS6490IQ-9075-EVKIQ-8275-EVKIQ615Stable

MIPI CSI

Multi-platform support

GMSL

Quad deserializer

GStreamer

Primary API

V4L2

Driver API

This page describes how to connect camera sensors to your reference hardware platform and provides information about available APIs.

01 · Set up the camera

QCS6490 Camera Topology

Default camera modules
  • OV9282
  • IMX577

RB3G2 Vision Mezzanine: MIPI CSI

Camera Connections

SlotSensorStatus
CAM0AOV9282Supported
CAM3IMX577Supported
Connect:
  • OV9282 → CAM0A
  • IMX577 → CAM3

SW2300 DIP Switch on Interposer Board

SlotSW2300 Switch 1DefaultFunction
CAM0ANot requiredN/AWorks without DIP setting
CAM3OFFOFFEnables CAM3 use
To use the CAM3 slot on the vision mezzanine board, SW2300 switch 1 must be OFF. This is the default state. CAM0A works without any DIP switch setting.

RB3G2 Vision Mezzanine: GMSL

There are two GMSL slots on the vision mezzanine board:
  • GMSL1
  • GMSL2
SlotShared CSISwitch RequiredDefault StateStatus
GMSL1NoNoneN/ASupported
GMSL2Shares CSI with CAM3SW2300 switch 1 = ONOFFSupported
Important
  • GMSL1 works without any hardware setting
  • CAM3 CSI and GMSL2 share the same CSI path
  • To use GMSL2, set SW2300 switch 1 to ON
  • Default state of SW2300 switch 1 is OFF

RB3G2 Interposer Board: MIPI CSI

Camera Connections

SlotSensorStatus
CAM1OV9282Supported
CAM2IMX577Supported
Connect:
  • OV9282 → CAM1
  • IMX577 → CAM2

DIP Switch Settings

SwitchSettingDefaultPurpose
CSI1_DIP_SWONOFFEnables CAM1
CSI2_DIP_SWONOFFEnables CAM2
Set CSI1_DIP_SW and CSI2_DIP_SW to ON to use CAM1 and CAM2 on the interposer board. Default state is OFF.

Supported Features

FeatureIMX577 (CAM3)OV9282 (CAM0A)AR0231 (GMSL)
SHDRYesNoNo
LDCYesNoNo
EISYesNoNo

02 · Choose the stream API

Qualcomm Linux supports the following APIs for camera:

GStreamer API

GStreamer is an open-source multimedia framework. Qualcomm provides a GStreamer plugin (qtiqmmfsrc) that allows developers to control the camera subsystem in applications. See Qualcomm GStreamer plugins for more information.

V4L2 API

V4L2 is a framework within the Linux kernel that provides support for video capture, video output, and other multimedia devices. Developers can operate the camera using the V4L2 API. The V4L2 API, which uses the CAMSS driver, is suitable for developers who only need to obtain raw images from the camera.

03 · Stream camera with the GStreamer API

gst-launch-1.0 is a command-line GStreamer utility used to build and run a GStreamer pipeline. The pipeline is specified as a collection of elements with properties separated by exclamation marks (!).

Prerequisites

To use gst-launch-1.0 and GStreamer plugins, flash the Config2 image. For overlay configuration details, see Overlay Configurations.
Connect to the device console using SSH. See How To SSH? for instructions.
1

🗑️ Clear GStreamer Registry

If a GStreamer command was executed before enabling the camera overlay, the GStreamer registry must be cleared after enabling the camera overlay. Run the following command to clear the registry:
Terminal
rm ~/.cache/gstreamer-1.0/registry.aarch64.bin
2

📉 Tune Log Level

Camera use-cases are expected to run on a performance (perf) build for optimal results. On default builds, reduce the kernel console log level as shown below:
Terminal
echo 4 > /proc/sys/kernel/printk
3

⚡ Activate Adreno OpenCL for cam-server

Before running any Advanced camera use cases like SHDRv2, SHDRv3, Defog, etc., configure the cam-server systemd service to use the Adreno OpenCL ICD library.
1

🛠️ Open the service override

Edit the cam-server systemd unit so it can load a custom environment file.
Terminal
systemctl edit --full cam-server
Add this line under the [Service] section:
Terminal
EnvironmentFile=/etc/cam-server-env
Save and exit.
2

⚙️ Point to Adreno OpenCL

Set the OpenCL ICD path used by cam-server.
Terminal
echo "OCL_ICD_FILENAMES=/usr/lib/libOpenCL_adreno.so.1" > /etc/cam-server-env
3

🔄 Reload and restart

Apply the updated service configuration and restart cam-server.
Terminal
systemctl daemon-reload
systemctl restart cam-server

Run camera use cases

Ensure that MIPI cameras are connected to CSI slots. The OV9282 MIPI camera should be connected to the CAM 0A slot and the IMX577 MIPI camera should be connected to the CAM3 slot.

Single camera stream start

1

Run the pipeline

Run the following command in the device terminal:
GStreamer (Fakesink)
gst-launch-1.0 -e qtiqmmfsrc name=camsrc camera=0 ! 'video/x-raw,format=NV12,\
width=1280,height=720,framerate=30/1' ! fakesink
2

Verify pipeline status

This command starts the camera with 720p at 30 FPS configuration. The frame coming from the camera sensor is thrown away by fakesink. If the gst pipeline status is changed to “PLAYING” as shown below, this indicates that the camera is running. Since this command dumps camera frames to fakesink, nothing will be saved on the device.
Log Output
gbm_create_device(187): Info: backend name is: msm_drm
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
To stop the camera, press CTRL+C.

Video encoding

1

Run the pipeline

Run the following command in the device terminal:
GStreamer (MP4 Record)
gst-launch-1.0 -e qtiqmmfsrc name=camsrc camera=0 ! \
video/x-raw,format=NV12,width=1280,height=720,framerate=30/1,\
interlace-mode=progressive,colorimetry=bt601 ! v4l2h264enc \
capture-io-mode=4 output-io-mode=5 extra-controls="controls,video_bitrate=6000000,\
video_bitrate_mode=0;" ! h264parse ! mp4mux ! filesink location=/opt/mux_avc.mp4
This command starts the camera with 720p at 30 FPS configuration and saves it as a video file after h264 video encoding. If the gst pipeline status is changed to “PLAYING”, this indicates the camera is running.To stop the camera, press CTRL+C.
2

Pull recorded content

/opt/mux_avc.mp4 is generated on the device. The recorded content can be pulled from the device by running the following scp command on the host PC:
SCP (SSH)
$ scp -r root@[ip-addr]:/opt/mux_avc.mp4 .

Video encoding and snapshot

1

Run the pipeline

Run the following command in the device terminal:
GStreamer (Snapshot + Video)
gst-pipeline-app -e qtiqmmfsrc name=camsrc camera=0 ! \
video/x-raw,format=NV12,width=1280,height=720,framerate=30/1,\
interlace-mode=progressive,colorimetry=bt601 ! v4l2h264enc \
capture-io-mode=4 output-io-mode=5 extra-controls="controls,video_bitrate=6000000,\
video_bitrate_mode=0;" ! h264parse ! mp4mux ! filesink location=/opt/mux_avc.mp4 \
camsrc.image_1 ! "image/jpeg,width=1280,height=720,framerate=30/1" \
! multifilesink location=/opt/frame%d.jpg async=false sync=true enable-last-sample=false
2

Navigate the menu

Press Enter. This command will print the following menu and wait for user input.
Menu
##################################### MENU #####################################
============================== Pipeline Controls==============================
(0) NULL: Set the pipeline into NULL state
(1) READY: Set the pipeline into READY state
(2) PAUSED: Set the pipeline into PAUSED state
(3) PLAYING: Set the pipeline into PLAYING state
==================================== Other====================================
(p) Plugin Mode: Choose a plugin which to control
(q) Quit : Exit the application
Choose an option:
3

Take a snapshot

Use the following menu steps to take a snapshot while recording video.
Menu Steps
(1) ready -> (3) Playing -> (p)Plugin Mode : Select (8)camerasrc -> (37) capture-image -> (1): still - Snapshot ->(1) Snapshot count ( 'guint' value for arg1)
4

Stop and retrieve files

To stop the camera, press Enter, press b (back), and then press q (quit). The recorded video file and snapshot images are saved in /opt/. The recorded content can be pulled from the device by running the following scp command on the host PC:
SCP (SSH)
$ scp -r root@[ip-addr]:/opt/<file name> .

MIPI multi-camera streaming

QCS6490 has five CSI PHYs to which you can connect five MIPI cameras.QCS6490 has three IFEs and two IFE Lites. This means you can run three cameras with IFEs and two cameras with IFE Lites. IFE Lites only support raw dumps from the sensor. You can connect mono cameras to the IFE Lites, dump raw frames, and then convert the output to YUV frames using a CHI node.To validate five camera concurrency on the RB3 platform:
1

Connect MIPI cameras

Connect MIPI cameras as described in the following table.
SlotCamera sensor
CAM 0AOV9282 mono camera
CAM 0BOV9282 mono camera
CAM1IMX577 bayer camera
CAM2IMX577 bayer camera
CAM3IMX577 bayer camera
2

Run GST commands for all five cameras concurrently

For OV9282 mono cameras, a separate camera pipeline (RealTimeMonoToYUV) is used. This pipeline uses IFE Lites to dump the raw frame and then convert it to a YUV frame using a CHI node. Use the GST parameter ife-direct-stream=1 to use this camera pipeline. Since it runs with an IFE Lite, 2A is not applied on these cameras.
The QCS6490 maximum encode capability is 4K@30. Thus, the total encode processing from all five cameras has to be under the 4k@30 limit.
Cam 0: IMX577
GStreamer (Cam 0)
gst-launch-1.0 -e qtiqmmfsrc name=camsrc camera=0 ! video/x-raw,format=NV12,width=1920,height=1080,\
framerate=30/1 ! v4l2h264enc capture-io-mode=4 output-io-mode=5 extra-controls="controls,video_bitrate=5000000,\
video_bitrate_mode=0;" ! queue ! h264parse ! mp4mux ! queue ! filesink location=/opt/Cam_0_1080p.mp4
Cam 1: IMX577
GStreamer (Cam 1)
gst-launch-1.0 -e qtiqmmfsrc name=camsrc camera=1 ! video/x-raw,format=NV12,width=1920,height=1080,\
framerate=30/1 ! v4l2h264enc capture-io-mode=4 output-io-mode=5 extra-controls="controls,video_bitrate=5000000,\
video_bitrate_mode=0;" ! queue ! h264parse ! mp4mux ! queue ! filesink location=/opt/Cam_1_1080p.mp4
Cam 8: IMX577
GStreamer (Cam 8)
gst-launch-1.0 -e qtiqmmfsrc name=camsrc camera=8 ! video/x-raw,format=NV12,width=1920,height=1080,\
framerate=30/1 ! v4l2h264enc capture-io-mode=4 output-io-mode=5 extra-controls="controls,video_bitrate=5000000,\
video_bitrate_mode=0;" ! queue ! h264parse ! mp4mux ! queue ! filesink location=/opt/Cam_8_1080p.mp4
Cam 2: OV9282
GStreamer (Cam 2)
gst-launch-1.0 -e qtiqmmfsrc name=camsrc camera=2 ife-direct-stream=1 ! video/x-raw,format=NV12,width=1280,height=720,\
framerate=30/1 ! v4l2h264enc capture-io-mode=4 output-io-mode=5 extra-controls="controls,video_bitrate=5000000,\
video_bitrate_mode=0;" ! queue ! h264parse ! mp4mux ! queue ! filesink location=/opt/Cam_2_720p.mp4
Cam 3: OV9282
GStreamer (Cam 3)
gst-launch-1.0 -e qtiqmmfsrc name=camsrc camera=3 ife-direct-stream=1 ! video/x-raw,format=NV12,width=1280,height=720,\
framerate=30/1 ! v4l2h264enc capture-io-mode=4 output-io-mode=5 extra-controls="controls,video_bitrate=5000000,\
video_bitrate_mode=0;" ! queue ! h264parse ! mp4mux ! queue ! filesink location=/opt/Cam_3_720p.mp4

Other GStreamer Samples

The QIM SDK includes GStreamer sample applications for camera and sample applications for AI/ML and other multimedia applications.
Before using the sample applications, ensure that the installation prerequisites for gst-launch-1.0 and GStreamer plugins are met.
See Multimedia use case examples for examples using gst-launch-1.0.

04 · Stream camera with the V4L2 API

To use the V4L2 API, flash the Config1 image. For overlay configuration details, see Overlay Configurations.
The V4L2 framework within the Linux kernel supports video devices. It provides an API that allows user space applications to interact with devices such as cameras and video capture cards.More information on V4L2 is available from kernel.org.
Qualcomm supports the V4L2 interface camera ISP driver for raw frame dump functionality in the upstream kernel.

CAMSS driver

The Qualcomm camera subsystem (CAMSS) driver in the upstream kernel implements the V4L2, media controller, and V4L2 subdev interfaces.Camera sensors using the V4L2 subdev interface in the kernel are supported.The CAMSS driver consists of:
  • CSIPHY module – Handles the physical layer of the CSI2 receivers. A separate camera sensor can be connected to each CSIPHY module.
  • CSI Decoder (CSID) module – Handles the protocol and application layers of the CSI2 receivers. A CSID can decode a data stream from any CSIPHY.
  • Video Front End (VFE) module – Represents the Image Front End (IFE) that contains Raw Dump Interface (RDI) input interfaces that bypass the image processing pipeline. The VFE also contains the AXI bus interface which writes output data to memory.
The CAMSS driver implements the V4L2 interface. Each CSIPHY, CSID, and VFE module is represented by a single V4L2 sub-device.As shown in the following diagram, each CSIPHY can connect to each CSID. Each CSID can connect to each VFE. Each RDI port has an individual video node.
CAMSS V4L2 drivers are in <kernel_root>/drivers/media/platform/qcom/camss. <kernel_root> is the directory of the Linux kernel.

V4L2 sample application — Yavta

This section describes how to capture raw frame data using an application that supports the V4L2 interface.
Connect the IMX577 MIPI camera sensor to the CAM3 slot of the RB3 device.
Yavta is available by default as part of the image; no explicit installation is required.
1

Verify the CAMSS module

The IMX412 and CAMSS modules are loaded by default. Verify that the qcom_camss and IMX412 modules are loaded by running the following lsmod commands:
Verify Modules
root@rb3gen2-core-kit:/# lsmod |grep -iE "qcom_camss|imx412"
imx412                 16384  0
qcom_camss            569344  20
The expected result is that the IMX412 sensor driver and qcom_camss camera subsystem modules are loaded successfully, confirming the upstream camera stack is active.
2

Check the media node number

Run the following command to print the media device node number for the CAMSS driver.If /dev/media0 does not list the qcom-camss driver, try it with /dev/media1.
Check Media Node
# media-ctl -p -d /dev/media0 | grep camss
driver       qcom-camss
bus info     platform:acaf000.camss
3

Check the media device graph

Run the following command to check the media device graph:
Media Device Graph
media-ctl -p -d /dev/media'x'
4

Find the sensor name

Run the following command to print the sensor name to the terminal:
Find Sensor
# cat /sys/dev/char/81\:*/name | grep imx
imx577 21-001a
5

Configure the media controller

The media controller utility (media-ctrl) is a V4L2 utility used to configure camera subsystem subdevices. Use media-ctl --help to print usage information.
Replace [x] with the number found via :ref. <Check the media node number>. For example, # media-ctl -d /dev/media1 --reset.
  1. Reset all links to inactive:
    Reset Links
    # media-ctl -d /dev/media[x] --reset
    
  2. Configure the camera sensor format and resolution on pipeline nodes:
    Configure Sensor
    # media-ctl -d /dev/media[x] -V '"imx577 17-001a":0[fmt:SRGGB10/4056x3040 field:none]'
    
  3. Configure CSIPHY with 4056x3040 resolution:
    Configure CSIPHY
    # media-ctl -d /dev/media[x] -V '"msm_csiphy3":0[fmt:SRGGB10/ 4056x3040]'
    # media-ctl -d /dev/media[x] -V '"msm_csiphy3":1[fmt: SRGGB10/4056x3040]'
    
  4. Configure CSID with 4056x3040 resolution:
    Configure CSID
    # media-ctl -d /dev/media[x] -V '"msm_csid0":0[fmt:SRGGB10/4056x3040] '
    # media-ctl -d /dev/media[x] -V '"msm_csid0":1[fmt:SRGGB10/ 4056x3040]'
    
  5. Configure ISP with 3840x2160 resolution:
    Configure ISP
    # media-ctl -d /dev/media[x] -V '"msm_vfe0_rdi0":0[fmt:SRGGB10/ 4056x3040]'
    # media-ctl -d /dev/media[x] -V '"msm_vfe0_rdi0":1[fmt: SRGGB10/4056x3040]'
    
  6. Link the pipeline:
    Link Pipeline
    # media-ctl -d /dev/media[x] -l '"msm_csiphy3":1->"msm_csid0":0[1]'
    # media-ctl -d /dev/media[x] -l '"msm_csid0":1->"msm_vfe0_rdi0":0[1]'
    
6

Capture images

The Yavta test application validates the camera using the V4L2 interface. Run Yavta to capture images:
Yavta Capture
# yavta -B capture-mplane -c -I -n 5 -f SRGGB10P -s 4056x3040 -F /dev/video0 --capture=5 --file='frame-#.raw'

V4L2 sample application — libcamera

libcamera is an open-source software framework. It handles control of the V4L2 camera interface and exposes a native C++ API to upper layers. The applications and upper-level frameworks run based on the libcamera framework.See libcamera architecture for more detail about the libcamera architecture.
libcamera is validated using the cam utility.

Capture raw frame data

The following steps describe how to capture raw frame data with the camera utility app using the V4L2 interface.
Connect the IMX577 MIPI camera sensor to the CAM3 slot of the RB3 device.
libcamera is available by default as part of the image; no explicit installation is required.
1

Verify the CAMSS module

The IMX412 and CAMSS modules are loaded by default. Verify that the qcom_camss and IMX412 modules are loaded by running the following lsmod command:
Verify Modules
# lsmod | grep qcom_camss
# lsmod | grep imx412
2

Delete uncalibrated.yaml

Delete YAML
# rm -rf /usr/share/libcamera/ipa/simple/uncalibrated.yaml
3

Run the cam utility

Run cam Utility
# cam -c 1 --capture=10 --file='frame-#.raw'
This runs the utility and captures 10 raw frames in the root directory and saves them into files.Check the console log messages for information about the resolution and format of the dumped images.
Log Output
Using camera /base/soc@0/cci@ac4b000/i2c-bus@1/camera@1a as cam0 [0:15:01.067615799] [2155] INFO Camera camera.cpp:945 configuring streams:
(0) 4056x3040-SRGGB10_CSI2P
cam0: Capture 10 frames

USB camera

Qualcomm Linux devices provide driver support for USB web cameras that adhere to the USB video class (UVC) standard. The UVC video driver exposes these cameras as V4L2 video devices, which can be accessed through the character device nodes such as /dev/videoX. See USB camera configuration for an USB camera usage. The sample application gst-usb-single-camera-app can be used for USB camera validation.

Network camera

A network camera can be supported with the open source GStreamer plugin. Getting a camera stream from the network depends on the network protocols supported by the GStreamer plugin. Developers can use an open source GStreamer plugin (for example, rtspsrc) to handle camera streams from the network and create a pipeline as needed. See rtspsrc for plugin details. The sample application gst-ai-multistream-inference can also be used for network camera validation. See Bring up Ethernet for instructions on setting up an Ethernet network connection. For developing a GStreamer application on the Qualcomm platform, see Qualcomm Intelligent Multimedia SDK.