libftdi Archives

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

From: Hendrik <chasake@xxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Mon, 01 Dec 2014 21:07:24 +0100
Hello Uwe,

Hendrik> Hi, I am currently porting our software from Windows (using
Hendrik> FTDI's own driver) to Linux (using libftdi). Thus far it works
Hendrik> great but I am now on a specific case in the program that needs
Hendrik> to read chunks of data from our device.
Hendrik> The commands 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?
I am using the libftdi ftdi_read function and have unloaded the ftdi_sio kernel module. I also updated to libftdi 1.2 today but the same problem occurred on 1.1 (I updated today because I wanted to know if the problem went away with this version but it didn't).

>- Do you have some usbdump snipplet where the problem happens?
Not at home but I will send this tomorrow when back at work

>- Can the USB chipset be involved here?
Maybe :), the motherboard is an Asus M4A785-M (I think) with AMD710 southbridge (Support up to 14 USB ports (12 USB 2.0 and 2 USB 1.1))

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

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

I will post some more debugging info tomorrow.

Regards,
Hendrik

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