reference: https://github.com/cbrake/linux-serial-test
带RTS/CTS自测
/bin # linux-serial-test -e -p /dev/ttyS5 -b 115200 -o 5 -i 7 -c -l 2
Linux serial test app
Stopped transmitting.
Stopped receiving.
/dev/ttyS5: count for this session: rx=62449, tx=62449, rx err=0
/dev/ttyS5: TIOCGICOUNT: ret=0, rx=1049437, tx=1047339, frame = 0, overrun = 0, parity = 0, brk = 0, buf_overrun = 0
不带RTS/CTS自测
/bin # linux-serial-test -e -p /dev/ttyS5 -b 115200 -o 5 -i 7
Linux serial test app
Stopped transmitting.
Stopped receiving.
/dev/ttyS5: count for this session: rx=58354, tx=58354, rx err=0
/dev/ttyS5: TIOCGICOUNT: ret=0, rx=1107791, tx=1105693, frame = 0, overrun = 0, parity = 0, brk = 0, buf_overrun = 0
发送 0x55
/bin # linux-serial-test -y 0x55 -p /dev/ttyS5 -b 115200
Linux serial test app
发送 0x55 0x00
/bin # linux-serial-test -y 0x55 -z 0x0 -p /dev/ttyS5 -b 115200
Linux serial test app
接收测试:
/bin # linux-serial-test -s -e -p /dev/ttyS5 -t -c -l 250
Linux serial test app
No data received for 2.0s.
No data received for 3.0s.
No data received for 4.0s.
No data received for 5.0s.
No data received for 6.0s.
/dev/ttyS5: count for this session: rx=0, tx=0, rx err=0
/dev/ttyS5: TIOCGICOUNT: ret=0, rx=1107796, tx=1105698, frame = 0, overrun = 0, parity = 0, brk = 0, buf_overrun = 0
No data received for 7.0s.
No data received for 8.0s.
No data received for 9.0s.
发送测试:
/bin # linux-serial-test -s -e -p /dev/ttyS5 -r -c
Linux serial test app
/dev/ttyS5: count for this session: rx=0, tx=66547, rx err=0
/dev/ttyS5: TIOCGICOUNT: ret=0, rx=1169213, tx=1167126, frame = 0, overrun = 0, parity = 0, brk = 0, buf_overrun = 0
/dev/ttyS5: count for this session: rx=0, tx=138213, rx err=0
/dev/ttyS5: TIOCGICOUNT: ret=0, rx=1240868, tx=1238792, frame = 0, overrun = 0, parity = 0, brk = 0, buf_overrun = 0