libftdi Archives

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

From: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Tue, 2 Dec 2014 11:05:35 +0100
>>>>> "Hendrik" == Hendrik  <chasake@xxxxxxxxx> writes:

    Hendrik> Hello Uwe, Hi, I am currently porting our software from Windows
    Hendrik> (using FTDI's own driver) to Linux (using libftdi). Thus far it
    Hendrik> works great but I am now on a specific case in the program that
    Hendrik> needs to read chunks of data from our device.  The commands
    Hendrik> between the host (now a PC, later an embedded ...
    >> No answer to your questions but another questions from my side: - Why
    >> are you useing libftdi and not the kernel driver ftdi_sio?
    Hendrik> I am using the libftdi ftdi_read function and have unloaded the
    Hendrik> ftdi_sio kernel module. I also updated to libftdi 1.2 today but
    Hendrik> the same problem occurred on 1.1 (I updated today because I
    Hendrik> wanted to know if the problem went away with this version but
    Hendrik> it didn't).

This doesn't tell _why_ you don't use the kernel driver...
I think the kernel driver is better in such corner cases.

    >> - Did you try asynchronous transfers (ftdi_read_data_submit)?
    Hendrik> No, I try/tried to stay away from async transfers as the whole
    Hendrik> protocol is request->reply based which makes it easier to
    Hendrik> program (and easier to read what's going on).

The code flow isn't that different.
Without aync transfer:
'ftdi_write' the request
while (not all 522 bytes received)
     'ftdi_read' the reply

With async transfer:
'ftdi_read_data_submit' setup the read request
'ftdi_write' the request
while(read transfer not complete) wait;

    Hendrik> I looked through the libftdi sources but can you tell me what
    Hendrik> the latency timer actually does (in combination with the read
    Hendrik> chunk size)? I know its function and that a read command will
    Hendrik> return when the timer has expired and the chunk was not
    Hendrik> competely read, but where is this information stored? The
    Hendrik> ftdI_read_data function don't seem to use the timer so it must
    Hendrik> be hardware based, but if the FTDI buffer itself is not as
    Hendrik> large as the 4KB chunk, where is this data buffered then in
    Hendrik> combination with the timer?

    Hendrik> I will post some more debugging info tomorrow.

Either way, the libftdi problem needs to be solved, so thanks for your
patience.

Bye
-- 
Uwe Bonnes                bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------

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

Current Thread