The NXP i.MX6UL has eight UART interfaces that can be used for serial communication with devices either directly or through level adapters. You can also use the RTS and CTS hardware flow-control lines.
On the ConnectCore 6UL:
-
UART1 is connected to the Bluetooth chip (on modules with Bluetooth).
-
The remaining UARTs are available for peripheral use.
The MCA in the ConnectCore 6UL system-on-module also supports one or more UARTs depending on the firmware version. See MCA UART serial port for additional information on MCA UARTs. |
On the ConnectCore 6UL SBC Express:
-
UART4 is available on the expansion connector (2-wires, TTL level).
-
UART5 is routed to the console connector.
On the ConnectCore 6UL SBC Pro:
-
UART2 is available on the UART connector (4-wires, TTL level) with RTS/CTS lines multiplexed with CAN2 port. This port is shared with the XBee interface.
By default, Digi Embedded Yocto assumes the UART routed to the XBee connector is used for connecting an XBee cellular modem. The ModemManager service generates some traffic in this UART in order to detect the XBee during boot and resume operations.
If you are not using an XBee cellular modem disable this feature by commenting all the entries in the following udev rules file: /lib/udev/rules.d/78-mm-digi-xbee-cellular.rules
If you are using a different UART to connect to the XBee socket, edit the udev rules file with the appropriate path. Note that the UART node may also change depending on the number of UARTs you enable on the device tree.
This file is installed by the modemmanager recipe append.
-
UART3 is available on the UART connector (4-wires, RS-232) with RTS/CTS lines multiplexed with CAN1 port.
-
UART5 is routed to the console connector.
Kernel configuration
You can manage the UART support through the kernel configuration options:
-
IMX serial port support (CONFIG_SERIAL_IMX)
-
Console on IMX serial port (CONFIG_SERIAL_IMX_CONSOLE)
Kernel driver
File | Description |
---|---|
IMX UART driver |
Device tree bindings and customization
The i.MX6UL UART interface device tree binding is documented at Documentation/devicetree/bindings/serial/fsl-imx-uart.txt
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 i.MX6UL serial driver includes support for the RS-485 standard. No specific kernel configuration is necessary to support RS-485 over the serial interface. The device tree bindings are documented at Documentation/devicetree/bindings/serial/rs485.txt.
RS-485 half-duplex needs the RX and TX lines for data communication and the CTS line to control the RS-485 transceiver to either drive output or receive input from outside the chip.
In i.MX6UL CPUs, the CTS line is an output of the CPU that requests the transmitter to send data (effectively RTS). The RTS line is an input of the CPU that receives requests from receivers for stopping/resuming transmission (effectively CTS). |
To enable RS-485 mode on a UART port, apply the following changes to the device tree node:
-
Add property
linux,rs485-enabled-at-boot-time
. -
Optionally add property
rs485-rts-active-high
to define CTS line polarity as ACTIVE HIGH. Default polarity is ACTIVE LOW. -
Optionally add property
rs485-rx-during-tx
to allow receiving data while sending data. -
Optionally add property
rs485-rts-delay = <a b>
to define:-
a: Delay in milliseconds between CTS line assertion and start of transmission.
-
b: Delay in milliseconds between end of transmission and CTS line de-assertion.
-
Example: Configure RS-485 port on ConnectCore 6UL SBC Pro
By default, none of the UART ports on the ConnectCore 6UL SBC Pro device tree are configured in RS-485 mode.
/* UART2 */
&uart2 {
/* RTS/CTS lines multiplexed with CAN2 */
pinctrl-0 = <&pinctrl_uart2_4wires>;
uart-has-rtscts;
linux,rs485-enabled-at-boot-time;
rs485-rts-active-high;
rs485-rx-during-tx;
rs485-rts-delay = <1 1>;
status = "okay";
};
UART user space usage
The i.MX6UL 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 i.MX6UL UART devices from user space through the device node /dev/ttymxcN, where N is the port index, starting at zero.
The MCA in the ConnectCore 6UL system-on-module also supports one or more UARTs depending on the firmware version. See MCA UART serial port for additional information on MCA UARTs.
For information about using the serial port from user space, see the Serial Programming Guide for POSIX Operating Systems.