MIPI-CSI2 Camera Bringup

Hello,
I’m having trouble testing the OV5640 camera module with the iMX8QM with the Apalis Evaluation Board. Based on the MIPI-CSI2 OV5640 software support topic in this forum I would have expected the camera module to work out of the box, but that doesn’t seem to be the case.

I’ve noticed that both the OV5640 I2C device and CSI1 are disabled in the device-tree by default. Enabling them does expose a MIPI-CSI device in sysfs, but the boot log generates the following error: ov5640_mipi 2-003c: clock-frequency missing or invalid.

What do I need to do in order to get the OV5640 to function?

Hi

Does this entry help?
What is the exact version of your camera module?

Max

The board itself only has Rev 1.1 printed on it, but the purchase order was for a v1.1Z board.

That explains why I’m seeing that error message in the boot log. I must still be missing something though, the commands listed in MIPI-CSI2 OV5640 software support both fail.

 gst-launch-1.0 v4l2src device='/dev/video4' ! video/x-raw,format=RGB16,width=1920,height=1080,framerate=30/1 ! ximagesink sync=false synchronous=true max-lateness=10 async=false

yields the following error:

ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
Additional debug info:
../../../../git/libs/gst/base/gstbasesrc.c(2939): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)

And

gst-launch-1.0 v4l2src device='/dev/video4' ! video/x-raw,format=RGB16,width=1920,height=1080,framerate=30/1 ! glimagesink

results in a segfault.

I apologize if I’m missing something simple here, this is my first foray into MIPI-CSI and gstreamer.

Hi

There should be a sticker at the back of the camera module denoting the full version.
The only difference between the A and the Z stuffing version is that V1.1Z has an additional oscillator assembled.

Could you check if you either have the sticker or if OSC1 is assembled to make sure you really got the V1.1Z?

Why do you think that in the device-tree the OV5640 I2C device and CSI1 are disabled?
The two nodes have their status set to okay.

For me, with the original image, no altered device-tree or anything I get the following during boot:

root@apalis-imx8:~# dmesg | grep ov5640                                         
[    2.714901] camera ov5640_mipi is found, ret: 0                              
[    2.802296] mx8-img-md: Registered sensor subdevice: ov5640_mipi_nv 2-003c (1
)                                                                               
[    2.888270] mx8-img-md: created link [ov5640_mipi_nv 2-003c] => [mxc-mipi-csi
2.1]                                                                            

Note that the pipelines require access to the X-Server, so if you are on the serial console you have to set the DISPLAY variable:

export DISPLAY=:0

At least the second pipeline works for me:

gst-launch-1.0 v4l2src device='/dev/video4' ! video/x-raw,format=RGB16,width=1920,height=1080,framerate=30/1 ! glimagesink

For the first one I had to add an the additonal plugin imxvideoconvert_g2d, e.g.:

gst-launch-1.0 v4l2src device='/dev/video4' ! video/x-raw,format=RGB16,width=1920,height=1080,framerate=30/1 ! imxvideoconvert_g2d ! ximagesink sync=false synchronous=true max-lateness=10 async=false

Max

Hi Max,
The Camera board is indeed marked as v1.1Z on the sticker, and OSC1 is populated.
The original, unmodified fsl-imx8qm-apalis.dtb device tree in the boot partition of the SD card I received with the iMX8 SOM contains the following entries when decompiled using the dtc tool:

csi@58247000 {
    compatible = "fsl,mxc-mipi-csi2";
	reg = <0x0 0x58247000 0x0 0x1000 0x0 0x58241000 0x0 0x1000>;
	interrupts = <0xa 0x4>;
	interrupt-parent = <0x74>;
	clocks = <0x4 0x11b 0x4 0x121 0x4 0x123 0x4 0x1f3>;
	clock-names = "clk_apb", "clk_core", "clk_esc", "clk_pxl";
	assigned-clocks = <0x4 0x121 0x4 0x123>;
	assigned-clock-rates = <0x15752a00 0x44aa200>;
	power-domains = <0x1e>;
	status = "disabled";
	#address-cells = <0x1>;
	#size-cells = <0x0>;
	virtual-channel;

	port@1 {
		reg = <0x1>;

		endpoint {
			remote-endpoint = <0x75>;
			data-lanes = <0x1 0x2 0x3 0x4>;
			linux,phandle = <0x87>;
			phandle = <0x87>;
		};
	};
};

and

i2c@5a830000 {
	compatible = "fsl,imx8qm-lpi2c", "fsl,imx7ulp-lpi2c";
	reg = <0x0 0x5a830000 0x0 0x4000>;
	interrupts = <0x0 0xdf 0x4>;
	interrupt-parent = <0x1>;
	clocks = <0x4 0x9c 0x4 0x9a>;
	clock-names = "per", "ipg";
	assigned-clocks = <0x4 0x9c>;
	assigned-clock-rates = <0x16e3600>;
	power-domains = <0x84>;
	status = "okay";
	#address-cells = <0x1>;
	#size-cells = <0x0>;
	clock-frequency = <0x186a0>;
	pinctrl-names = "default";
	pinctrl-0 = <0x85>;

	ov5640_mipi@3c {
		compatible = "ovti,ov5640_mipi";
		pinctrl-names = "default";
		pinctrl-0 = <0x86>;
		reg = <0x3c>;
		pwn-gpios = <0x81 0x9 0x0>;
		rst-gpios = <0x81 0x8 0x1>;
		ipu_id = <0x0>;
		csi_id = <0x1>;
		mclk = <0x16e3600>;
		mclk_source = <0x0>;
		status = "disabled";

		port {

			endpoint {
				remote-endpoint = <0x87>;
				data-lanes = <0x1 0x2 0x3 0x4>;
				linux,phandle = <0x75>;
				phandle = <0x75>;
			};
		};
	};
};

Marcel it appears you were correct. Updating to the latest image did the trick.

Thanks for your help guys!

You’re probably still on beta 1 please update to beta 2.

Hello…i had the same trouble while me and my partner was working on a project. We have assigned DSI pins to CSI2 pins of MIPI CSI2 Rx subsystem block in the PL. Now could we able to connect the camera in those pins. Since those pins from HP bank of the zynq ultrascale device.

surface mount assembly

Please note that hijacking old questions is discouraged and one should rather ask a new question including as much information as possible.

Please further note that this community is about Toradex products and at least so far we do not have any Zynq Ultrascale offerings and are therefore unable to help you.

https://www.toradex.com/community/page/howto.html