View and set the serial port in the terminal under linux

1. View serial devices

 //一般为ttyUSB0
 ls /dev/

2. View information such as the baud rate of the serial port

 stty -F /dev/ttyUSB0 -a                                                                                 

3. Set the serial port baud rate and data mode

 //该命令将串口1(/dev/ttyUSB0)设置成115200波特率,8位数据模式
 stty -F /dev/ttyUSB0 ispeed 115200 ospeed 115200 cs8                                                    

4. Print serial port data

 cat /dev/ttyUSB0  

5. Send serial data

echo "EE 00 01 01 00 00 00 00 EF" > /dev/ttyUSB0

6. Download CuteCom

 //cutecom还是比较方便的
 sudo apt-get install cutecom

Guess you like

Origin blog.csdn.net/weixin_44847326/article/details/127240595