libftdi Archives

Subject: Re: ftdi_read loses bytes (when latency is low)

From: Rogier Wolff <R.E.Wolff@xxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Sun, 7 Dec 2014 10:51:36 +0100
On Tue, Dec 02, 2014 at 04:29:47PM +0100, Anders Larsen wrote:
> Hello Hendrik,
> 
> On 2014-12-02 15:53, Hendrik wrote:
> >Yes it is but it happens very frequently with a low latency and
> >almost never (I have now ran into the problem a couple of times
> >with the latency set to a high value too, but it is very
> >infrequent) happens.
> 
> is latency an issue for you (could you live with 16ms, where your
> problem seems not to manifest itself)?
> 
> Bear in mind that a low latency value will consume more CPU power on
> Linux, too!

Whoa! As far as I can see we're talking about the latency timer in the
FTDI chip. The timer expires the configured time after the last
transmission to the PC. When that happens, the buffer will be sent,
full-or-not. 

http://www.ftdichip.com/Support/Documents/AppNotes/AN232B-04_DataLatencyFlow.pdf

3.1, item 4. 

Now read section 2.3... 

The PC will assume "more data available" when the packet is 64 bytes!

So if you put the latency timer on "1ms", you'll only get one 50-byte
packet to the PC every ms. ANY delay or missed timeslot will
accumulate. There is never a chance to send more than 50 bytes in any
1ms period, because by sending less than 64 bytes the FTDI chip has
signalled "no, I don't have more data than this available at this
time."

So... For setting the latency timer: NEVER EVER set it below the time
required to gather 64 bytes. (unless your data transfer is slow
compared to 64 bytes/ms.).

        Roger. 

-- 
** R.E.Wolff@xxxxxxxxxxxx ** http://www.BitWizard.nl/ ** +31-15-2600998 **
**    Delftechpark 26 2628 XH  Delft, The Netherlands. KVK: 27239233    **
*-- BitWizard writes Linux device drivers for any device you may have! --*
The plan was simple, like my brother-in-law Phil. But unlike
Phil, this plan just might work.

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

Current Thread