Recently, we often encounter customers using i.MXRT for RS485 communication. Mostly the problem of receiving and sending direction conversion in the process of using. Taking iMXRT1050 and SN65HVD11QDR as examples, The document introduces the LPUART to RS485 circuit and the method of transceiver control. The working principle is as follows:
LPUART TXD: Transmit Data
LPUART RXD: Receive Date
LPUART RTS_B: Request To Send
The main control methods are as follows:
1 Use TXD signal line to do hardware automatic transceiver control
According to the UART protocol, when the line is idle, TX is logic high. After the NOT gate, the LOW level is added to the direction control terminal, so when the UART is not transmitting data, RS485 is in the state of receiving data.
2 Use GPIO control & LPUART_RTS
More detailed information, users can refer to the link:
https://www.nxp.com/docs/en/application-note/AN12679.pdf
Note: Using GPIO control, software needs to judge the timing of receiving and sending. If the control is not good, it is easy to lose data. In order to control it well, the software must respond to TX FIFO "empty" interrupt, or query the sending status register, and accurately grasp the control opportunity, so as to ensure that there is no error in sending and receiving.
Combined with the above methods, some customers are using the following control:
Best Regards