Creating a MIPI CSI Camera driver on i.MX 8MP EVK

07 Oct.,2024

 

Creating a MIPI CSI Camera driver on i.MX 8MP EVK

Hello all,

With competitive price and timely delivery, HBVCAM sincerely hope to be your supplier and partner.

I am working on porting an IMX378 camera driver to the i.MX 8MP EVK board.  I am following the i.MX 8M Plus Camera and Display Guid, section 2 Camera Sensor Porting Guide.

I have followed section 2.7 Camera Sensor Driver in V4L2 mode and I get the following dmesg output:

6.] imx378: loading out-of-tree module taints kernel.
[ 6.] enter imx378_probe
[ 6.] enter imx378_retrieve_capture_properties
[ 6.] imx378 1-001a: supply DOVDD not found, using dummy regulator
[ 6.] imx378 1-001a: supply DVDD not found, using dummy regulator
[ 6.] imx378 1-001a: supply AVDD not found, using dummy regulator
[ 6.] enter imx378_regulator_enable
[ 6.] enter imx378_set_clk_rate
[ 6.] enter imx378_power_on
[ 6.] enter imx378_reset
[ 6.] imx8_media_dev: module is from the staging directory, the quality is unknown, you have been warned.
[ 6.] enter imx378_read_reg
[ 6.] enter imx378_read_reg
[ 6.] imx378_probe camera mipi imx378, is found
[ 6.] mx8-img-md: Registered sensor subdevice: imx378 1-001a (1)
[ 6.] enter imx378_link_setup
[ 6.] mx8-img-md: created link [imx378 1-001a] => [mxc-mipi-csi2.0]
[ 6.] mxc-md 32c.bus:camera: mxc_md_create_links
[ 6.] enter viv_dwe_init_module
[ 6.] enter dwe_hw_probe
[ 6.] enter viv_isp_init_module
[ 6.] vvcam dewa74] vvcam isp driver registered
[ 7.] enter imx378_priv_ioctl (cmd = -)
[ 7.] enter imx378_query_capability

 My media-ctl output is as follows:

root@imx8mpevk:~# media-ctl -p
[ .] enter imx378_get_fmt
Media controller API version 5.10.52

Media device information
------------------------
driver mxc-md
model FSL Capture Media Device
serial
bus info
hw revision 0x0
driver version 5.10.52

Device topology
- entity 1: mxc-mipi-csi2.0 (8 pads, 1 link)
type Node subtype V4L flags 0
device node name /dev/v4l-subdev0
pad0: Sink
<- "imx378 1-001a":0 [ENABLED,IMMUTABLE]
pad1: Sink
pad2: Sink
pad3: Sink
pad4: Source
pad5: Source
pad6: Source
pad7: Source

- entity 10: imx378 1-001a (1 pad, 1 link)
type V4L2 subdev subtype Sensor flags 0
device node name /dev/v4l-subdev1
pad0: Source
[fmt:SGBRG10_1X10/x field:none]
-> "mxc-mipi-csi2.0":0 [ENABLED,IMMUTABLE]

root@imx8mpevk:~#

 At this point I can see that the I2C communication is working, however I cannot for the life of me figure out how to tell V4L2 to start the stream so I can view it.   When I list V4L2 devices I do not see a video source:

root@imx8mpevk:~# v4l2-ctl --list-devices
[ .] enter imx378_priv_ioctl (cmd = -)
[ .] enter imx378_query_capability
():
/dev/v4l-subdev0

(csi0):
/dev/v4l-subdev1

FSL Capture Media Device (platform:mxc-md):
/dev/media0

vsi_v4l2dec (platform:vsi_v4l2dec):
/dev/video1

vsi_v4l2enc (platform:vsi_v4l2enc):
/dev/video0

 What am I missing?

My DTS file is as below:

// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright  NXP
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

/dts-v1/;

#include "imx8mp-evk.dts"

&i2c2 {
	/delete-node/ov_mipi@3c;

	imx378_0: imx378_mipi@1a {
		compatible = "sony,imx378";
		reg = <0x1a>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_csi0_pwn>, <&pinctrl_csi0_rst>, <&pinctrl_csi_mclk>;
		clocks = <&clk IMX8MP_CLK_IPP_DO_CLKO2>;
		clock-names = "csi_mclk";
		assigned-clocks = <&clk IMX8MP_CLK_IPP_DO_CLKO2>;
		assigned-clock-parents = <&clk IMX8MP_CLK_24M>;
		assigned-clock-rates = <>;
		csi_id = <0>;
		pwn-gpios = <&gpio2 11 GPIO_ACTIVE_HIGH>;
		rst-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
		mclk = <>;
		mclk_source = <0>;
		status = "okay";

		port {
			imx378_mipi_0_ep: endpoint {
				data-lanes = <1 2 3 4>;
				clock-lanes = <0>;
				max-pixel-frequency = /bits/ 64 <>;
				remote-endpoint = <&mipi_csi0_ep>;
			};
		};

	};
};

