DESK-MX6UL-L/Peripherals/UART

From DAVE Developer's Wiki
Jump to: navigation, search
History
Issue Date Notes

2021/07/20

First DESK-MX6UL-L release

2022/03/16

DESK-MX6UL-L 3.0.0 release

2023/05/04

DESK-MX6UL-L 4.0.0 release
2024/08/07 DESK-MX6UL-L 4.2.x release


Peripheral UART[edit | edit source]

Device tree configuration[edit | edit source]

AXEL ULite SOM[edit | edit source]

Here below is an example of device tree configuration used on standard DAVE's kit for the AXEL ULite SOM:

From the Carrier imx6ul-axelulite-cb003a.dts device tree:

&uart3 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_uart3>;
        status = "okay";
};
...
...
&iomuxc {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_hog_gpios>;

        imx6ul-axelulite {
...
...
        uart {
                pinctrl_uart3: uart3grp {
                        fsl,pins = <
                                MX6UL_PAD_UART3_RX_DATA__UART3_DCE_RX   0x1b0b1
                                MX6UL_PAD_UART3_TX_DATA__UART3_DCE_TX   0x1b0b1
                        >;
                };
        };
...
...

RIALTO SBC[edit | edit source]

Here below is an example of device tree configuration used on standard DAVE's kit for the RIALTO SBC:

From the SOMimx6ul-lynx-som0022.dtsi device tree:

...
...
&uart3 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_uart3>;
	status = "disabled";
};
...
...
&iomuxc {
...
...

		pinctrl_uart3: uart3grp {
			fsl,pins = <
				MX6UL_PAD_UART3_TX_DATA__UART3_DCE_TX 0x1b0a1
				MX6UL_PAD_UART3_RX_DATA__UART3_DCE_RX 0x1b0a1
			>;
		};
...
...
		pinctrl_uart2: uart2grp {
			fsl,pins = <
				MX6UL_PAD_UART2_TX_DATA__UART2_DCE_TX 0x1b0a1
				MX6UL_PAD_UART2_RX_DATA__UART2_DCE_RX 0x1b0a1
			>;
		};
...
...

From the Carrier imx6ul-lynx-som0022-cb0090.dts device tree:

...
...
/* RS485 on J3 of RTIN add-on */
&uart2 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_uart2>;
	status = "okay";
};

/* RS232 on J67 */
&uart3 {
	status = "okay";
};

/* RS485 on J4 of RTIN add-on */
&uart5 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_uart5>;
	status = "okay";
};
...
...
&iomuxc {
...
...

		pinctrl_uart5: uart5grp {
			fsl,pins = <
				MX6UL_PAD_GPIO1_IO04__UART5_DCE_TX	0x1b0a1
				MX6UL_PAD_GPIO1_IO05__UART5_DCE_RX	0x1b0a1
			>;
		};
...
...
		pinctrl_uart2: uart2grp {
			fsl,pins = <
				MX6UL_PAD_UART2_TX_DATA__UART2_DCE_TX 0x1b0a1
				MX6UL_PAD_UART2_RX_DATA__UART2_DCE_RX 0x1b0a1
			>;
		};

...
...

Accessing the peripheral in AXEL ULite SOM[edit | edit source]

Linux messages at boot time[edit | edit source]

...
...
[    0.569198] 2020000.serial: ttymxc0 at MMIO 0x2020000 (irq = 30, base_baud = 5000000) is a IMX
[    1.344706] 21ec000.serial: ttymxc2 at MMIO 0x21ec000 (irq = 65, base_baud = 5000000) is a IMX
...
...

Usage with stty[edit | edit source]

N.B. UART mapping respect to ttymxcX is the following one:

UART1 <-> ttymxc0
UART2 <-> ttymxc1
UART3 <-> ttymxc2
UART4 <-> ttymxc3
UART5 <-> ttymxc4
UART6 <-> ttymxc5
UART7 <-> ttymxc6
UART8 <-> ttymxc7
...


For example, using a loopback HW connection (RX short-circuited to TX on UART232 port) it is possible to test the send and receive data using the ttymxc2 device:

root@desk-mx6ul-axelulite:~# stty -F /dev/ttymxc2 115200 -echo
root@desk-mx6ul-axelulite:~# cat /dev/ttymxc2 &
[1] 267
root@desk-mx6ul-axelulite:~# echo "Test loopback" > /dev/ttymxc2
Test loopback


Accessing the peripheral in RIALTO SBC[edit | edit source]

Linux messages at boot time[edit | edit source]

...
...
[    1.332721] 21e8000.serial: ttymxc1 at MMIO 0x21e8000 (irq = 65, base_baud = 5000000) is a IMX
[    1.343551] 21ec000.serial: ttymxc2 at MMIO 0x21ec000 (irq = 66, base_baud = 5000000) is a IMX
[    1.354436] 21f4000.serial: ttymxc4 at MMIO 0x21f4000 (irq = 67, base_baud = 5000000) is a IMX
...
...

Usage with stty[edit | edit source]

N.B. UART mapping respect to ttymxcX is the following one:

UART1 <-> ttymxc0
UART2 <-> ttymxc1
UART3 <-> ttymxc2
UART4 <-> ttymxc3
UART5 <-> ttymxc4
UART6 <-> ttymxc5
UART7 <-> ttymxc6
UART8 <-> ttymxc7
...


For example, to use UART232, using a loopback HW connection (RX short-circuited to TX on UART232) it is possible to test the send and receive data using the ttymxc2 device:

root@desk-mx6ul-rialto:~# stty -F /dev/ttymxc2 115200 -echo
root@desk-mx6ul-rialto:~# cat /dev/ttymxc2 &
[1] 313
root@desk-mx6ul-rialto:~# echo "Test loopback RS232" > /dev/ttymxc2
root@desk-mx6ul-rialto:~# Test loopback RS232

For example, to use UART485, using a loopback HW connection (RX short-circuited to TX of UART285 on J3 and J4 of RTIN add-on ) it is possible to test the send and receive data using the ttymxc1 and ttymxc4 device:

root@desk-mx6ul-rialto:~# stty -F /dev/ttymxc1 115200 -echo
root@desk-mx6ul-rialto:~# stty -F /dev/ttymxc4 115200 -echo
root@desk-mx6ul-rialto:~# cat /dev/ttymxc4 &
[2] 316
root@desk-mx6ul-rialto:~# cat /dev/ttymxc1 &
[3] 317
root@desk-mx6ul-rialto:~# echo "Send message from ttymxc1 to ttymxc4!" > /dev/ttymxc1
Send message from ttymxc1 to ttymxc4!
root@desk-mx6ul-rialto:~# echo "Send message from ttymxc4 to ttymxc1!" > /dev/ttymxc4
Send message from ttymxc4 to ttymxc1!

Additional information[edit | edit source]

Serial ports can be used through the standard serial programming API.

For detailed information, please refer to the Serial Programming HOWTO at Serial-Programming-HOWTO