Linux system debugging - stty changes the serial port baud rate

Release: 2023-07-31 15:43:00
forward
3095 people have browsed it

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
Copy after login

Set serial port parameters:

stty -F /dev/ttyS0 115200 cs8 -parenb -cstopb
Copy after login

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
Copy after login

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

开启流控

stty -F /dev/ttyS0 crtscts
Copy after login

关闭流控

stty -F /dev/ttyS0 -crtscts
Copy after login

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

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!

Related labels:
source:嵌入式Linux充电站
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template