How to force the UART0_RTS pin as low state

My environment:
Jetson Xavier NX SOM

  • our customized carried board
  • 32.7.3 Jetson Linux SDK

I want to contrl S485 RTS with software, and RTS should be high when send data.
But now it state is always high,and turn low when send data.

I found someone has the same problem in the past , but this topic do not work fine for me.

Uart flow control on Jetson Nano:

Hi Xzz,

Do you mean the UART hw flow control not work?

RTS seems to be controlled from the CTS of your UART device, and it will be low when the bus is busy.

Could you share the block diagram of your connections?
and also the steps how you verify this?

the UART hw flow control is work normal,
but my hardware environment need opposite voltage state.
We need RTS always pulling down ,and staight high when TX send data.

This is the timing diagrame.

What’s your use case to have this requirement?
Is that caused from the UART device?

It seems the protocol issue with opposite behavior.

Thanks fo your reply,
We want to use RTS to control rs485 devices. And the hardware need rts opposite state.

What’s more , I found the same topic, but the patch do not work for me.

I guess this is not a issue, but our hardware requires the opposite state. And I dont know how to change RTS .

It seems the different use case as yours.
Your RTS could work but you want the opposite behavior.

Could you try if the following modification in driver work in your case?

diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c
index 2288840e5e42..ec8e1686a02d 100644
--- a/drivers/tty/serial/serial-tegra.c
+++ b/drivers/tty/serial/serial-tegra.c
@@ -215,7 +215,7 @@ static void set_rts(struct tegra_uart_port *tup, bool active)
        unsigned long mcr;
        mcr = tup->mcr_shadow;
-       if (active)
+       if (!active)
                mcr |= TEGRA_UART_MCR_RTS_EN;
                mcr &= ~TEGRA_UART_MCR_RTS_EN;

Thank you for help! Sorry for late reply, I have just finished my vacation.
I will try this patch soon.

Sorry for late,
after aply this patch and reflash, my board keeps restarting repeatedly.
Because I imported many new commits at the same time, so it took me a longer time to locate this patch.

Here is the log.
反复重启无法进系统.log (120.1 KB)

For the boot failed issue, please open another topic to check.
I would suggest you apply the change one by one so that you could know which one cause the issue.

Hi ,KevinFFF,
It’s strange that after one by one check the commit, this patch cause the system hung up, please check it again.

It seems not work with that change.
Could you try to use level shift for your use case? since RTS is controlled by your UART devices (pull low when busy) rather than from host side.

Hi, KevinFFF,
Although our hardware need rts opposite state.
We have changed the RTS pin default active direction with update hardware. And it works fine.

But whether can we change the RTS pin direction with update software?

Hi,KevinFFF, If sdk can’t control RTS opposite direction,
just give us a reply as end, that is ok.

Please share the result of the following command on your board.

$ sudo busybox devmem 0x03110020 //UART_IRDA_CSR_0

It should be possible to control RTS polarity with above register.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.