UART Usage
The AIO-8550JD4 provides 1 RS232 interface and 1 RS485 interface, both on Phoenix terminal connectors. The interface locations are shown in the figure below:
The software nodes corresponding to each hardware interface (the node names are subject to the actual system):
RS232: /dev/ttyS1
RS485: /dev/ttyS6Note that RS485 is half-duplex communication. Before sending, the transmit/receive direction needs to be controlled by GPIO (the GPIO number is subject to the actual system; the following example uses GPIO34).
Send and receive verification
Use the USB to serial adapter of the host computer to connect to the development board (the adapter node on the host side is subject to the actual one, such as /dev/ttyUSB0).
-
The development board sends, and the host receives:
# Run on the host terminal first cat /dev/ttyUSB0 # Run on the debug serial terminal of the development board echo "firefly RS485 test..." > /dev/ttyS6The host terminal will receive the string
firefly RS485 test.... -
The host sends, and the development board receives:
# Run on the debug serial terminal of the development board (configure GPIO34 as output and pull it low to switch to the receive direction) echo 34 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio34/direction echo 0 > /sys/class/gpio/gpio34/value # Run on the debug serial terminal of the development board first busybox stty -echo -F /dev/ttyS6 # Turn off echo cat /dev/ttyS6 # Run on the host terminal (pull it high to switch to the transmit direction) echo 1 > /sys/class/gpio/gpio34/value echo "firefly RS485 test..." > /dev/ttyUSB0The debug serial terminal of the development board will receive the string
firefly RS485 test....
The verification method of RS232 is the same; just replace the node with the corresponding /dev/ttyS1. RS232 is full-duplex and does not need GPIO to control the transmit/receive direction.