FTDI Community

General Category => Discussion - Drivers => Topic started by: aleruggeri87 on November 06, 2019, 09:25:59 PM

Title: FT_GetQueueStatus() does not return a DWORD
Post by: aleruggeri87 on November 06, 2019, 09:25:59 PM
Hello,

I'm using an FT232H in ASYNC Serial mode.
I'm calling FT_GetQueueStatus() to understand how many characters has been received, and how many "data packets" (200-byte each in my case) I can read from the RX queue. Even if I'm using a DWORD pointer for the lpdwAmountInRxQueue parameter, it seems that the returned value saturates to 2^16 (65536, thus it is not for some strange reason internally handled as a 16-bit value, that will lead to 2^16-1 max).

In any case, if I receive more than 2^16 bytes, let's say 70k, data is correctly kept in the queue; reading some of them to go below 2^16, say 20k, FT_GetQueueStatus() starts again to indicate the correct number of bytes in the queue.

I overcomed the issue with a loop around the getStatus and Read, but I was wondering if this is a bug or something well known, but not fully documented.

Thanks and regards,
Alessandro.