General Category > Discussion - Drivers

Errors with functions FT_GetQueueStatus() and FT_Read() of D2XX

(1/1)

MauroDiamantino:
Hello people, I'm working with a USB device which incorporates a FT232R chip. I'm using the D2XX library to communicate with the device from a custom C++ software. The data is read as 17 bytes at a time, and to ensure the reading doesn't fail it is queried the number of available bytes inside a loop until this number is greater or equal to 17. The number of available bytes is got with the function FT_GetQueueStatus(). After of facing many errors, I discovered it was necessary to put a delay of 70ms approximately between the calling of FT_GetQueueStatus() which states that the necessary number of bytes are available and the calling of FT_Read(), to avoid reading errors.
Why did I have to put that delay? Isn't it supposed if the needed bytes are available, the reading operation shouldn't fail? Is it the same to use FT_GetQueueStatus() or FT_GetStatus() to get the number of available bytes in the receive queue?

FTDI Community:
Hello,

There should not be a need to add a delay. If FT_GetQueueStatus returns a value, that value should be able to be read straight away.

What are the fail codes that you are seeing, returned by the function calls?

See the D2XX Programmer's Guide for more information and software examples.

If you want to send your code for review, see Contact Us for your local support office.

Best Regards,
FTDI Community

Navigation

[0] Message Index

Go to full version