libftdi Archives

Subject: data corruption at lower latency

From: mav <splash.maverick@xxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Fri, 24 May 2013 13:54:36 -0400
hello,

The data gets corrupted with low latency, details below. Any pointer will be appreciated.

------
SETUP:
------
libftdi-0.20.tar.gz
libusb-1.0.9.tar.bz2
libusb-compat-0.1.4.tar.bz2
uClinux (2.6.28), No MMU, on Altera NiosII.
FT4232H or, Quad RS232-HS or, VID:PID 0x403:0x6011.
The daemon is linked statically with libraries.

Only one (ttyUSBx) line, out of 4 lines supported by the chip, is utilized by a modem connected with 8N1 at 115200 baud.

The default chip latency of 16ms is updated to 1ms by the ftdi_set_latency_timer() call.
The datasheet mentions: "At 0ms latency you get a packet transfer on every high speed microframe", but, libftdi supports latency between 1 to 255 only.

I also tried playing with different chunksizes (ftdi_read_data_set_chunksize / ftdi_write_data_set_chunksize) for both rx and tx buffers, which to my understanding, should not have an affect when the latency timer is set so low (1ms).

Right after the setting the timer and the chunksizes, both rx and tx buffers are purged by ftdi_usb_purge_rx_buffer() and ftdi_usb_purge_tx_buffer(), although, this may not be necessary.

--------
PROBLEM:
--------
With the setup and initialization explained above, the modem is powered on and communicates well for first few (~20) seconds, then it starts receiving 2 junk bytes every now and then. I suspect these are the 2 Status Bytes that should be stripped inside the ftdi_read_data() of the FTDI library. To my understanding, upon expiration of timeout or upon receival of every 62 bytes of data, 2 status bytes are sent to the FTDI library by the usb layer. Since these 2 bytes are coming into the datastream, it is leading to data corruption and eventual communication break.

----------
QUESTIONS:
----------
1) Is the assumption regarding 2 status bytes coming into datastream correct?
2) Has such data corruption been observed before?
3) Is the corruption caused by the [libusb-compat-0.1.4] or [libusb-1.0.9] or [libftdi-0.20]?
4) Has libftdi been used successfuly with such low latency?
5) Which version of libftdi has been used on uClinux?
6) Is libftdi1 compatible with libusb1.0.9 instead of libusb-1.0.16rc10?
7) libusb-1.0.16rc10 uses udev, does it also support mdev?
8) Feeding "--with-udev=no" or "disable-udev" to the configure script of libusb-1.0.16rc10 breaks. Can libusb-1.0.16rc10 work without udev (I don't think so)?

-----------
REFERENCES:
-----------
Glancing through the tickets, it seems data corruption has been observed in case of bulk transfers (in GB). Although, I have not found reference to data corruption when latency is lowered. 
http://libftdi.141977.n3.nabble.com/Rare-errors-in-data-transmission-with-FT2232H-td4025331.html
http://www.libusb.org/ticket/73
http://www.libusb.org/ticket/6
http://permalink.gmane.org/gmane.linux.usb.general/41195
http://permalink.gmane.org/gmane.linux.usb.general/41366

thanks,
mav


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


Current Thread