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.
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, the firmware assumes this will be used for an XBee Cellular modem. That may cause some traffic in the port in order to detect it during boot and resume operations. Disable this feature by commenting all the entries in the following file: /lib/udev/rules.d/78-mm-digi-xbee-cellular.rules This file is installed by the modemmanager recipe append. |
-
UART3 is available on the UART connector (4-wires, RS232) with RTS/CTS lines multiplexed with CAN1 port.
-
UART5 is routed to the console connector.
Kernel configuration
You can manage the LPUART 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 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";
};