Invert UART TX on imx8mp

I need to invert the TX on UART1. I see the INVT bit in the UART1_UCR3 register but I don’t know the “right” way to set it in my Linux application. Can I do it through a shell with something like stty?

It can be done by editing UART node (DTE vs DCE) at the Device Tree.

Thank you. That was my assumption after digging through the uart driver. Its looking for a “fsl,inverted-tx” string which I was pretty sure goes in the device tree somewhere.

I’ve spent quite a bit of time with the device tree and device tree overlay tutorials from Toradex but I get stuck when it tells me to look in arch/… for the device tree and tools. Where is that directory? Do I need to checkout the kernel source from somewhere?


how can I set DTE mode with fsl,imx8qxp-lpuart (imx8qxp)? LPUART doesn’t seem to have fsl,dte-mode property.

The iMX8QXP has a different UART IP block and doesn’t support DCE/DTE switching.

you can use fsl,invert-tx and fsl,invert-rx if you just need to invert one or both such as is in my case.

It does not apply for lpuart (iMX8QM, IMX8QX)

Ok, so if I have a GSM modem that is DCE and expects other part to be DTE, what can I do? Or what is is by default?

Bummer. Obviously I didn’t try it, a transistor was a simpler solution in my case.

Confidential - Company Proprietary


Just connect RX line of iMX8 UART to TX line of your modem. Or check if a modem can be configured in DCE/DTE mode

The GSM module manual calls TXD an input and RXD an output, while imx8qxp manual calls TXD an output and RXD an input. This means I must connect TXD-TXD and RXD-RXD, right?

From SARA R4 manual:

UART signal names of the cellular modules conform to the ITU-T V.24 recommendation e.g. TXD line represents data transmitted by the DTE (host processor output) and received by the DCE (module input).

From imx8qxp manual:

Thank you for your help!

Are you using Colibri iMX8X or Verdin iMX8M plus? This topic was created for Verdin iMX8M plus. Please create a new thread If you are using Colibri iMX8X.