Last edited 2 months ago

Camera sensors hardware components

Applicable for STM32MP13x lines, STM32MP15x lines, STM32MP21x lines, STM32MP23x lines, STM32MP25x lines


1. Article purpose[edit | edit source]

The purpose of this article is to:

  • List the camera sensors hardware components that might be integrated in the different boards.
  • Link these components to the corresponding software framework(s).
  • Point to the appropriate component datasheets.
  • Explain, when necessary, how to configure these components.
Info white.png Information
Some of these hardware components are part of the accessories for STM32 boards like the B-CAMS-IMX and the B-CAMS-OMV for instance.

2. Software frameworks[edit | edit source]

Domain Peripheral Software components Comment
OP-TEE Linux STM32Cube
Visual OmniVision OV5640 V4L2 camera framework Camera sensor with parallel and MIPI® CSI-2 interfaces (5MPixels, integrated ISP)
Visual GalaxyCore GC2145 V4L2 camera framework Camera sensor with parallel and MIPI® CSI-2 interfaces (2MPixels, integrated ISP)
Visual Sony IMX335 V4L2 camera framework Camera sensor with MIPI® CSI-2 interface (5MPixels, Raw Bayer)

3. OmniVision OV5640[edit | edit source]

The OmniVision OV5640 camera sensor supports both parallel and MIPI® CSI-2 interfaces.

For details and the datasheet please contact the OV5640 provider.

Info white.png Information
This camera sensor can be found:

Note: Please refer to the application note STM32MP135 line interfacing with a MIPI® CSI-2 camera (AN5478) for more details.

3.1. Linux driver[edit | edit source]

Bindings: Documentation/devicetree/bindings/media/i2c/ovti,ov5640.yaml

Sources: drivers/media/i2c/ov5640.c

Devicetree examples:

