stty command
1. Serial configuration
stty -F /dev/ttyS1 raw 115200 cs8 -parenb -cstopb
/dev/ttyS1: serial port file descriptor
115200: baud rate 115200
cs8: data bit 8
-parenb: no parity bit
-cstopb: 1 stop bit
raw: display the original value without escaping. If raw is not added, the shell cannot display data sent from the serial port to the device.
stty --help help documentation:
N : set the input and output speeds to N bauds
to set the baud rate to N, for example 9600 4800
csN: set character size to N bits, N in [5…8]
set the data bit to N, such as cs8, cs7
[-]cstopb: use two stop bits per character (one with '-')
to set the stop bit:
cstopb: 2 stop bits
-cstopb: 1 stop bit
[-]parenb: generate parity bit in output and expect parity bit in input (generate parity bit in output and require parity bit in input) parenb enables the terminal to perform parity check, -parenb disables
it check
-parenb: no check digit
[-]parodd: set odd parity (or even parity with '-')
parenb parodd: odd parity
parenb -parodd: even parity
2. Serial port test
Serial port parameter configuration:
[root@/]# stty -F /dev/ttyS1 raw 4800 cs8 -parenb cstopb
[root@/]#
View PC configuration information:
The device sends, the serial port receives
Serial port sending, device receiving
shell monitoring device serial port
Serial port software sends data to the serial port
The device displays received data
References
Reference 1: RAW mode serial port setting under Linux
Reference 2: FreeBSD Manual Pages --stty
Reference 3: stty command description and usage explanation
Reference 4: stty command description and usage explanation
microcom-command
If you don't have microcom commands, try busybox.
Configure the serial port baud rate and open the serial port. Other serial port attributes (data bits, parity bits) can be set using stty.
Serial software configuration
The serial port software sends data, and the device receives
Device sends, serial port software receives:
退出 microcom:
Ctrl-x to exit.
References:
Reference 1: busybox microcom
minicom command
To be perfected