&i2c3 {
	clock-frequency = <>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_i2c3>;
	status = "okay";

	ov_1: ov_mipi@3c {
		status = "disabled";
	};
};

&cameradev {
	status = "okay";
};

&isi_0 {
	status = "disabled";
};

&isi_1 {
	status = "disabled";
};

&isp_0 {
	status = "okay";
};

&dewarp {
	status = "okay";
};

&mipi_csi_0 {
	status = "okay";
	clock-frequency = <>;
	assigned-clock-rates = <>;

	port@0 {
		endpoint {
			remote-endpoint = <&imx378_mipi_0_ep>;
			data-lanes = <4>;
			csis-hs-settle = <16>;			
		};
	};
};

&mipi_csi_1 {
	status = "disabled";
};

ISI driver, and VVCAM driver Attached

Thank you,

Chris

Developer Kits with MIPI Camera And Display Support ...

Advanced high-resolution cameras and displays are at the core of many new electronic devices, enabling continuously more sophisticated vision-based services and enhanced user experiences. Integrated cameras and displays can now be found in a wide array of devices, from traditional devices such as smartphones, tablets and PCs, to a new wave of connected devices, as described in the MIPI white paper: Enabling the IoT Opportunity.

MIPI CSI-2 and DSI-2 Ecosystems

MIPI Alliance&#;s Camera Serial Interface 2 (CSI-2SM) and Display Serial Interface 2 (DSI-2SM) specifications have become de facto industry standards for connecting cameras and displays within mobile devices. The key driving factors behind the use of these specifications are their high-bandwidth performance, low power consumption and low electromagnetic interference. 

The adoption of MIPI specifications by the mobile industry has fostered interoperability between component vendors and resulted in a huge vendor community, which in turn has significantly lowered costs, widened choice, and reduced complexity for developing and integrating advanced cameras and displays within electronic devices.

Developer communities have also built up around MIPI CSI-2 and DSI-2, providing developers with software tools and other resources such as example code and drivers to help developers get started with the interfaces. 

This vibrant ecosystem is evident in the number of different single-board developer kits that support MIPI CSI-2 and DSI-2 interfaces. Leveraging the interoperability provided by these specifications, an ecosystem of specialist camera and display vendors has also emerged, offering a range of camera and display modules that developers can connect to the developer kits. 

Common Kits Supporting MIPI CSI-2 and DSI-2

The array of available MIPI compatible camera modules is staggering and includes low-, medium- and high-resolution standard cameras, monochrome infrared cameras, stereoscopic cameras and 3D time-of-flight cameras. A similarly impressive range of DSI-2 compatible displays is also available, with multiple screen sizes and resolutions. With such a range of modules to choose from, developers can easily match the perfect camera and display modules to meet their specific target use cases.

