IMX6UL CSI: Difference between revisions
Line 181: | Line 181: | ||
To capture and encode a JPEG snapshot from the camera, run one of the below pipelines depending on the wanted resolution: | To capture and encode a JPEG snapshot from the camera, run one of the below pipelines depending on the wanted resolution: | ||
* For 640x480 | * For 640x480: | ||
# 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 | # 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 | * For 320x240: | ||
# 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 | # 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 | * For 720x480: | ||
# 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 | # 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 | * For 720x576: | ||
# 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 | # 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 | * For 1280x720: | ||
# 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 | # 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 | * For 1920x1080: | ||
# 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 | # 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 | * For 2592x1944: | ||
# 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 | # 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 | ||
Revision as of 19:50, 1 November 2018
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
The 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 to boot from an external SD card.
We strongly recommend using only the RX & TX lines of the Debug UART in your board design.
Requirements for the Camera test:
- EVK with the C127 capacitor removed (C127 is located near the Coin Cell battery connector)
- Camera Adapter Board
Software Setup
The following device tree patch adds camera support for the DART-6UL:
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
>;
};
};
Follow either the "Customizing the Linux kernel" or "Build the Linux kernel from source code" Wiki pages to build the updated device tree and to copy it to your board.
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:
[ 7.443605] CSI: Registered sensor subdevice: ov5640 1-003c [ 7.447903] camera ov5640, is found
You can also run the below command to verify the camera was detected successfully:
# v4l2-ctl --list-devices
The output should look like this:
i.MX6S_CSI (platform:30710000.csi): /dev/video1 pxp (pxp_v4l2_out): /dev/video0
"i.MX6S_CSI" is the camera, and "pxp" is the i.MX Pixel Processing Pipeline.
i.MX platform specific gstreamer plugins
Run the below command to verify you have the i.MX6UL/L 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@7.5fps:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1 imx-capture-mode=5 fps-n=15 ! imxpxpvideosink
- For 2592x1944@7.5fps:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1 imx-capture-mode=6 fps-n=7 ! 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 ! 'video/x-raw,format=UYVY' ! jpegenc ! filesink location=/tmp/test.jpg
- For 320x240:
# 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:
# 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:
# 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:
# 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:
# 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:
# 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