This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi TI Team,
We developing our custom board based on AM62A SK EVM. We wan to interface the THVD1454 RS485 Transceiver with AM62Ax processor. Below is the rough hardware design.
As per THVD1454 datasheet, DE pin will regulate the direction of transmit and receive of data as RE pin is short with DE. Can we use DE pin as rts-gpio and handle it automatically from the Linux driver?
I found am335x-nano.dts reference where RTS GPIO is defined( I am not sure that it is used for RS485 but guessing that it would be used for RS485).
&uart1 { pinctrl-names = "default"; pinctrl-0 = <&uart1_pins>; status = "okay"; rts-gpio = <&gpio0 13 GPIO_ACTIVE_HIGH>; rs485-rts-active-high; rs485-rx-during-tx; rs485-rts-delay = <1 1>; linux,rs485-enabled-at-boot-time; };
Can same be done for the AM62Ax processor to control DE using rts-gpio?
Will UART's RTS able to control the DE line for transmit and receive automatically?
Regards,
Jay
Hi Jay,
The kernel driver uses the RTS pin to control the RS485 DE pin when the UART works in the RS485 mode. The driver supports both native UART RTS pin or GPIO RTS (defined as rts-gpio in device tree).
So you can use either the native UART RTS pin or a GPIO pin to control the RS485 DE pin.
Hi Bin Liu,
Thank you for your prompt reply.
As per uart node compatible property in dts for AM62Ax processor, compatible = "ti,am64-uart", "ti,am654-uart"; , drivers/tty/serial/8250/8250_omap.c driver will be used by uart interface. "rts-gpio" functionality are define in the drivers/tty/serial/omap-serial.c driver and this driver is not used by uart interface.
So, I have doubt that will "rts-gpio" functionality will work with 8250_omap.c driver or not?
Please help me to clarify the above confusion.
Regards,
Jay
Hi Jay,
Please check the kernel doc Documentation/devicetree/bindings/serial/8250.yaml, which defines rts-gpios (BTY, it is "rts-gpios", not "rts-gpio"). rts-gpios is handled in the 8250 core driver, not in 8250 omap driver, but 8250 omap driver uses 8250 core driver.
Does your board have the UART native RTS pined out? I personally prefer to use the native RTS pin to control the RS485 DE instead of rts-gpios. In older version of kernels, GPIO based RTS handling was often broken in the kernel UART drivers.
Hi Bin Liu,
Thank you for pointing out the 8250.yaml document.
Yes, we have RTS pin of uart connected with DE pin of RS485 IC. As you mention, we have decide to control DE pin with native RTS pin of uart. Is the dts entry of uart5 (AM62A SK EVM) is correct to control DE pin with native RTS pin of uart?
main_uart5_pins_default: main-uart5-pins-default { pinctrl-single,pins = < AM62AX_IOPAD(0x1d8, PIN_INPUT, 1) /* (B17) MCAN0_TX.UART5_RXD */ AM62AX_IOPAD(0x1dc, PIN_OUTPUT, 1) /* (C18) MCAN0_RX.UART5_TXD */ AM62AX_IOPAD(0x004, PIN_OUTPUT, 5) /* (K22) OSPI0_LBCLKO.UART5_RTSn */ >; }; &main_uart5 { status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&main_uart5_pins_default>; linux,rs485-enabled-at-boot-time; };
I took reference of Documentation/devicetree/bindings/serial/rs485.yaml document file. I am configuring the RTS pins as RTS(not as gpio) and not using the CTS pin.
Regards,
Jay