Why is the serial port so slow in Linux?



I am doing a loop-back test with the serial
port, I have connected pins 2 and 3 (the
transmit and receive pins) on the DB9
connector together. I am sending a series
of single bytes and reading them back as
soon as they are available. The program
works, the only problem is that the time
it takes to transmit and receive the
bytes is about 30 times longer than for
a DOS program I wrote that does the same
thing.
A long while ago I posted in a Linux
newsgroup asking why the serial port is
so slow in Linux, and I got a reply that
the problem is the FIFO in the UART. The
explanation given was that the UART waits
until the fIFO is filled up before it
interrupts the CPU, so if you are just
transmitting single bytes the serial driver
is timing out waiting for the bytes to be
echoed. I was told that the thing to do
was to disable the FIFO in the UART.
I have tried to figure out how to
disable the FIFO. I did a search and
found some posts that say you can disable
the FIFO by re-assigning the UART type
to an earlier one which did not have a
FIFO, for example as follows:

setserial /dev/ttyS0 uart 16550

(rather than 16550A). I also tried setting
the UART type to 8250. However, none of
the re-assignments of UART type have had
any effect on the speed of the serial port.

Can anyone tell me how to disable the FIFO,
or is there some other problem or setting
I need to be aware of? I don't understand
why the serial port would be so much
slower under Linux than DOS.

Thanks,

Richard

.



Relevant Pages

  • Re: Why is the serial port so slow in Linux?
    ... port, I have connected pins 2 and 3 (the ... the problem is the FIFO in the UART. ... any effect on the speed of the serial port. ...
    (comp.os.linux.misc)
  • Re: RS232 flowcontrol
    ... implements a 96-byte transmit FIFO. ... Second, the FIFO in your PC UART is only 16-bytes in depth, so it sounds ... Write a routine that breaks transmit data into small chunks, ... then stay in a delay loop until it goes back to True. ...
    (microsoft.public.vb.winapi)
  • RE: Using 16550 UART FIFO in polled mode (CE5.0)
    ... port driver uses the 14 level, and does not even get an interrupt from the ... UART until there are 14 bytes in the FIFO. ... since the Microsoft serial port driver is obviously ... I have code of my own that tries to detect "gaps" in communication to ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: Fifo Simulation Error
    ... I'm sampling some stuffs at 33Mhz, and feeding into my FIFO at 33Mhz ... output to UART which transmit at 115200baud rate. ... Drastically cut down on the amount of data sent to the UART ... Buffer the data in memory and transmit data from memory to the UART. ...
    (comp.arch.fpga)
  • Re: Serial Kitl on pXA255
    ... to send and receive some data according to KITL protocol. ... > port in OEMInitSerial. ... > fRet = InitSerial; ... > // This UART initialization needs to be tested... ...
    (microsoft.public.windowsce.platbuilder)