The i.MX95 SoC provides:

  • Two Camera Sensor Interface (CSI) modules (one of them shared with MIPI DSI)

  • Image Signal Processing (ISP) on the camera stream

Available camera interfaces

On the ConnectCore 95 SMT SOM:

  • The two MIPI CSI-2 module lines are available on the LGA pads:

    • MIPI CSI1 (4 lanes available).

    • MIPI DSICSI1 (4 lanes available). This interface is multiplexed with MIPI DSI (both cannot be used at the same time).

On the ConnectCore 95 SMARC SOM:

  • Four lanes of the first MIPI CSI-2 module are routed to CSI1 interface of the SMARC connector.

  • Four lanes of the second MIPI CSI-2 module (multiplexed with MIPI DSI) are routed to the SMARC connector as follows:

    • DATA0 and DATA1 lanes are routed to CSI0_RX0 and CSI0_RX1 lanes of the SMARC connector.

    • DATA2 and DATA3 lanes are routed to HDMI_D1 and HDMI_D2 lanes of the SMARC connector.

On the ConnectCore 95 Development Kit:

  • CSI1 interface of the SMARC connector is routed to:

    • A 22-pin MIPI CSI-2 FFC connector (4 data lanes)

    • A 15-pin MIPI CSI-2 FFC connector (2 data lanes)

Camera connection

The BSP includes support for:

  • Digilent Pcam 5C MIPI camera (Omnivision OV5640 sensor)

  • NXP EXPI-OS08A20 camera (Omnivision OS08A20 sensor)

Connect Digilent Pcam 5C MIPI camera

Ensure that the correct cable is used and properly oriented when connecting the MIPI camera to the ConnectCore 95 Development Kit. Incorrect cable selection or improper orientation may cause permanent damage to the camera.

For ConnectCore 95 Development Kit, use a 15 pin, 1mm pitch FFC cable with contacts on bottom on both sides. Pin 1 of the ConnectCore 95 Development Kit connector aligns with pin 1 of the camera connector.

ConnectCore 95 Development Kit MIPI camera connection

Connect NXP EXPI-OS08A20 camera

Ensure that the correct cable is used and properly oriented when connecting the MIPI camera to the ConnectCore 95 Development Kit. Incorrect cable selection or improper orientation may cause permanent damage to the camera.

For ConnectCore 95 Development Kit, use a 22 pin, 0.5mm pitch FFC cable with contacts on bottom on both sides. Pin 1 of the ConnectCore 95 Development Kit connector aligns with pin 1 of the camera connector.

ConnectCore 95 Development Kit MIPI camera connection

Kernel configuration

You can manage the CSI driver support and Video4Linux (V4L2) capture driver through the following kernel configuration options:

  • NXP i.MX95 CSI Pixel Formatter Driver (CONFIG_VIDEO_IMX_CSI_FORMATTER)

  • NXP NEO ISP v4l2 hardware driver (CONFIG_VIDEO_NXP_NEOISP)

  • Freescale i.MX9 DPHY Rx (CONFIG_PHY_FSL_IMX9_DPHY_RX)

  • DesignWare Cores MIPI CSI-2 receiver found on i.MX93 (CONFIG_VIDEO_DWC_MIPI_CSIS)

  • OmniVision OV5640 sensor support (CONFIG_VIDEO_OV5640)

  • OmniVision raw sensor support OX05B1S (CONFIG_VIDEO_OX05B1S)

These options are enabled as built-in on the default ConnectCore 95 kernel configuration file.

Kernel driver

The drivers for CSI capture are located at:

File Description

drivers/media/platform/nxp/imx-csi-formatter.c

NXP i.MX95 CSI Pixel Formatter Driver

drivers/media/platform/nxp/neoisp/

NXP NEO ISP v4l2 hardware driver

drivers/phy/freescale/phy-fsl-imx9-dphy-rx.c

Freescale i.MX9 DPHY Rx

drivers/media/platform/nxp/dwc-mipi-csi2.c

DesignWare Cores MIPI CSI-2 receiver found on i.MX93

drivers/media/platform/nxp/imx8-isi/

Image Sensing Interface driver

drivers/media/i2c/ov5640.c

OmniVision OV5640 sensor support

drivers/media/i2c/ox05b1s/

OmniVision raw sensor support OX05B1S

Device tree bindings and customization

Digi provides two pre-compiled device tree overlays, so that you can test the camera interface without needing to recompile a device tree:

The device tree overlays provide a reference implementation that:

  • Declares the camera sensor.

  • Enables the MIPI CSI components (MIPI port, pixel formatter, ISI, ISP).

  • Configures the IOMUX (if any CPU GPIO is required).

To enable a camera device tree overlay, append the overlay to the overlays environment variable in U-Boot, for example:

=> setenv overlays ccimx95-dvk_expi-os08a20-cam.dtbo,${overlays}

See Device tree files and overlays for more information.

Use the camera

Identify the camera capture devices

Camera configuration and operation is divided between several interconnected subdevices, called entities, sharing video data.

You can use the media-ctl tool to obtain the full camera subsystem topology, a list of subdevices, the connections between them, and some additional postprocessing operations that can be performed on the fly such as cropping or downscaling:

# media-ctl -p
Media controller API version 6.6.52

