IMX6UL CSI
Testing Parallel camera interface
The i.MX6UL/L is capable of handling one parallel camera.
The 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
Camera VSYNC line is in use on the EVK.
It is used as WDOG Output to force POR and disconnect DEBUG_UART_RTS_B line on Watch Dog event. Allowing boot from external SD card.
We strongly recommend using only RX, TX lines of Debug UART in designs.
- EVK required with C127 capacitor removed (C127 is located near Coin Cell battery connector)
- Camera Adapter Board is required for the test
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..dbe7530 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 */
@@ -291,12 +287,6 @@
status = "okay";
};
-&wdog1 {
- pinctrl-names = "default";
- pinctrl-0 = <&pinctrl_wdog>;
- fsl,ext-reset-output;
-};
-
&usbotg1 {
dr_mode = "host";
disable-over-current;
@@ -436,6 +426,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 +457,16 @@
};
};
+&csi {
+ status = "okay";
+
+ port {
+ csi1_ep: endpoint {
+ remote-endpoint = <&ov5640_ep>;
+ };
+ };
+};
+
&iomuxc {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_hog_1>;
@@ -711,9 +731,22 @@
>;
};
- pinctrl_wdog: wdoggrp {
+ pinctrl_csi1: csi1grp {
fsl,pins = <
- MX6UL_PAD_GPIO1_IO08__WDOG1_WDOG_B 0x78b0
+ 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
>;
};
};
- Copy above code, and paste to patch file
- Compile the device tree changes as per: Customizing the Linux kernel
- Update your kernel device tree and filesystem as per: * Burning Yocto binaries to NAND flash/eMMC via SD card
Camera probe
Make sure the camera is connected, and boot the board.
If the camera is detected, you should see the 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
- For 1920x1080@7fps:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1 imx-capture-mode=5 fps-n=15 ! 'video/x-raw,format=UYVY,width=1920,height=1080,framerate=15/1' ! imxpxpvideosink
- For 2592x1944@7fps
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1 imx-capture-mode=6 fps-n=7 ! 'video/x-raw,format=UYVY,width=2592,height=1944,framerate=7/1' ! 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
- For 1920x1080@7fps:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1 imx-capture-mode=5 fps-n=15 num-buffers=1 ! 'video/x-raw,format=UYVY' ! jpegenc ! filesink location=/tmp/test.jpg
- For 2592x1944@7fps
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1 imx-capture-mode=6 fps-n=7 num-buffers=1 ! 'video/x-raw,format=UYVY' ! jpegenc ! filesink location=/tmp/test.jpg