Home >Operation and Maintenance >Linux Operation and Maintenance >Linux system debugging - stty changes the serial port baud rate

Linux system debugging - stty changes the serial port baud rate

嵌入式Linux充电站
嵌入式Linux充电站forward
2023-07-31 15:43:003139browse

After the Linux kernel is started, the baud rate of the serial port is usually 115200 or 9600. At this time, if you want to modify the baud rate of the serial port, go to This can be accomplished through the stty command in shell without modifying the driver code.

stty: set tty. That is, change and print the terminal line settings, which are used to check and modify the communication parameters of the currently registered terminal.

Serial port parameter settings

View serial port parameters:

stty -F /dev/ttyS0 -a

Set serial port parameters:

stty -F /dev/ttyS0 115200 cs8 -parenb -cstopb

Set serial portttyS0Baud rate115200,8bit data bits,1Stop bit, no check bit

Generally speaking, if you just modify the serial port baud rate, then you only need:

stty -F /dev/ttyS0 115200

stty的其它参数,可以用man查看其它设置选项。

开启流控

stty -F /dev/ttyS0 crtscts

关闭流控

stty -F /dev/ttyS0 -crtscts

注意,这里的开启和关闭,是通过前面的符号-来区别,-表示关闭,否则表示开启。

The above is the detailed content of Linux system debugging - stty changes the serial port baud rate. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:嵌入式Linux充电站. If there is any infringement, please contact admin@php.cn delete