Media device information
------------------------
driver          neoisp
model           neoisp
serial
bus info        platform:4ae00000.isp
hw revision     0x2
driver version  6.6.52

Device topology
- entity 1: neoisp (6 pads, 6 links, 0 routes)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev0
        pad0: Sink
                <- "neoisp-input0":0 [ENABLED,IMMUTABLE]
        pad1: Sink
                <- "neoisp-input1":0 []
        pad2: Sink
                <- "neoisp-params":0 [ENABLED]
        pad3: Source
                -> "neoisp-frame":0 [ENABLED]
        pad4: Source
                -> "neoisp-ir":0 []
        pad5: Source
                -> "neoisp-stats":0 [ENABLED]


	[...]


- entity 38: neoisp-stats (1 pad, 1 link)
             type Node subtype V4L flags 0
             device node name /dev/video16
        pad0: Sink
                <- "neoisp":5 [ENABLED]

Alternatively, you can create a dot graph using the same tool to have a visual representation of the whole camera subsystem:

# media-ctl --print-dot > graph.dot

Use your host PC to convert the graph.dot file to a PNG image:

$ dot -Tpng -Nfontname=Roboto -Nfontsize=10 -Efontname=Roboto -Efontsize=10 graph.dot > graph.png
ConnectCore 95 camera topology

This graph, generated by the media-ctl tool, shows the different video pipes the data can flow through, from the camera sensor on the top (source) to the Linux video devices on the bottom (sink).

This step is required before you run any capture with the camera.

Configure the video path that will flow from the camera sensor to the Linux video devices with the desired resolution and format.

  1. Reset all media links

    # media-ctl -r
  2. Set a local variable FORMAT with format and resolution (in this example, raw video at 1280x720):

    # FORMAT=UYVY8_1X16/1280x720
  3. Establish links between the media entities and configure the format and frame size they will operate at:

    # media-ctl -d platform:4ad50000.isi -l '"ov5640 2-003c":0->"csidev-4ad30000.csi":0 [1]'
    # media-ctl -d platform:4ad50000.isi -l '"csidev-4ad30000.csi":1->"4ac10000.syscon:formatter@20":0 [1]'
    # media-ctl -d platform:4ad50000.isi --set-v4l2 "'ov5640 2-003c':0[fmt:${FORMAT} field:none]"
    # media-ctl -d platform:4ad50000.isi --set-v4l2 "'csidev-4ad30000.csi':0 [fmt:${FORMAT} field:none]"
    # media-ctl -d platform:4ad50000.isi --set-v4l2 "'4ac10000.syscon:formatter@20':0 [fmt:${FORMAT} field:none]"
    # media-ctl -d platform:4ad50000.isi --set-v4l2 "'crossbar':2 [fmt:${FORMAT} field:none]"
    # media-ctl -d platform:4ad50000.isi --set-v4l2 "'mxc_isi.0':0 [fmt:${FORMAT} field:none]"
    # media-ctl -d platform:4ad50000.isi --set-v4l2 "'mxc_isi.1':0 [fmt:${FORMAT} field:none]"
    # media-ctl -d platform:4ad50000.isi --set-v4l2 "'mxc_isi.2':0 [fmt:${FORMAT} field:none]"
    # media-ctl -d platform:4ad50000.isi --set-v4l2 "'mxc_isi.3':0 [fmt:${FORMAT} field:none]"
    # media-ctl -d platform:4ad50000.isi --set-v4l2 "'mxc_isi.4':0 [fmt:${FORMAT} field:none]"
    # media-ctl -d platform:4ad50000.isi --set-v4l2 "'mxc_isi.5':0 [fmt:${FORMAT} field:none]"
    # media-ctl -d platform:4ad50000.isi --set-v4l2 "'mxc_isi.6':0 [fmt:${FORMAT} field:none]"
    # media-ctl -d platform:4ad50000.isi --set-v4l2 "'mxc_isi.7':0 [fmt:${FORMAT} field:none]"

Preview a camera image using gstreamer

To get a camera preview:

  1. Configure the media links (see Configure the media links).

  2. Capture the camera image and preview it using gstreamer and Wayland sink:

    # gst-launch-1.0 v4l2src device=/dev/video2 ! video/x-raw,format=YUY2,width=1280,height=720,framerate=30/1 ! videoconvert ! autovideosink

Take a picture with the camera using gstreamer

Capture a still image with the camera and save it using gstreamer:

# gst-launch-1.0 v4l2src device=/dev/video2 num-buffers=5 ! video/x-raw,width=1280,height=720 ! jpegenc ! multifilesink location="sample.jpg" max-files=1
The command takes five frames but only saves the last. Discarding the first four eliminates undesired frames on cameras that have auto-exposure.

To show the captured image using gstreamer:

# gst-launch-1.0 filesrc location=sample.jpg ! jpegdec ! imagefreeze ! waylandsink

Record a video with the camera using gstreamer

Capture a moving image with the camera and save it using gstreamer:

# gst-launch-1.0 v4l2src device=/dev/video2 num-buffers=300 ! video/x-raw,format=YUY2,width=1280,height=720,framerate=30/1 ! queue ! v4l2h264enc ! h264parse ! avimux ! filesink location=output.avi

To play the recorded video:

# gplay-1.0 output.avi