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.
-
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
)
These options are enabled as built-in on the default ConnectCore 6UL kernel configuration file.
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.yaml
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.yaml
.
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-low
to define CTS line polarity as ACTIVE LOW. Default polarity is ACTIVE HIGH. -
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-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.
For information about using the serial port from user space, see the Serial Programming Guide for POSIX Operating Systems.