IMX6UL CSI: Difference between revisions

From Variscite Wiki
Line 7: Line 7:


== Hardware Setup ==
== Hardware Setup ==
* EVK : https://www.variscite.com/products/single-board-computers/var-6ulcustomboard/ requires one <TBD> Capacitor removed. Please remove the C<TBD>
* EVK : https://www.variscite.com/products/single-board-computers/var-6ulcustomboard/ requires one capacitor removed. Please remove the C127
* https://www.variscite.com/products/accessories/var-ext-cb6ul/ is required with camera<br>
* https://www.variscite.com/products/accessories/var-ext-cb6ul/ is required with camera<br>



Revision as of 13:33, 9 October 2018

DART-6UL - Camera

Testing Parallel camera interface

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.

diff --git a/arch/arm/boot/dts/imx6ul-imx6ull-var-dart-common.dtsi b/arch/arm/boot/dts/imx6ul-imx6ull-var-dart-common.dtsi
index f9170af..846c7ba 100644
--- a/arch/arm/boot/dts/imx6ul-imx6ull-var-dart-common.dtsi
+++ b/arch/arm/boot/dts/imx6ul-imx6ull-var-dart-common.dtsi
@@ -261,11 +261,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 */
@@ -293,7 +289,6 @@
 
 &wdog1 {
 	pinctrl-names = "default";
-	pinctrl-0 = <&pinctrl_wdog>;
 	fsl,ext-reset-output;
 };
 
@@ -436,6 +431,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";
@@ -447,6 +462,16 @@
 	};
 };
 
+&csi {
+	status = "okay";
+
+	port {
+		csi1_ep: endpoint {
+			remote-endpoint = <&ov5640_ep>;
+		};
+	};
+};
+
 &iomuxc {
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_hog_1>;
@@ -716,6 +741,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.
If the camera is detected, you should see below output during bootup

[    4.346295] udevd[200]: starting udev-3.2.5
[    5.781666] 1-003c supply DOVDD not found, using dummy regulator
[    5.818277] 1-003c supply DVDD not found, using dummy regulator
[    5.873060] 1-003c supply AVDD not found, using dummy regulator
[    7.443605] CSI: Registered sensor subdevice: ov5640 1-003c
[    7.447903] camera ov5640, is found

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 Rocko and newer).

  • For 640x480@30fps:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=0 ! imxpxpvideosink
  • For 320x240@30fps:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=1 ! imxpxpvideosink
  • For 720x480@30fps:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=2 ! imxpxpvideosink
  • For 720x576@30fps:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=3 ! imxpxpvideosink
  • For 1280x720@30fps:
# 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@30fps:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=0 num-buffers=1 ! 'video/x-raw,format=UYVY' ! jpegenc ! filesink location=/tmp/test.jpg

  • For 320x240@30fps:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=1 num-buffers=1 ! 'video/x-raw,format=UYVY' ! jpegenc ! filesink location=/tmp/test.jpg
  • For 720x480@30fps:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=2 num-buffers=1 ! 'video/x-raw,format=UYVY' ! jpegenc ! filesink location=/tmp/test.jpg
  • For 720x576@30fps:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=3 num-buffers=1 ! 'video/x-raw,format=UYVY' ! jpegenc ! filesink location=/tmp/test.jpg
  • For 1280x720@30fps:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=4 num-buffers=1 ! 'video/x-raw,format=UYVY' ! jpegenc ! filesink location=/tmp/test.jpg

References