Getting Started
20MC50M00 E5
2020-10-20
41
2.6.6.1 Using Interfaces in RS485 Half-Duplex Mode
To use an RS422/RS485 interface in RS485 half-duplex mode, the control signals of the
corresponding UART (RTS) must be used internally.
Adapting the Driver Setting
» Reconfigure the corresponding RS422/RS485 interface port from RS422 to RS232
mode in file ax99100_sp.c, structure uart_99100_contxt:
» Compile and install the serial driver module with this setting.
Handling RS485 Interfaces in Half-Duplex Mode
Half-duplex mode uses only pins TX/RX+, TX/RX- and GND.
Set the RTS signal of the port to switch between receive (RX) and transmit (TX) mode:
0: RX mode
1: TX mode
Quick test example:
You can use Python with the pyserial library to easily access the RTS signal. Set the RTS
signal directly using .setRTS(), e.g., with port ttyF1:
.uart_mode= AX99100_RS232_MODE,
//RX read 10 bytes
import serial
device = serial.Serial( "/dev/ttyF1", baudrate=115200)
device.setRTS(0)
device.read(10)
//TX write 10 bytes
import serial
device = serial.Serial( "/dev/ttyF1", baudrate=115200)
device.setRTS(1)
device.write("Test RS485")