IMX8MNEVK RS485 UART driving bus when the driver is not opened by an application

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

IMX8MNEVK RS485 UART driving bus when the driver is not opened by an application

446 Views
simon_pettersso
Contributor II

Hi!

I am trying to get half-duplex RS485 to work on our IMX8MNEVK board using the 5.4 kernel. For some reason the CTS_B pin is driven high when the driver is "idle", and only driven low (to put the RS485 tranceiver in tri-state mode) when actively listening to the bus with an application, i.e. `cat /dev/ttymxc2`. When sending data on the UART the CTS_B pin is initially high, then briefly driven low, then high again when data is shifted out, then it returns to low briefly, then it goes high again - to me this seems like when the /dev/ttymxc2 device is opened by an application the CTS_B pin behaves like it should, but as soon as it is closed it goes high and starts driving the bus without actually sending any data.

The relevant parts of the device tree are

     pinctrl_uart3: uart3grp {
        fsl,pins = <
            MX8MN_IOMUXC_ECSPI1_SCLK_UART3_DCE_RX 0x140
            MX8MN_IOMUXC_ECSPI1_MOSI_UART3_DCE_TX 0x140
            MX8MN_IOMUXC_ECSPI1_SS0_UART3_DCE_RTS_B 0x140
            MX8MN_IOMUXC_ECSPI1_MISO_UART3_DCE_CTS_B 0x140
        >;
    };

    &uart3 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_uart3>;
        assigned-clocks = <&clk IMX8MN_CLK_UART3>;
        assigned-clock-parents = <&clk IMX8MN_SYS_PLL1_80M>;
        rts-gpios;
        linux,rs485-enabled-at-boot-time;
        status = "okay";
    };

I've also made sure that the imx-sdma firmware is properly loaded

    root@uc500x:~# dmesg|grep imx-sdma
    [ 4.848190] imx-sdma 302b0000.dma-controller: loaded firmware 4.5
    [ 4.922284] imx-sdma 302c0000.dma-controller: loaded firmware 4.5
    [ 4.995468] imx-sdma 30bd0000.dma-controller: loaded firmware 4.5

Note that I tried to disable pull-up in the pinctrl by setting the MX8MN_IOMUXC_ECSPI1_MISO_UART3_DCE_CTS_B register to 0x100 but that didn't have any effect at all.

0 Kudos
0 Replies