Recently, someone asked how to test serial communication on an RK3588 that had Linux installed in our lab. I spent quite some time figuring it out, and below I will share the method with you.Tools required: Tabby (for SSH connection), RK3588, monitor.The prerequisite is that you have already installed the Ubuntu system to proceed with the following operations.
All operations are completed in the Linux command line.
1. Query the current device’s serial port number from the command line:<span><span>ls</span> /dev/ttyS*</span>
<span>If successful, it will return the current serial port number, e.g., /dev/ttyS3.</span>
2. Activate serial port operation permissions to set or view serial port information, etc.
<span>sudo <span>chmod</span> 666 /dev/ttyS3</span>
Note that you should write the actual serial port number obtained in the first step here.
After pressing Enter to set, you will be prompted to enter the current account password. After entering it, press Enter to complete.
3.View the current serial port information: stty -F /dev/ttyS3 -a
If you want to change the serial port baud rate, for example, to 115200, you can use the command:<span><span>stty</span> -F /dev/ttyS3 115200</span>
<span>To view the configuration again: stty -F /dev/ttyS3 -a</span>
4. If you need to view the data received from the serial port, you can use cat to listen to the device:
cat /dev/ttyS3
5. You can directly use the echo command to send string data to the PC via the serial port:
echo "Hello, RS422!" > /dev/ttyS3
The writing is a bit brief, and some steps may seem too abrupt; I hope for your understanding.