Here is a brief overview of some commonly available developer kits that support both MIPI CSI-2 and DSI-2 interfaces:

  • Raspberry Pi (All generations except Pi Zero)
    The hugely popular

    Raspberry Pi

    single-board computer, which has sold 30 million units since its inception in , has proved to be an ideal general-purpose, low-cost computing platform for students and developers alike. With all generations of the Raspberry Pi (except Pi Zero) supporting both MIPI CSI-2 and DSI-2, the Raspberry Pi can connect to a large number of different state-of-the-art cameras and displays. The current official Raspberry Pi cameras, which support 8MP and 12MP sensors, are connected via MIPI CSI-2 interfaces, while the official Raspberry Pi 7-inch, 800 x 480 pixel display is connected via a MIPI DSI-2 interface. An ecosystem of specialist camera and display retailers has been built around Raspberry Pi, supplying a range of different camera and display modules and providing reference software drivers and helpful developer forums.

  • NVIDIA Jetson TX2 and Jetson Nano
    Manufactured by

    NVIDIA

    ,

    Jetson TX2

    and

    Jetson Nano

    are two single-board computers that support both MIPI CSI-2 and DSI-2 interfaces. With powerful GPU and application CPU, these kits are targeted at application developers interested in AI and machine vision applications. Both kits support four or more CSI-2 interfaces and at least one DSI-2 interface, providing an ideal platform to test and exploit their capabilities. NVIDIA&#;s

    Jetson Wiki

    ,

    Embedded Developer Zone

    and

    Developer Forum

    The company is the world’s best 8mp Mipi Camera Module supplier. We are your one-stop shop for all needs. Our staff are highly-specialized and will help you find the product you need.

    provide a comprehensive set of developer resources to support the integration and use of CSI-2 compatible cameras and DSI-2 compatible display modules from different vendors. 

  • NXP i.MX Developer Kits

    NXP

    &#;s comprehensive range of

    i.MX

    application processors are targeted at advanced multimedia applications with high-performance and low-power consumption requirements. Their application processors are supported by a great number of i.MX developer kits, provided directly by NXP as well as a variety of other third-party vendors such as Avnet,

    Digi

    , iWave and Variscite.

    Focusing purely on the evaluation kits provided by NXP, we see that all the

    i.MX8

    and

    i.MX7

    based developer kits support at least one MIPI CSI-2 and one DSI-2 interface. To help developers, NXP provides accessory boards for its i.MX8 kits, including CSI-2 camera modules and a DSI-2 p OLED display. Supported by the

    NXP Community

    , the i.MX developer kits provide versatile platforms to develop multimedia applications that leverage the advantages of the CSI-2 and DSI-2 interfaces.

  • Qualcomm RB3 and RB5 Robotics

    Qualcomm

    &#;s

    RB3

    and soon-to-be-released

    RB5

    development kits are targeted at developers who want to create smart, power-efficient and cost-effective robots and drones with particular emphasis on machine learning and advanced computer vision. Both kits, which adhere to the

    96Boards Consumer Edition

    open hardware specification, support multiple MIPI CSI-2 and DSI-2 interfaces. The more powerful RB5 kit can connect up to seven concurrent high-resolution cameras using its CSI-2 interfaces. Qualcomm also provides a number of camera sensors for the kits, including medium- and high-resolution single camera sensors, and an advanced 3D time of flight camera. The company supports the kits with developer resources and tools, along with  additional developer support via a

    Thundercomm forum

    .

    Arduino Spartan Edge Accelerator Board
  • Arduino

    developer kits are popular among developers seeking a low-cost, easy-to-learn and simple-to-use development platform. Natively the Arduino developer kits lack the processing power to handle high-resolution cameras, which resulted in

    Seeed Studio

    developing its

    Spartan Edge Accelerator Board

    in the Arduino UNO shield form factor. The board, which is based around a powerful Xilinx Spartan-7 FPGA, supports a CSI-2 interface, allowing a multitude of CSI-2 compatible cameras to be connected and controlled by it. Developer resources are provided on Seeed Studio&#;s developer

    Wiki

    and

    Forum

    .

Other Developer Kits

The list above is not exhaustive -- there are many other developer kits that support MIPI camera and display interfaces. Other developer kits noted for supporting both CSI-2 and DSI-2 interfaces include the Asus Tinker Board, Digi ConnectCore 8M Nano, Mediatek X20, Microchip Polarfire FPGA Video and Imaging Kit, Rock960, ROCK Pi 4 and SolidRun HummingBoard Gate. It is worth noting that the Mediatek X20 and Rock960 kits, like the Qualcomm kits mentioned earlier, conform to the 96Boards Consumer Edition specification, which includes MIPI CSI-2 and DSI-2 interfaces as standard. (Review a full list of 96board Consumer Edition developer kits.).

I3C Developer Kit

While this blog focused on developer kits supporting the well-established CSI-2 and DSI-2 interfaces, MIPI I3C® will soon be supported by new developer kits coming to market. MIPI I3C is the faster, lower power, lower pin count successor of the I2C interface and is used to connect sensors and other ancillary components to an application processor.  One of the first kits supporting MIPI I3C is the NXP i.MX RT685 evaluation kit, which already supports the necessary MIPI I3C header connections.

Conclusion

It is clear that the high speed, lower power and low complexity MIPI CSI-2 and DSI-2 interfaces are widely supported by a range of different developer kits &#; from basic kits costing just a few dollars to powerful high-end kits supporting the very latest AI and machine vision capable hardware. 

In addition, all the kits described in this article are supported with high-quality developer resources including tutorials, software tools, example code and developer forums, making the MIPI CSI-2 and DSI-2 interfaces accessible to the developer community and easily leveraged for any application that requires a camera or display capability.

Example List of Developer Kits Supporting MIPI CSI-2 and/or DSI-2 Interfaces


Please note:
The inclusion of a product in this blog post does not represent an endorsement of the product by MIPI Alliance or guarantee the product&#;s compliance or conformance with MIPI specifications.

 

If you are looking for more details, kindly visit Rolling Shutter Camera.