ttyS0: 1 input overrun(s)

来源:互联网 发布:arm linux gcc 4.3.2 编辑:程序博客网 时间:2024/05/18 12:30

linux串口长期工作时,出现提示:ttyS0: 1 input overrun(s)

说明串口已经输入溢出,这时候我们应该将串口的缓冲区进行清除。

在发送命令前,清除缓冲区

在接受数据后,清除缓冲区

清除命令:tcflush(fd, TCIOFLUSH);

当然fd是你串口open时返回的int,这个fd必须有意义(>0);

TCIOFLUSH的意思是清除输入输出缓存。


15.14 Overrun errors on serial port

This is an overrun of the hardware FIFO buffer and you can'tincrease its size. See