[lug] 16550 Serial port buffering?

Riggs, Rob RRiggs at doubleclick.net
Fri May 25 11:10:18 MDT 2001


Have you tried setting the UART manually to a 16450, instead of letting it
detect the 16550A? This should eliminate the use of the 16-btye FIFO on the
UART, which will account for 1-2 ms of latency at 57.6Kbps. (And the latency
is inversely proportional to the bit rate.) This may cause you other
problems, such as dropped data when the box is busy. It would be a very bad
idea to set the UART to 16450 to try to decrease latency in games.

-----Original Message-----
From: Scott A. Herod [mailto:herod at interact-tv.com]
Sent: Friday, May 25, 2001 9:57 AM
To: lug at lug.boulder.co.us
Subject: Re: [lug] 16550 Serial port buffering?

"D. Stimits" wrote:
> "Scott A. Herod" wrote:
> >
> > After 3 days of trying to get it to work....
> >
> >   "man setserial"  search for low_latency.
> Makes me wonder if this could have a beneficial effect on the serial
> port of a 56k modem while working with games that require low latency.
> When I get around to it, I think I'll give it a try (not exactly serious
> work, but hey, someone needs to be less serious).
> D. Stimits, stimits at idcomm.com

I think that it would depend on the rate at which you are receiving
data.  From watching a scope and reading the man page, it looks like
the serial port ( with default latency ) buffers for about 10 msec 
if it gets a small ( 4 byte in my case ) burst.  I imagine this 
happens to wait for more data before triggering an interrupt.  

I was needing to get 60 hz clock ticks ( 59.97 hz actually I think )
and start sending a response in about 11 msec.  Now, setting the
low_latency flag, I can get data in and out in 4 msec consistantly.

I'm not sure why 4 msec seems to be the minimum.  I was watching
on a scope a pulse coming in followed by my response to a read 
followed immediately by a write.  It's consistantly 4.3 msec.
I've tried using select, poll, and just looping on a read and
it doesn't seem to change how fast I can turn around.  

Web Page:  http://lug.boulder.co.us
Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug

More information about the LUG mailing list