Linux – Buffer overrun on Fedora 16 serial

gnu-screenlinuxserial portserial-console

I got a brain smashing problem with Fedora 16 and my serial port.

I use the serial to monitor an STB on which I'm developping. The STB runs on Linux and when booted, I launch the program I'm working on through the serial interface.

Now, my program outputs lots of traces when I'm debugging, and I get loads of buffer overrun errors in dmesg.

This makes debugging the application a mess, because the serial output gets unreadable.

So, what's bothering me is that when I was running on Fedora 15, there was no buffer overrun at all!

Some more details on my setup:

  • Fedora Core 16 under Cinnamon / gnome-terminal for the serial. Uname: 3.2.6-3.fc16.x86_64
  • to connect the serial port, I use this command: screen -R -d -t "Serial" /dev/ttyS0 115200

Any idea of how I could fix that?

(some more details:)

$ cat /proc/tty/driver/serial
serinfo:1.0 driver revision:
0: uart:16550A port:000003F8 irq:4 tx:3395 rx:11899157 fe:6 brk:4 oe:3496 RTS|DTR
###                                                               ^^^^^^^
###                                                            overflow errors
1: uart:16550A port:0000EC98 irq:17 tx:32 rx:0 CTS|DSR|CD
2: uart:unknown port:000003E8 irq:4
3: uart:unknown port:000002E8 irq:3

Typical dmegs output:

[370425.080452] ttyS0: 24 input overrun(s)
[370426.092382] ttyS0: 30 input overrun(s)
[370427.109291] ttyS0: 36 input overrun(s)
[370428.173344] ttyS0: 28 input overrun(s)
[370429.583198] ttyS0: 26 input overrun(s)
[370430.638700] ttyS0: 32 input overrun(s)

:( :( :(

Output of sudo setserial -v -a -g /dev/ttyS0:

/dev/ttyS0, Line 0, UART: 16550A, Port: 0x03f8, IRQ: 4
    Baud_base: 115200, close_delay: 50, divisor: 0
    closing_wait: 3000
    Flags: spd_normal skip_test low_latency

Best Answer

According to the Fedora 16 documentation /etc/rc.serial is responsible for setting up the serial lines.

Has anything changed here between your 15 and 16 install?

Setting "low latency" and "rx/tx_trigger" (if possible) might help.

I remember that the 16550A has a 15-byte-input-buffer. Somehow you can set at which fill-level an interrupt is being generated - I used 7 bytes for a tradeoff between reliability and speed (with DOS). Perhaps the rx/tx-trigger about does a comparable tuning.

Update 2012-03-12:

I just checked on my workstation (CentOS5 - should be comparable to Fedora):

rpm -qd setserial shows the available documentation. There is a README and a sample rc.serial file - see the README.

Apart from that - I looked again at your output: spd_normal does not look ok to me. You want 115 kb - so you propably should set spd_vhi (see man setserial). The reason for this is that you can not request more than 38.4 kb, since the UART-standard did not allow for more. Later on came 57.6kb then 115kb - there had to be a "trick" to set these speeds, too.

Related Question