You are here: Digi Embedded Yocto > System development > Linux v3.14 Board Support Package > Devices and interfaces > Universal Asynchronous Receiver/Transmitter (UART)

Universal Asynchronous Receiver/Transmitter (UART)

The NXP i.MX6 CPU has five UART interfaces, all of them capable of standard RS-232 serial communication.

On the ConnectCore 6 system-on-module:

On the ConnectCore 6 SBC:

Kernel configuration

You can manage the UART driver support through the kernel configuration option:

This option is enabled as built-in on the default ConnectCore 6 SBC kernel configuration file.

Platform driver mapping

The UART driver for the i.MX6 CPU is located at drivers/tty/serial/imx.c.

Device tree bindings and customization

The i.MX6 UART interface device tree binding is documented at Documentation/devicetree/bindings/serial/fsl-imx-uart.txt.

The UART interfaces are defined in the i.MX6 CPU, ConnectCore 6 system-on-module, and ConnectCore 6 SBC device tree files.

Example: UART1

Definition of the bus

Common i.MX6 device tree
uart1: serial@02020000 {
                    compatible = "fsl,imx6q-uart", "fsl,imx21-uart";
                    reg = <0x02020000 0x4000>;
                    interrupts = <0 26 IRQ_TYPE_LEVEL_HIGH>;
                    clocks = <&clks IMX6QDL_CLK_UART_IPG>,
                         <&clks IMX6QDL_CLK_UART_SERIAL>;
                    clock-names = "ipg", "per";
                    dmas = <&sdma 25 4 0>, <&sdma 26 4 0>;
                    dma-names = "rx", "tx";
                    status = "disabled";
};

IOMUX configuration

ConnectCore 6 system-on-module device tree
uart1 {
        pinctrl_uart1: uart1 {
            fsl,pins = <
                MX6QDL_PAD_SD3_DAT6__UART1_RX_DATA 0x1b0b1
                MX6QDL_PAD_SD3_DAT7__UART1_TX_DATA 0x1b0b1
                MX6QDL_PAD_EIM_D19__UART1_CTS_B 0x1b0b1
                MX6QDL_PAD_EIM_D20__UART1_RTS_B 0x1b0b1
            >;
    };
};

Port enabling and parameters

ConnectCore 6 SBC device tree
&uart1 {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_uart1>;
    fsl,uart-has-rtscts;
    digi,pwr-en-gpio = <&gpio2 26 0>;
    status = "okay";
};

RS-485 support

RS-485 is a standard defining the electrical characteristics of drivers and receivers in balanced digital multipoint systems. RS-485 only specifies electrical characteristics of the generator and the receiver; it does not specify or recommend a communications protocol.

The Linux driver includes support for the RS-485 interface. No specific kernel configuration is necessary to support RS-485 over the serial interface. The device tree binding is documented at Documentation/devicetree/bindings/serial/rs485.txt.

RS-485 half-duplex needs the RX_DATA and TX_DATA lines for data transmission and CTS_B to control RS-485 output driver outside the chip. By default none of the UART ports on the ConnectCore 6 device tree are configured in RS-485 mode.

Note In NXP CPUs, the CTS line is an output of the CPU to request the transmitter to send data (effectively RTS) and the RTS line is an input of the CPU to receive requests from receivers for stopping/resuming transmission (effectively CTS).

Port enabling (as RS-485) and parameters

ConnectCore 6 SBC device tree
&uart5 {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_uart5>;
    status = "okay";
    rs485-rts-active-high;
    rs485-rx-during-tx;
    rs485-rts-delay = <1 1>;
    linux,rs485-enabled-at-boot-time;
};

UART user space usage

The UART bus driver exposes device data through the sysfs at /sys/class/tty/ttymxcN/, where N is the port index, starting at zero.

UART device interface

You can access UART devices from user space through the device node /dev/ttymxcN, where N is the port index, starting at zero.

For information about using the serial port from user space, refer to the Serial Programming Guide for POSIX Operating Systems.

 

© 2017 Digi International Inc. All rights reserved.
Universal Asynchronous Receiver/Transmitter (UART) updated on 24 April 2017 11:48:27 PM