The NXP i.MX8QXP Cortex A35 has four LPUART interfaces that can be used for serial communication with devices either directly or through level adapters.

On LPUART0, LPUART1, and LPUART3 you can use the RTS and CTS hardware flow-control lines, while LPUART2 is only two-wires (RX/TX).

The NXP i.MX8QXP Cortex M4 has one additional UART interface for general purpose.

LPUART interfaces don’t support 7-bit transfers with no parity; so 7-bit transfers have to be done using odd or even parity.

On the ConnectCore 8X system-on-module:

  • LPUART1 is connected to the Bluetooth chip (on modules with Bluetooth).

  • LPUART0, LPUART2, and LPUART3 are available for peripheral use.

  • M4 UART0 is available for peripheral use.

On the ConnectCore 8X SBC Express:

  • LPUART0 is routed to the XBee socket (four wires: RX/TX/RTS/CTS), multiplexed with CAN0.

  • LPUART2 is routed to the console connector (two wires: RX/TX).

  • LPUART3 is routed to the Raspberry Pi expansion connector (two wires: RX/TX), multiplexed with M4 UART.

  • M4 UART is routed to the Raspberry Pi expansion connector (two wires: RX/TX), multiplexed with LPUART3.

Castellated pads 70 (SCU_GPIO0_00) and 71 (SCU_GPIO0_01) that carry M4 UART/LPUART3 RX/TX signals, come from the System Controller Unit (SCU) power domain and are thus powered at 1.8V. There is a level shifter on the SBC Express board to adapt these lines to 3.3V before they reach the Raspberry Pi expansion connector. Additionally, 0-ohm resistors have been added in case you want to bypass the level shifter and route the 1.8V lines directly to the connector.

On the ConnectCore 8X SBC Pro:

  • LPUART0 is routed to the expansion connector (four wires: RX/TX/RTS/CTS), multiplexed with CAN0.

  • LPUART2 is routed to the console connector (two wires: RX/TX).

  • LPUART3 is routed to the expansion connector through an RS-485 transceiver with A and B differential lines and is multiplexed with CAN2.

    See RS-485 support for details on RS-485 configuration.

By default, the BSP assumes the UART routed to the XBee connector will be used for an XBee Cellular modem. That may cause some traffic in the UART in order to detect the XBee during boot and resume operations. If you are not using an XBee disable this feature by commenting all the entries in the following udev rules file: /lib/udev/rules.d/78-mm-digi-xbee-cellular.rules

This file is installed by the modemmanager recipe append.

Kernel configuration

You can manage the LPUART support through the kernel configuration options:

  • Freescale lpuart serial port support (CONFIG_SERIAL_FSL_LPUART)

  • Console on Freescale lpuart serial port (CONFIG_SERIAL_FSL_LPUART_CONSOLE)

Kernel driver

File Description

drivers/tty/serial/fsl_lpuart.c

LPUART driver

Device tree bindings and customization

The i.MX8QXP Cortex A35 LPUART interface device tree binding is documented at Documentation/devicetree/bindings/tty/serial/fsl-lpuart.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.MX8QXP 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 RTS line to control the RS-485 transceiver to either drive output or receive input from outside the chip.

By default, only LPUART3 on the ConnectCore 8X SBC Pro device tree is configured in RS-485 mode:

  • LPUART3 is routed to the ConnectCore 8X SBC Pro expansion connector through an RS-485 transceiver with A and B differential lines and is multiplexed with CAN2.

  • Port requires CAN/RS485# signal to select between the CAN and RS485 transceivers. To select the RS-485 transceiver, CAN/RS485# signal needs to be driven low. This is handled automatically through the pinctrl-assert-gpios device tree entry.

  • Port requires rs485-enabled-at-boot-time device tree entry to enable RS-485 functionality.

  • RS-485 protocol requires an RTS line to control transfer direction. On the ConnectCore 8X SBC Pro LPUART3 native RTS line is routed to the microSD card so a different GPIO (RS485_RE#/DE = GPIO3_IO24) is routed to the RS485 transceiver instead. To use a regular GPIO for driving the RS485 transceiver use the device tree property digi,rts-gpio. Using a regular GPIO for driving the RS485 transceiver also requires disabling DMA on the UART. To disable DMA remove the device tree properties dmas and dma-names.

    ConnectCore 8X SBC Pro device tree
    /*
     * LPUART3 on expansion header.
     * Conflicts with CAN2.
     * Requires signal CAN/RS485# (GPIO3_IO23) to be driven low
     */
    &lpuart3 {
    	pinctrl-names = "default";
    	pinctrl-0 = <&pinctrl_lpuart3>,
    		    <&pinctrl_flexcan3_lpuart3_gpios>;
    	pinctrl-assert-gpios = <&gpio3 23 GPIO_ACTIVE_LOW>;
    	linux,rs485-enabled-at-boot-time;
    	/* Disable DMA on this port to let 'digi,rts-gpio' functionality work */
    	/delete-property/dmas;
    	/delete-property/dma-names;
    	digi,rts-gpio = <&gpio3 24 GPIO_ACTIVE_HIGH>;
    	status = "disabled";
    };

These are the LPUART driver limitations for RS-485:

  • rs485-rts-delay and rs485-rx-during-tx device tree entries are not supported.

  • If using digi,rts-gpio functionality, DMA has to be disabled on the port.