Hello,
I want to use the modbus rtu protocol on our designed linux board-imx8mp Soc, so I need to enable the rs485 line in half-duplex. I have a few questions about this subject.
In the device tree, the rs485 connection is defined as follows
&uart3 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart3>;
uart-has-rtscts;
rts-gpios = <&gpio2 10 GPIO_ACTIVE_LOW>;
cts-gpios = <&gpio2 11 GPIO_ACTIVE_LOW>;
status = "ok";
};
//Halfduplex
we are using ISO3086DW as a rs485 transciver
Connection is diagram listed below
uart3 Tx -------> rs485 transciver D
uart3 Rx -------> rs485 transive R
rts and cts pins are not connected.
GPIO0 -------> rs485 transciver's DE
GPIO1 -------> rs485 transciver's RE
I can transfer data from the RS485 line by controlling the RE and DE pins with custom gpio0 and gpio1. But I am experiencing connection timeout problem with Modbus RTU.
1.) Is there a convenient way to control Transmit and Receive directions?
2.) Should I connect the rts pins to the DE pin of the transciver and the uart driver should automatically control the transmit or receive direction
3.) Should I connect the cts pin to the RE pin of the transciver?