Re: Why is the serial port so slow in Linux?
- From: The Natural Philosopher <a@xxx>
- Date: Sun, 04 Feb 2007 02:05:14 +0000
Richard wrote:
I am doing a loop-back test with the serialI think you probably need to rewrite/hack the serial driver..lord knows where they are in the kernel..and get yourself a spec *** on the UART itself.
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
Its a long time since I programmed a UART, but I seem to remember that the can be set to interrupt on different conditions. you want to interrupt 'when any data present' effectively.
I never got setserial to do anything useful really.
you MIGHT be able to use IOCTL calls to the driver if it understand the right ones...something about 'RAW' rings a bell..if te driver will respond to that it may work
Also, Linux itself may have its own buffers..issuing a read() command may not return till it either times out or has a full buffer..again there are ways to alter this behaviour, but its a long time ago..
Oh...this looks like it covers most of it
man tty_ioctl
See how you get on with that.
.
- References:
- Why is the serial port so slow in Linux?
- From: Richard
- Why is the serial port so slow in Linux?
- Prev by Date: Network backup options
- Next by Date: Linux as a PDC?
- Previous by thread: Why is the serial port so slow in Linux?
- Next by thread: Re: Why is the serial port so slow in Linux?
- Index(es):