libftdi Archives

Subject: Re: latency in read time

From: KrishnaMohan Bandi <krishnamohan.bandi@xxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Wed, 14 Dec 2011 16:07:06 +0000
The way the libftdi and usb scheduler work is as below:
If you requested data size is less than the read chunk size, then the
FTDI chip latency timer (default timeout is 16ms) kicks in and keeps
the data in the FTDI chip buffer for that long before it flushes out.
To change the default latency timer, use ftdi_set_latency_timer() to a
minimum value. As you are reading only one byte at a time, you always
have got the 16ms delay. Refer to AN232B-04 "Data Throughput, Latency
& Handshaking" document at
http://www.ftdichip.com/Support/Documents/AppNotes.htm for further
details.
My understanding is FTDI is not the right device if you are targeting
ultra low latencies, but it is good for achieving high throughput.


On 14 December 2011 14:57, Matt <lists@xxxxxxxxxxxxxxx> wrote:
>> You can try setting lower timeout periods, either for the FTDI chip or
>> libusb
>> (or both).
>>
>> ftdi_set_latency_timer() allows you to specify how long the FTDI chip
>> keeps
>> data in its internal buffer. You can use ftdi_get_latency_timer() to see
>> what the current latency value is for the FTDI chip.
>>
>> You can also access the usb_read_timeout and usb_write_timeout members of
>> the ftdi_context structure; these control the actual read and write
>> timeout
>> periods passed to libusb when performing bulk data transfers, although if
>> you set these values too low the timeout will hit before any data can be
>> read/written so be careful with them (I don't think you should have to
>> mess
>> with these too much...).
>>
>> Ultimately due to the nature of USB, if you are looking to get the most
>> speed out of your data transfers you'll want to transfer as many bytes at
>> a
>> time as possible instead of just one byte at a time.
>
> Thanks but if I ask libftdi to read one byte and it has read one byte (I
> can see it on the scope), why on earth does it wait another 16ms?
>
>
> --
> libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
> To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
>

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread