I am currently porting some code I have form C# to Java to run in on an Android system.
In my code, I have to read some data from a board that has a FTDI chip. I am trying to use the java drivers from the FTDI website.
I can connect to the device and send commands to it correctly (LEDs blink as they should). The board appears to be sending me data correctly.
bytesAvailable = ftDevice.getQueueStatus();
returns the expected number
int bytesRead = ftDevice.read(rxData, bytesAvailable);
returns the same number
However on calling the read()
as above I see the following in my logcat:
Cannot read data from Source!!
from tag:
readBulkInData::
I cannot see what this might be. I tried fiddling with the settings of the device in my code, but to no avail.
I solved this.
By placing the whole sequence of instructions for reading (the getQueueStatus()
and the read()
) in another Thread
. Specifically, I used an AsyncTask
, and put the reading instructions in its doInBackground()
method.