IMX6UL CSI: Difference between revisions

From Variscite Wiki
(Created page with "{{PageHeader|DART-6UL - Camera}} {{DocImage|category1=DART-6UL|category2=Yocto}} __toc__ = Testing our Parallel cameras = IMX6UL is capable of handling one parallel camera. SO...")
 
Line 1: Line 1:
{{PageHeader|DART-6UL - Camera}} {{DocImage|category1=DART-6UL|category2=Yocto}} __toc__
{{PageHeader|DART-6UL - Camera}} {{DocImage|category1=DART-6UL|category2=Yocto}} __toc__
= Testing our Parallel cameras =
= Testing our Parallel cameras =
IMX6UL is capable of handling one parallel camera. SOC has one parallel camera port, up to 24 bit and upto 148.5 MHz pixel clock.
IMX6UL is capable of handling one parallel camera. <br> SOC has one parallel camera port, up to 24 bit and upto 148.5 MHz pixel clock.<br>
— Support 24-bit, 16-bit, 10-bit, and 8-bit input
— Support 24-bit, 16-bit, 10-bit, and 8-bit input<br>
— Support BT.656 interface
— Support BT.656 interface<br>
For more details refer to  https://www.nxp.com/docs/en/reference-manual/IMX6ULRM.pdf Chapter 19. Section.<br>
For more details refer to  https://www.nxp.com/docs/en/reference-manual/IMX6ULRM.pdf Chapter 19. Section.<br>



Revision as of 00:01, 9 October 2018

DART-6UL - Camera

Testing our Parallel cameras

IMX6UL is capable of handling one parallel camera.
SOC has one parallel camera port, up to 24 bit and upto 148.5 MHz pixel clock.
— Support 24-bit, 16-bit, 10-bit, and 8-bit input
— Support BT.656 interface
For more details refer to https://www.nxp.com/docs/en/reference-manual/IMX6ULRM.pdf Chapter 19. Section.

Hardware Setup

Software Setup

Rocko/Sumo version , requires following device tree changes.

--- a/arch/arm/boot/dts/imx6ul-imx6ull-var-dart-common.dtsi
+++ b/arch/arm/boot/dts/imx6ul-imx6ull-var-dart-common.dtsi
@@ -241,11 +241,7 @@
 	xnur-gpio = <&gpio1 3 GPIO_ACTIVE_LOW>;
 	measure_delay_time = <0xffff>;
 	pre_charge_time = <0xfff>;
-#ifdef WIFI
 	status = "disabled";
-#else
-	status = "okay";
-#endif
 };
 
 /* Console UART */
@@ -275,6 +271,7 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_wdog>;
 	fsl,ext-reset-output;
+	status = "disabled";
 };
 
 &usbotg1 {
@@ -412,6 +409,26 @@
 		touchscreen-inverted-y;
 	};
 
+	ov5640: ov5640@3c {
+		compatible = "ovti,ov5640";
+		reg = <0x3c>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_csi1>;
+		clocks = <&clks IMX6UL_CLK_CSI>;
+		clock-names = "csi_mclk";
+		pwn-gpios = <&gpio1 2 1>;
+		rst-gpios = <&gpio1 1 0>;
+		csi_id = <0>;
+		mclk = <24000000>;
+		mclk_source = <0>;
+		status = "okay";
+		port {
+			ov5640_ep: endpoint {
+				remote-endpoint = <&csi1_ep>;
+			};
+		};
+	};
+
 	/* DS1337 RTC module */
 	rtc@0x68 {
 		compatible = "dallas,ds1337";
@@ -423,6 +440,16 @@
 	};
 };
 
+&csi {
+	status = "okay";
+
+	port {
+		csi1_ep: endpoint {
+			remote-endpoint = <&ov5640_ep>;
+		};
+	};
+};
+
 &iomuxc {
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_hog_1>;
@@ -658,6 +685,25 @@
 				MX6UL_PAD_GPIO1_IO08__WDOG1_WDOG_B	0x78b0
 			>;
 		};