...
&dcmi {
	status = "okay";
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&dcmi_pins_a>;
	pinctrl-1 = <&dcmi_sleep_pins_a>;
	/*
	 * Enable DMA-MDMA chaining by adding a SRAM pool and
	 * a MDMA channel
	 */
	sram = <&dcmi_pool>;

	dmas = <&dmamux1 75 0x400 0x01>, <&mdma1 0 0x3 0x1200000a 0 0>;
	dma-names = "tx", "mdma_tx";

	port {
		dcmi_0: endpoint {
			remote-endpoint = <&ov5640_0>;
			bus-type = <MEDIA_BUS_TYPE_PARALLEL>;
			bus-width = <8>;
			hsync-active = <0>;
			vsync-active = <0>;
			pclk-sample = <1>;
			pclk-max-frequency = <77000000>;
		};
	};
};
...
&i2c2 {
...
	ov5640: camera@3c {
		compatible = "ovti,ov5640";
		reg = <0x3c>;
		clocks = <&clk_ext_camera>;
		clock-names = "xclk";
		AVDD-supply = <&v2v8>;
		DOVDD-supply = <&v2v8>;
		DVDD-supply = <&v2v8>;
		powerdown-gpios = <&stmfx_pinctrl 18 (GPIO_ACTIVE_HIGH | GPIO_PUSH_PULL)>;
		reset-gpios = <&stmfx_pinctrl 19 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>;
		rotation = <180>;
		status = "okay";

		port {
			ov5640_0: endpoint {
				remote-endpoint = <&dcmi_0>;
				bus-width = <8>;
				data-shift = <2>; /* lines 9:2 are used */
				hsync-active = <0>;
				vsync-active = <0>;
				pclk-sample = <1>;
				pclk-max-frequency = <77000000>;
			};
		};
	};
...
...
&dcmipp {
	status = "okay";
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&dcmipp_pins_a>;
	pinctrl-1 = <&dcmipp_sleep_pins_a>;
	port {
		dcmipp_0: endpoint {
			remote-endpoint = <&mipid02_2>;
			bus-width = <8>;
			hsync-active = <0>;
			vsync-active = <0>;
			pclk-sample = <0>;
			pclk-max-frequency = <120000000>;
		};
	};
};
...
&i2c5 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&i2c5_pins_a>;
	pinctrl-1 = <&i2c5_sleep_pins_a>;
	i2c-scl-rising-time-ns = <170>;
	i2c-scl-falling-time-ns = <5>;
	clock-frequency = <400000>;
	status = "okay";
	/* spare dmas for other usage */
	/delete-property/dmas;
	/delete-property/dma-names;

	stmipi: stmipi@14 {
		compatible = "st,st-mipid02";
		reg = <0x14>;
		status = "okay";
		clocks = <&clk_mco1>;
		clock-names = "xclk";
		VDDE-supply = <&scmi_v1v8_periph>;
		VDDIN-supply = <&scmi_v1v8_periph>;
		reset-gpios = <&mcp23017 2 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>;

		ports {
			#address-cells = <1>;
			#size-cells = <0>;
			port@0 {
				reg = <0>;

				mipid02_0: endpoint {
					data-lanes = <1 2>;
					lane-polarities = <0 0 0>;
					remote-endpoint = <&gc2145_ep>;
				};
			};
			port@2 {
				reg = <2>;

				mipid02_2: endpoint {
					bus-width = <8>;
					hsync-active = <0>;
					vsync-active = <0>;
					pclk-sample = <0>;
					remote-endpoint = <&dcmipp_0>;
				};
			};
		};
	};

	gc2145: gc2145@3c {
		compatible = "galaxycore,gc2145";
		reg = <0x3c>;
		clocks = <&clk_ext_camera>;
		iovdd-supply = <&scmi_v3v3_sw>;
		avdd-supply = <&scmi_v3v3_sw>;
		dvdd-supply = <&scmi_v3v3_sw>;
		powerdown-gpios = <&mcp23017 3 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>;
		reset-gpios = <&mcp23017 4 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>;
		status = "okay";

		port {
			gc2145_ep: endpoint {
				remote-endpoint = <&mipid02_0>;
				clock-lanes = <0>;
				data-lanes = <1 2>;
				link-frequencies = /bits/ 64 <120000000 192000000 240000000>;
			};
		};
	};

	ov5640: camera@3c {
		compatible = "ovti,ov5640";
		reg = <0x3c>;
		clocks = <&clk_ext_camera>;
		clock-names = "xclk";
		DOVDD-supply = <&scmi_v3v3_sw>;
		status = "disabled";
		powerdown-gpios = <&mcp23017 3 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>;
		reset-gpios = <&mcp23017 4 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>;

		port {
			ov5640_0: endpoint {
				/*remote-endpoint = <&mipid02_0>;*/
				clock-lanes = <0>;
				data-lanes = <1 2>;
			};
		};
	};
...

4. GalaxyCore GC2145[edit | edit source]

The GalaxyCore GC2145 camera sensor supports both parallel and MIPI® CSI-2 interfaces.

For details and the datasheet please contact GalaxyCore.

Info white.png Information
This camera sensor can be found:

Note: Please refer to the application note STM32MP135 line interfacing with a MIPI® CSI-2 camera (AN5478) for more details.

4.1. Linux driver[edit | edit source]

Bindings: Documentation/devicetree/bindings/media/i2c/galaxycore,gc2145.yaml

Sources: drivers/media/i2c/gc2145.c

Devicetree example: arch/arm/boot/dts/st/stm32mp135f-dk.dts

...
&dcmipp {
	status = "okay";
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&dcmipp_pins_a>;
	pinctrl-1 = <&dcmipp_sleep_pins_a>;
	port {
		dcmipp_0: endpoint {
			remote-endpoint = <&mipid02_2>;
			bus-width = <8>;
			hsync-active = <0>;
			vsync-active = <0>;
			pclk-sample = <0>;
			pclk-max-frequency = <120000000>;
		};
	};
};
...
&i2c5 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&i2c5_pins_a>;
	pinctrl-1 = <&i2c5_sleep_pins_a>;
	i2c-scl-rising-time-ns = <170>;
	i2c-scl-falling-time-ns = <5>;
	clock-frequency = <400000>;
	status = "okay";
	/* spare dmas for other usage */
	/delete-property/dmas;
	/delete-property/dma-names;

	stmipi: stmipi@14 {
		compatible = "st,st-mipid02";
		reg = <0x14>;
		status = "okay";
		clocks = <&clk_mco1>;
		clock-names = "xclk";
		VDDE-supply = <&scmi_v1v8_periph>;
		VDDIN-supply = <&scmi_v1v8_periph>;
		reset-gpios = <&mcp23017 2 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>;

		ports {
			#address-cells = <1>;
			#size-cells = <0>;
			port@0 {
				reg = <0>;

				mipid02_0: endpoint {
					data-lanes = <1 2>;
					lane-polarities = <0 0 0>;
					remote-endpoint = <&gc2145_ep>;
				};
			};
			port@2 {
				reg = <2>;

				mipid02_2: endpoint {
					bus-width = <8>;
					hsync-active = <0>;
					vsync-active = <0>;
					pclk-sample = <0>;
					remote-endpoint = <&dcmipp_0>;
				};
			};
		};
	};

	gc2145: gc2145@3c {
		compatible = "galaxycore,gc2145";
		reg = <0x3c>;
		clocks = <&clk_ext_camera>;
		iovdd-supply = <&scmi_v3v3_sw>;
		avdd-supply = <&scmi_v3v3_sw>;
		dvdd-supply = <&scmi_v3v3_sw>;
		powerdown-gpios = <&mcp23017 3 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>;
		reset-gpios = <&mcp23017 4 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>;
		status = "okay";

		port {
			gc2145_ep: endpoint {
				remote-endpoint = <&mipid02_0>;
				clock-lanes = <0>;
				data-lanes = <1 2>;
				link-frequencies = /bits/ 64 <120000000 192000000 240000000>;
			};
		};
	};

	ov5640: camera@3c {
		compatible = "ovti,ov5640";
		reg = <0x3c>;
		clocks = <&clk_ext_camera>;
		clock-names = "xclk";
		DOVDD-supply = <&scmi_v3v3_sw>;
		status = "disabled";
		powerdown-gpios = <&mcp23017 3 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>;
		reset-gpios = <&mcp23017 4 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>;

		port {
			ov5640_0: endpoint {
				/*remote-endpoint = <&mipid02_0>;*/
				clock-lanes = <0>;
				data-lanes = <1 2>;
			};
		};
	};
...

5. Sony IMX335[edit | edit source]

The Sony IMX335 camera sensor is a 5 Mega Pixels Raw Bayer sensor with MIPI® CSI-2 interface. Depending on number of CSI-2 lanes used, it can output RAW10 or RAW12.

For details and the datasheet please contact the IMX335 provider.

Info white.png Information
This camera sensor can be found on MB1854 camera daughterboard used in the B-CAMS-IMX STM32 accessory.

5.1. Linux driver[edit | edit source]

Bindings: Documentation/devicetree/bindings/media/i2c/sony,imx335.yaml

Sources: drivers/media/i2c/imx335.c

Devicetree examples:

...
&csi {
	vdd-supply =  <&scmi_vddcore>;
	vdda18-supply = <&scmi_v1v8>;
	status = "okay";
	ports {
		#address-cells = <1>;
		#size-cells = <0>;
		port@0 {
			reg = <0>;
			csi_sink: endpoint {
				remote-endpoint = <&imx335_ep>;
				data-lanes = <1 2>;
				bus-type = <4>;
			};
		};
		port@1 {
			reg = <1>;
			csi_source: endpoint {
				remote-endpoint = <&dcmipp_0>;
			};
		};
	};
};

&dcmipp {
	status = "okay";
	port {
		dcmipp_0: endpoint {
			remote-endpoint = <&csi_source>;
			bus-type = <4>;
		};
	};
};
...
&i2c2 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&i2c2_pins_a>;
	pinctrl-1 = <&i2c2_sleep_pins_a>;
	i2c-scl-rising-time-ns = <100>;
	i2c-scl-falling-time-ns = <13>;
	clock-frequency = <400000>;
	status = "okay";
	/* spare dmas for other usage */
	/delete-property/dmas;
	/delete-property/dma-names;

	imx335: camera@1a {
		compatible = "sony,imx335";
		reg = <0x1a>;
		clocks = <&clk_ext_camera>;
		avdd-supply = <&scmi_v3v3>;
		ovdd-supply = <&scmi_v3v3>;
		dvdd-supply = <&scmi_v3v3>;
		reset-gpios = <&gpioi 7 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>;
		powerdown-gpios = <&gpioi 0 (GPIO_ACTIVE_HIGH | GPIO_PUSH_PULL)>;
		status = "okay";

		port {
			imx335_ep: endpoint {
				remote-endpoint = <&csi_sink>;
				clock-lanes = <0>;
				data-lanes = <1 2>;
				link-frequencies = /bits/ 64 <594000000>;
			};
		};
	};
...
};

6. To go further[edit | edit source]

Related articles: