I'm trying to receive data from a custom device based on an FTDI 2232H chip.
I am using a simple Async FIFO mode, and the incoming data rate is 3.2MB/sec.
Everything works perfectly with test code on my PC, but I'm having problems receiving data on my Toshiba Thrive.
TDI's Android driver fails, so I am coding using Java.
I can receive 95%+ of the data perfectly, but every once in a while the data 'sputters' and I get portions of the same 4-5K of data two or three times, then back to good data.
I am not going too fast for the Thrive or Android, because I previously had the data coming in at double (6.4MB/sec) and it got about 95% of that as well. (So it should have no problem at half the rate.)
It seems like there is some sort of bug in the buffering (or double-buffering) that happens within Android. (It is not the buffer within the FTDI 2232H because the repeated data is larger than the chip's 4K internal buffer.)
The setup code is simple, and again it's working ~almost~ perfectly.
The loop where the data grab occurs is very simple:
while(!fStop)
if(totalLen < BIG_BUFF_LEN-IN_BUFF_LEN)
{
len=conn.bulkTransfer(epIN, inBuff, IN_BUFF_LEN, 0);
System.arraycopy(inBuff, 0, bigBuff, totalLen, len);
totalLen+=len;
}
In case you think it's the time delay for the arraycopy - I still lose the data even if I comment that line out.
The IN_BUFF_LEN is 16384 (bulkTransfer won't return more than that even if I increase the size of the inBuff).
The bigBuff is several megabytes.
As a secondary question - does anyone know how to pass a pointer to bulkTransfer that will populate bigBuff directly --- at an offset (not starting at position '0'?