+
+		pinctrl_csi1: csi1grp {
+			fsl,pins = <
+				MX6UL_PAD_CSI_MCLK__CSI_MCLK		0x1b090
+				MX6UL_PAD_CSI_PIXCLK__CSI_PIXCLK	0x1b088
+				MX6UL_PAD_GPIO1_IO08__CSI_VSYNC		0x1b088
+				MX6UL_PAD_GPIO1_IO09__CSI_HSYNC		0x1b088
+				MX6UL_PAD_CSI_DATA00__CSI_DATA02	0x1b088
+				MX6UL_PAD_CSI_DATA01__CSI_DATA03	0x1b088
+				MX6UL_PAD_CSI_DATA02__CSI_DATA04	0x1b088
+				MX6UL_PAD_CSI_DATA03__CSI_DATA05	0x1b088
+				MX6UL_PAD_CSI_DATA04__CSI_DATA06	0x1b088
+				MX6UL_PAD_CSI_DATA05__CSI_DATA07	0x1b088
+				MX6UL_PAD_CSI_DATA06__CSI_DATA08	0x1b088
+				MX6UL_PAD_CSI_DATA07__CSI_DATA09	0x1b088
+				MX6UL_PAD_GPIO1_IO01__GPIO1_IO01	0x1b0b0
+				MX6UL_PAD_GPIO1_IO02__GPIO1_IO02	0x1b0b0
+			>;
+		};
 	};
 };
== Camera Probe ==

Make sure the camera is connected, and boot the board.
Then, run the below command to verify the camera was detected successfully:

# v4l2-ctl --list-devices

This should output below

i.MX6S_CSI (platform:30710000.csi):
        /dev/video1

pxp (pxp_v4l2_out):
        /dev/video0

In the output seen above, "i.MX6S_CSI" is the camera, and "pxp" is the i.MX Pixel Processing Pipeline.

i.MX platform specific gstreamer plugins

Run below command to verify you have the DART-6UL/6ULL platform specific gstreamer plugins installed on your system:

# gst-inspect-1.0  | grep "imx"
imxpxp:  imxpxpvideotransform: Freescale PxP video transform
imxpxp:  imxpxpvideosink: Freescale PxP video sink
imxv4l2videosrc:  imxv4l2videosrc: V4L2 CSI Video Source
imxaudio:  imxmp3audioenc: Freescale i.MX MP3 encoder
imxaudio:  imxuniaudiodec: Freescale i.MX uniaudio decoder

Gstreamer example 1: Testing Camera Loopback / Camera preview on the display

The below pipelines are suitable for the fslc based Yocto releases for the (Yocto Morty and newer).

  • For 640x480@30fps:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=0 ! imxpxpvideosink
  • For 720x480@30fps:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=1 ! imxpxpvideosink
  • For 1280x720@30fps :
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=2 ! imxpxpvideosink
  • For 1920x1080@30fps:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=3 ! imxpxpvideosink
  • For 2592x1944@15fps:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=4 ! imxpxpvideosink

Gstreamer example 2: Taking a JPEG snapshot from the camera

To capture and encode a JPEG snapshot from the camera, run one of the below pipelines depending on the wanted resolution:

  • For 640x480:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=0 num-buffers=1 ! jpegenc ! filesink location=/tmp/test.jpg
  • For 720x480:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=1 num-buffers=1 ! jpegenc ! filesink location=/tmp/test.jpg
  • For 1280x720:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=2 num-buffers=1 ! jpegenc ! filesink location=/tmp/test.jpg
  • For 1920x1080:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=3 num-buffers=1 ! jpegenc ! filesink location=/tmp/test.jpg
  • For 2592x1944:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=4 num-buffers=1 ! jpegenc ! filesink location=/tmp/test.jpg

References