DART-6UL UART

From Variscite Wiki
Revision as of 14:10, 6 April 2017 by Eran (talk | contribs)
DART-6UL - External UART

Test

By default, Variscite configured UART1, ttymxc2. to test:

Use minicom to connect.
Set the serial to ttymxc2.
You can use a loopback or connect to anther computer.
The pin's are coming out from J9 connector.

Example: configure UART4, ttymxc3

In the kernel source code, edit the following device tree file:
arch/arm/boot/dts/imx6ul-imx6ull-var-dart-common.dtsi
(In earlier releases the file is named: arch/arm/boot/dts/imx6ul-var-dart.dtsi)

Look for:

/* ttymxc2 UART */
&uart3 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_uart3>;
	fsl,uart-has-rtscts;
	status = "okay";
};

Duplicate it and change the name and the pinctrl name. For Example:

&uart4 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_uart4>;
	fsl,uart-has-rtscts;
	status = "okay";
};

Duplicate the corresponding pinctrl. Copy :

		pinctrl_uart2: uart2grp {
			fsl,pins = <
				MX6UL_PAD_UART2_TX_DATA__UART2_DCE_TX	0x1b0b1
				MX6UL_PAD_UART2_RX_DATA__UART2_DCE_RX	0x1b0b1
				MX6UL_PAD_UART2_CTS_B__UART2_DCE_CTS	0x1b0b1
				MX6UL_PAD_UART2_RTS_B__UART2_DCE_RTS	0x1b0b1
			>;
		};

Into:

		pinctrl_uart4: uart4grp {
			fsl,pins = <
                                MX6UL_PAD_UART4_TX_DATA__UART4_DCE_TX   0x1b0b1
                                MX6UL_PAD_UART4_RX_DATA__UART4_DCE_RX   0x1b0b1
				MX6UL_PAD_ENET1_RX_DATA1__UART4_DCE_CTS	0x1b0b1
				MX6UL_PAD_ENET1_RX_DATA0__UART4_DCE_RTS	0x1b0b1
			>;
		};

Note: The pins here were set arbitrarily. You should set them based on your hardware design, and make sure they are not conflicting with other devices in the device tree.

Continue following the "Build Linux from source code" guide to build only the device trees and to copy them to your SD card.

Use UART3 for console (instead of UART1)

In the following example we change the debug port to UART3.
Other UART ports can be used, similarly.

For Debian, the only changes needed are in U-Boot.

Note:
See the notes on pages 6 & 7 on the dart-6ul customboard schematics file:
http://www.variscite.com/images/stories/DataSheets/DART-6UL/VAR-6UL_CUSTOMBOARD_SCH_V1_23_Doc_V1_8.pdf

- "Pull down resistor and delay circuitry is added on DEBUG_UART_RTS_B to allow reboot
   from SD Card using POR signal, since DEBUG_UART_RTS_B is used as SD1_CD_B by Boot ROM.

   In case DEBUG_UART_RTS_B signal is not required, the delay mechanism is redundant and can be depopulated.
   DEBUG_UART_RTS_B however should be always pulled down to ground using a 10K resistor to simulate SD Card detect."

- "Watchdog circuitry is required for proper SW reboot!"

Changes needed in U-Boot

diff --git a/board/variscite/mx6ul_var_dart/mx6ul_var_dart.c b/board/variscite/mx6ul_var_dart/mx6ul_var_dart.c
index 63a75ec..9d70851 100755
--- a/board/variscite/mx6ul_var_dart/mx6ul_var_dart.c
+++ b/board/variscite/mx6ul_var_dart/mx6ul_var_dart.c
@@ -162,9 +162,9 @@ int dram_init(void){
 }
 
 
-static iomux_v3_cfg_t const uart1_pads[] = {
-	MX6_PAD_UART1_TX_DATA__UART1_DCE_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
-	MX6_PAD_UART1_RX_DATA__UART1_DCE_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
+static iomux_v3_cfg_t const uart3_pads[] = {
+	MX6_PAD_UART3_TX_DATA__UART3_DCE_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
+	MX6_PAD_UART3_RX_DATA__UART3_DCE_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
 };
 
 static iomux_v3_cfg_t const usdhc1_pads[] = {
@@ -253,7 +253,7 @@ static void setup_gpmi_nand(void)
 
 static void setup_iomux_uart(void)
 {
-	imx_iomux_v3_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads));
+	imx_iomux_v3_setup_multiple_pads(uart3_pads, ARRAY_SIZE(uart3_pads));
 }
 
 static struct fsl_esdhc_cfg usdhc_cfg[2] = {
diff --git a/include/configs/mx6ul_var_dart.h b/include/configs/mx6ul_var_dart.h
index 5313d17..88bc1a0 100755
--- a/include/configs/mx6ul_var_dart.h
+++ b/include/configs/mx6ul_var_dart.h
@@ -55,7 +55,7 @@
 #define CONFIG_MXC_GPIO
 
 #define CONFIG_MXC_UART
-#define CONFIG_MXC_UART_BASE		UART1_BASE
+#define CONFIG_MXC_UART_BASE		UART3_BASE
 
 /* MMC Configs */
 #ifdef CONFIG_FSL_USDHC
@@ -169,7 +169,7 @@
         BOOT_ENV_SETTINGS \
 	"script=boot.scr\0" \
 	"image=zImage\0" \
-	"console=ttymxc0\0" \
+	"console=ttymxc2\0" \
 	"fdt_high=0xffffffff\0" \
 	"initrd_high=0xffffffff\0" \
 	"var_auto_fdt_file=Y\0" \

You can follow the "Build U-Boot from source code" guide to get the U-Boot source code and build it.

Changes needed in Yocto

Edit the file: sources/meta-variscite-imx/conf/machine/imx6ul-var-dart.conf
and change the line:
SERIAL_CONSOLE = "115200 ttymxc0"
to:
SERIAL_CONSOLE = "115200 ttymxc4"

(or you can change it on the target in /etc/inittab)