FTDI Community

Please login or register.

Login with username, password and session length.
Advanced Search  

News:

Welcome to the FTDI Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ FTDI Support


New Bridgetek Community is now open

Please note that we have created the Bridgetek Community to discuss all Bridgetek products e.g. EVE, MCU.

Please follow this link and create a new user account to get started.

Bridgetek Community

Author Topic: Errors with functions FT_GetQueueStatus() and FT_Read() of D2XX  (Read 9716 times)

MauroDiamantino

  • Newbie
  • *
  • Posts: 3
    • View Profile

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?
Logged

FTDI Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 892
    • View Profile
Re: Errors with functions FT_GetQueueStatus() and FT_Read() of D2XX
« Reply #1 on: August 23, 2019, 11:05:22 AM »

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
Logged