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: [FT4232] FT_GetQueueStatus returns non-expected number of bytes in receive queue  (Read 10366 times)

alexeiko

  • Newbie
  • *
  • Posts: 4
    • View Profile

Hi, all!

I'm using FT4232 for JTAG. I'm using opcodes 0x39 and 0x3B for data in.
I'm expecting 9216 bytes (9KB) of data but the number of bytes in receive queue FT_GetQueueStatus gives me varies each time.
Once it's 9100, other time it's 9180 etc. Rarely I get the expected value.

What may be the issue? I tried to use smaller chunks, but still get incorrect values...

Would be glad for any help!

Thanks,
Alexei
Logged

alexeiko

  • Newbie
  • *
  • Posts: 4
    • View Profile

Hi!

Found a solution by reading the buffer in loop until expected number of bytes is received.


Code: [Select]
while (totbytesread < 1024 * 9) {
do {
ftStatus |= FT_GetQueueStatus(ftHandle_A, &dwNumOfBytestoRead); // get the number of bytes in the device input buffer
} while ((dwNumOfBytestoRead == 0) && (ftStatus == FT_OK));

ftStatus |= FT_Read(ftHandle_A, mf_buff, dwNumOfBytestoRead, &dwNumOfBytesRead);
mf_buff += dwNumOfBytesRead;
totbytesread += dwNumOfBytesRead;
}
Logged