DESK-MX6UL-L/Peripherals/UART

From DAVE Developer's Wiki
< DESK-MX6UL-L
Revision as of 18:12, 27 February 2022 by U0026 (talk | contribs) (UART section update for DESK-MX6UL-L release)

Jump to: navigation, search
History
Version Issue Date Notes
1.0.0 Apr 2021 First DESK release
3.0.0 Feb 2022 3.0.0 DESK release


Peripheral UART[edit | edit source]

Device tree configuration[edit | edit source]

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

From the Carrier imx6ul-lynx-som0013-cb002f.dts device tree:

[ 1.163365] 2020000.serial: ttymxc0 at MMIO 0x2020000 (irq = 30, base_baud = 5000000) is a IMX

[ 1.923126] 21ec000.serial: ttymxc2 at MMIO 0x21ec000 (irq = 65, base_baud = 5000000) is a IMX

and from imx6ul-lynx-som0013.dtsi

		pinctrl_uart1: uart1grp {
			fsl,pins = <
				MX6UL_PAD_UART1_TX_DATA__UART1_DCE_TX 0x1b0b1
				MX6UL_PAD_UART1_RX_DATA__UART1_DCE_RX 0x1b0b1
			>;
		};

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

		pinctrl_uart2_flow: uart2grp-flow {
			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
			>;
		};

		pinctrl_uart3: uart3grp {
			fsl,pins = <
				MX6UL_PAD_UART3_TX_DATA__UART3_DCE_TX 0x1b0b1
				MX6UL_PAD_UART3_RX_DATA__UART3_DCE_RX 0x1b0b1
			>;
		};

		pinctrl_uart3_flow: uart3grp-flow {
			fsl,pins = <
				MX6UL_PAD_UART3_TX_DATA__UART3_DCE_TX 0x1b0b1
				MX6UL_PAD_UART3_RX_DATA__UART3_DCE_RX 0x1b0b1
				MX6UL_PAD_UART3_CTS_B__UART3_DCE_CTS  0x1b0b1
				MX6UL_PAD_UART3_RTS_B__UART3_DCE_RTS  0x1b0b1
			>;
		};


		pinctrl_uart3_config: uart3grp-config {
			fsl,pins = <
				MX6UL_PAD_CSI_PIXCLK__GPIO4_IO18	0x80000000 /* MPUART1_ON */
				MX6UL_PAD_SNVS_TAMPER5__GPIO5_IO05	0x80000000 /* MPUART1_DEN */
				MX6UL_PAD_SNVS_TAMPER6__GPIO5_IO06	0x80000000 /* MPUART1_RXEN */
			>;
		};

		pinctrl_uart8: uart8grp {
			fsl,pins = <
				MX6UL_PAD_LCD_DATA20__UART8_DCE_TX      0x1b0b1
				MX6UL_PAD_LCD_DATA21__UART8_DCE_RX      0x1b0b1
			>;
		};

		pinctrl_uart8_flow: uart8grp-1 {
			fsl,pins = <
				MX6UL_PAD_LCD_DATA20__UART8_DCE_TX      0x1b0b1
				MX6UL_PAD_LCD_DATA21__UART8_DCE_RX      0x1b0b1
				MX6UL_PAD_ENET2_RX_ER__UART8_DCE_RTS    0x80000000
				MX6UL_PAD_ENET2_TX_CLK__UART8_DCE_CTS   0x80000000
			>;
		};

		pinctrl_uart8_config: uart8grp-config {
			fsl,pins = <
				MX6UL_PAD_SNVS_TAMPER8__GPIO5_IO08	0x80000000 /* MPUART0_DEN */
				MX6UL_PAD_SNVS_TAMPER9__GPIO5_IO09	0x80000000 /* MPUART0_RXEN */
				MX6UL_PAD_CSI_MCLK__GPIO4_IO17		0x80000000 /* MPUART0_ON */
			>;
		};

Accessing the peripheral[edit | edit source]

Linux messages at boot time[edit | edit source]

...
...
[    1.211906] 2020000.serial: ttymxc0 at MMIO 0x2020000 (irq = 30, base_baud = 5000000) is a IMX
[    1.962230] 2024000.serial: ttymxc7 at MMIO 0x2024000 (irq = 31, base_baud = 5000000) is a IMX
[    1.974074] 21e8000.serial: ttymxc1 at MMIO 0x21e8000 (irq = 65, base_baud = 5000000) is a IMX
[    1.985128] 21ec000.serial: ttymxc2 at MMIO 0x21ec000 (irq = 66, 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 exmaple, using a loopback HW connection (RX shortcircuited to TX on UART232 port) it is possibile to test the send and receive data using the ttymxc2 device:

root@desk-mx6ul-lynx:~# stty -F /dev/ttymxc7 115200 -echo                                                                                                                                                          
root@desk-mx6ul-lynx:~# cat /dev/ttymxc7 &                                                                                                                                                                         
[1] 266
root@desk-mx6ul-lynx:~# echo "Test loopback" > /dev/ttymxc7
Test loopback

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