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: FT_GetQueueStatus() does not return a DWORD  (Read 1307 times)

aleruggeri87

  • Newbie
  • *
  • Posts: 1
    • View Profile
FT_GetQueueStatus() does not return a DWORD
« 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.
Logged

Ari100tel

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: FT_GetQueueStatus() does not return a DWORD
« Reply #1 on: March 12, 2020, 12:35:16 PM »

Hello,

I have the same problem with FT232H working in Sync FIFO mode.
FT_GetQueueStatus() and FT_GetStatus() both return maximum 65536 bytes despite the fact that in the buffer there is much more data.
But using  FT_GetQueueStatusEx() gives correct number of bytes.
Maybe this is how it should work?
Did anyone have the same issue?

Regards,
Sergey
« Last Edit: March 13, 2020, 09:12:34 PM by Ari100tel »
Logged

FTDI Community

  • Administrator
  • Sr. Member
  • *****
  • Posts: 423
    • View Profile
Re: FT_GetQueueStatus() does not return a DWORD
« Reply #2 on: March 13, 2020, 02:47:20 PM »

Hello,

It is also best to have your application regularly checking the queue status and reading the data from the driver buffer into your own application buffer for processing.

If the driver buffers keep filling up, you will eventually reach a point where either data is lost (if you don't use handshaking lines)     or where the chip is unable to take more data from the attached serial device and de-asserts the flow control (if you use handshaking which we strongly recommend). This would be CTS or DSR for UART and would be TxE for FIFO. In this latter case your serial/FIFO device would need to pause sending and buffer up any data.

We therefore recommend to have your application check the queue status, read however many bytes are reported available if > 0 and then repeat this etc.

Best Regards, FTDI Community
Logged