On 2009-02-22, John Nagle <na...@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 and then interrupt the CPU to tell it there is receive data ready. The thought is that maybe there's more data coming -- we don't want to waste the CPU's time handling a single byte if there's more data coming in. At 45.45 baud, 40 bit-times is pretty close to 1 second. If you don't want to wait 40-bit times for the rx data timeout, then you need to disable the rx FIFO. I'm not sure how you do that in Windows. I don't remember seeing anything in pyserial to do it, but I avoid Windows as much as possible. You might want to go looking around in the device manager to see if there's a checkbox "disalbe FIFO" in the serial port driver config. If not, then Google can probably help. -- Grant -- http://mail.python.org/mailman/listinfo/python-list