Did Toradex Corect a mistake about UART made by NXP?

As the UART B is already used by the M4, I set up the UART E to get it work with RS485.


First, my colleague chose the pins needed for the UART E using Toradex Pinout Designer. Based on his choices I created a Device Tree.

&iomuxc {
    pinctrl_uart4: uart4-grp {                                                                                                                                                                
        fsl,pins = <                                                                                                                                                                          
            MX7D_PAD_SAI2_TX_BCLK__UART4_DTE_RX       0x79 /* SODIMM 27 */
            MX7D_PAD_SD2_DATA0__UART4_DTE_TX          0x79 /* SODIMM 23 */
            MX7D_PAD_SD2_DATA2__UART4_DTE_RTS         0x79 /* SODIMM 100 */
            MX7D_PAD_SD2_DATA3__UART4_DTE_CTS         0x79 /* SODIMM 102 */

&uart4 {                                                                                                                                                                                      
    pinctrl-names = "default";                                                                                                                                                                
    pinctrl-0 = <&pinctrl_uart4>;                                                                                                                                                             
    assigned-clocks = <&clks IMX7D_UART4_ROOT_SRC>;                                                                                                                                           
    assigned-clock-parents = <&clks IMX7D_OSC_24M_CLK>;                                                                                                                                       
    status = "okay";                                                                                                                                                                          

As we see, CTS and RTS are swithed. So I checked with a logic Analyzer.
Checking with logic Analyzer, I discovered that the Toradex Pinout Designer was right and the arch/arm/boot/dts/imx7d-pinfunc.h is wrong. I assume Toradex has corrected this without changing code provided by NXP. Am I right ?

Greetings @arnaud_infoteam!

This seems to be the case of NXP’s oftentimes confusing nomenclature for the UART pins whose function change depending on the mode used, DCE or DTE.

The nomenclature we use on the Colibri standard considers DTE mode and we try to reflect that change in all the tools, that may be the reason you found the Pinout Designer was right.

Thank you for confirming that ! We’ll be more confident to Toradex than NXP.

I would suggest to add comments like

/* Toradex use DTE mode as standard */
/* NXP sometimes has mixed up DTE and DCE mode */
/* Please rely on Toradex Pinout Designer */
#define MX7D_PAD_I2C1_SCL__UART4_DCE_CTS                          0x0148 0x03B8 0x0000 0x1 0x0
#define MX7D_PAD_I2C1_SCL__UART4_DTE_RTS                          0x0148 0x03B8 0x0708 0x1 0x0

In this file: https://git.toradex.com/cgit/linux-toradex.git/tree/arch/arm/boot/dts/imx7d-pinfunc.h?h=toradex_4.14-2.3.x-imx#n641

It confused me and a colleague for 2 days. Those kind of comments would have prevented us spending that much time. In addition it will be more clear for the future developers.

That’s good you were aware of those mistakes.

You are welcome.

Best regards,