Use RS485
Edge 2 has one RS485 connector.
Connecting hardware
Port the USB to RS485 converter to the PC, and connect the cable to the Edge 2 RS485 connector. Refer to the following wire sequence connection diagram:
Configuring RS485
The Edge 2 RS485 connector corresponds to UART4. To use RS485, you need to enable UART4 in the kernel.
The following files involved in the kernel:
kernel/arch/arm64/boot/dts/rockchip/mixtile-edge2.dts
To enable UART4:
&uart4 {
status = "okay";
pinctrl-0 = <&uart4m1_xfer>;
};
To compile the kernel, please refer to the Compile kernel chapter for more details.
To burn boot.img, please refer to Update Firmware chapter for more details.
Testing RS485
Open the PC serial port
Taking macOS as an example, the USB to RS485 converter node tty.usbserial-14310
exists in the system, and the command to open it through the picocom
tool is as follows:
$ picocom -b 9600 /dev/tty.usbserial-14310
The USB to UART converter node exists in the Ubuntu in the form of /dev/ttyUSB[1, 2, 3.....]
.
The USB to UART converter node exists in the Windows in the form of COM[1、2、3....]
.
For more details, please refer to the Serial Debugging.
Sending data from Edge 2
The Edge 2 UART5 device file is /dev/ttyS4
. Run the following commands on Edge 2:
echo "edge2 RS485 test..." > /dev/ttyS4
The PC serial terminal (picocom
) should receive the string “edge2 RS485 test…”
.
Receiving data by Edge 2
Run the following command on Edge 2.
cat /dev/ttyS4
Send a string, e.g. “edge2 UART5 test…”
, using the PC serial terminal (picocom
) to test the connection. Edge 2 should see the same string.