RS485 direction control by UART RTS signal

Hi everyone,
I want to use the RTS signal of UART0 to control the state of a 485 transceiver on my custom board.
Now, I have enabled UART0 as the serial device /dev/ttyTHS1.
I use minicom to open the ttyTHS1 and send messages to my PC, that is working fine. Instead, it can’t receive any messages sent by the PC.
I noticed that RTS stays high level status all the time. This should be the cause of ttyTHS1 only being able to send.
I follow this patch, it’s supposed to force the RTS to low level status?
The change is effective, RTS stays low level status until ttyTHS1 turned on by minicom, after minicom turned on, the RTS changes to high level status and keep, which also cannot receive the message.
I think the driver in kernel/drivers/tty/serial/ may need to be modified.
I don’t know much about RS485 and serial drivers, please give me some references or suggestions.

Hi EEEXcalibur,

What’s your Jetpack version in use?

Do you enable HW flow control in your setup?

Could you send/receive data if you disable HW flow control for UART?

A1: 35.3.1
A2: How do I check that HW flow is enabled?I can only confirm that it’s not enabled in the options for minicom.
A3: In the minicom, I disable HW flow control for ttyTHS1, send data is fine.

Yes, it is configured from your serial application when you setup the serial interface. (in your case, it is minicom)

In RS485 communication, there is typically no hardware flow control like CTS/RTS signals.
I think disabling the HW flow control could meet your requirement for RS485.

Thanks for your help.
Actually, I want to control the status of the 485 transceiver by pulling up/down the RTS level state.
I guess, the original driver will only keep the RTS level in one state, I should implement the state control by myself, so where should I change the driver?

You could refer to kernel/kernel-5.10/drivers/tty/serial/serial-tegra.c for UART driver.

I got it, thanks a lot.

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