Testing Camera Capture
The NXP i.MX95 Technical Guide documentation from RidgeRun is presently being developed. |
Camera Kernel Support
To test camera support on the Verdin i.MX95, we are going to use an OV5640 camera sensor. This is a CSI camera module from ARDUCAM. Some of the features of this camera sensor are:
- Image Sensor: OV5640 from OmniVision
- Still Resolution: 5Megapixels
- Interface: MIPI CSI-2
- Output Format: 8-/10-bit RGB RAW, RGB, YUV, JPEG
- Max Pixel Array: 2592 x 1944 pixels
- Sensor image area: 6.287mm x 4.712 mm (7.9mm diagonal)
- Pixel Size 1.4μm x 1.4μm
- Optical Size: 1/4"
Hardware setup
The camera should include a MIPI CSI cable. This cableis used to connect it to the Verdin Development board on port X47. The right connection and orientation of the cable is in the image below:

Here is how the sensor side should look:

Device Tree Overlay
The OV5640 is not part of the default NXP BSP, but can be integrated via a device tree overlay. The Reference Multimedia Image contains some device tree overlays. Among these overlays, there is one to support this camera sensor with a certain operation frequency. To enable it, modify the file '/boot/overlays.txt to have the following contents:
fdt_overlays=verdin-imx95_dsi-to-hdmi_overlay.dtbo verdin-imx95_spidev_overlay.dtbo verdin-imx95_ov5640-27mhz_overlay.dtbo
After modifying this file, reboot' the board to apply the verdin-imx95_ov5640-27mhz_overlay.dtbo overlay.
Capture Pipeline (Media Graph)
The i.MX95 uses the Media Controller framework to describe and configure the camera pipeline. This pipeline is composed of several interconnected hardware blocks such as the CSI receiver, formatter, crossbar, and ISI.
To visualize the pipeline, you can generate a graph using:
media-ctl --print-dot > graph.dot
The resulting graph.dot file contains the information to see the media graph. To watch the graph, you can copy this file to your host PC and run:
dot -Tpng graph.dot > graph.png
The resulting png file should show a graph like the following:

As you can see the link from the camera to the CSI module is a noncontinuous line. This means this link is not enabled. We are going to enable it in the following section:
Configure Media Pipeline
Minimal Required Setup
Only 3 commands are required:
media-ctl -l "'ov5640 4-003c':0 -> 'csidev-4ad30000.csi':0 [1]" media-ctl -V "'ov5640 4-003c':0 [fmt:UYVY8_1X16/1920x1080 field:none]" v4l2-ctl -d /dev/video3 -v width=1920,height=1080,pixelformat=YUYV
- media-ctl -l
- Enables the link between the sensor and CSI receiver
- media-ctl -V
- Configures the sensor output format and resolution
- v4l2-ctl -v
- Configures the capture device (/dev/videoX)
Full Pipeline Configuration (Optional)
For non-default resolutions:
media-ctl -l "'ov5640 4-003c':0 -> 'csidev-4ad30000.csi':0 [1]" media-ctl -V "'csidev-4ad30000.csi':0 [fmt:UYVY8_1X16/1280x720 field:none]" media-ctl -V "'4ac10000.syscon:formatter@20':0 [fmt:UYVY8_1X16/1280x720 field:none]" media-ctl -V "'crossbar':2 [fmt:UYVY8_1X16/1280x720 field:none]" media-ctl -V "'mxc_isi.0':0 [fmt:UYVY8_1X16/1280x720 field:none]"
Capture Device
Available nodes:
/dev/video2 → mxc_isi.0.capture /dev/video3 → mxc_isi.1.capture
Both /dev/video2 and /dev/video3 work.
Recommended:
/dev/video3
Capture with v4l2-ctl
v4l2-ctl -d /dev/video3 --stream-mmap --stream-count=10 --stream-to=/tmp/out.yuyv <<<<<<<<<<
Each '<' represents one captured frame.
GStreamer Pipelines
Display Camera
gst-launch-1.0 v4l2src device=/dev/video3 ! video/x-raw,format=YUY2,width=1920,height=1080,framerate=30/1 ! videoconvert ! waylandsink
Save Raw Video
gst-launch-1.0 v4l2src device=/dev/video3 num-buffers=100 ! video/x-raw,format=YUY2,width=1920,height=1080 ! filesink location=out.yuyv
Encode to MP4
gst-launch-1.0 -e v4l2src device=/dev/video3 ! video/x-raw,width=1920,height=1080 ! queue ! v4l2h264enc ! h264parse ! qtmux ! filesink location=output.mp4