Unexpected long pyserial read delay on Windows

John Nagle nagle at animats.com
Sun Feb 22 13:38:11 EST 2009


Grant Edwards wrote:
> On 2009-02-22, John Nagle <nagle at animats.com> wrote:
> 
>> I've been using PySerial on Windows (Win2000, amusingly) to
>> drive a Baudot teletype at 45.45 baud.  Input and output work,
>> but there's a delay of about 1 second (!) on the input side
>> between receiving a character and reporting it to the program.
> 
> The UART you're using almost certainly has a receive FIFO.
> Normally, the UART doesn't interrupt the CPU to tell it there's
> receeve data ready until the FIFO is almost full (eg 12 bytes
> present in a 16 byte FIFO).
> 
> If the UART has an empty receive FIFO, and it receives a single
> character that character goes into the receive FIFO.  If data
> stops coming in before the rx FIFO threshold is reached, the
> UART will wait 40 bit-times...

    Ah, 40 bit times.  That's the default.  And that's the problem.
I thought the accumulation timer was a fixed timer of a few milliseconds.

    There is a "disable FIFO" checkbox in Windows 2000. It's hard to
find.

	- Log off as user.
	- Log on as "administrator"
	- Open Control Panel -> System
	- Go to "Devices" tab and select "Device manager".
	- Open "Ports" in the tree and click on desired COM1 port.
	- Click "Advanced" button.
	- Set "Receive buffer size" slider to 1.
	- Click "Disable FIFO" checkbox.
	- Close all the dialogs.
	- Reboot. (Yes, it doesn't take effect until the next reboot.)

That fixed the problem.  Thanks.

					John Nagle



More information about the Python-list mailing list