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: [Confirmed Bug] FT4222_I2CMaster_Write sizeTransferred returning 4 extra bytes.  (Read 17566 times)

allenhuffman

  • Newbie
  • *
  • Posts: 48
  • Mostly harmless.
    • View Profile
    • Sub-Etha Software

Somewhere I read that FTDI added some header bytes that needed to be accounted for. I cannot find where I saw this, but maybe this is what I am seeing.

Per the App Note 329, I am using FT4222_I2CMaster_Write() and passing in a value of 8 for "bytesToWrite", and a zeroed out sizeTransferred before passing it in. "sizeTransferred" returns as 12 rather than the 8 I expected. (Verifying with a line analyzer shows the 8 bytes we went without extras.)

What are the extra 4 bytes?
« Last Edit: November 27, 2019, 06:41:41 PM by allenhuffman »
Logged

FTDI Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 892
    • View Profile
Re: FT4222_I2CMaster_Write sizeTransferred returning 4 extra bytes.
« Reply #1 on: August 29, 2019, 09:14:43 AM »

Hello,

In general with USB full speed 64 bytes transfer package is made up of 2 status bytes and 62 user bytes.
Note this is 512 maximum transfer package size for USB high speed like the FT4222H.
The two bytes 02 60 are the status bytes required by the D2XX driver.
The status bytes are for the driver and should be invisible to the user application and is handled by the driver.

Which version of LibFT4222 are you using? Which version of the D2XX driver are you using?
The latest are v1.4.2 and 2.12.28 respectively (for Windows).

Which FT4222H IC revision are you using?

Have you tested out the I2C examples provided with LibFT4222?

Best Regards,
FTDI Community
Logged

allenhuffman

  • Newbie
  • *
  • Posts: 48
  • Mostly harmless.
    • View Profile
    • Sub-Etha Software
Re: FT4222_I2CMaster_Write sizeTransferred returning 4 extra bytes.
« Reply #2 on: August 29, 2019, 02:39:21 PM »

Which version of LibFT4222 are you using? Which version of the D2XX driver are you using?
The latest are v1.4.2 and 2.12.28 respectively (for Windows).

I am using the latest ZIP, downloaded recently:

LibFT4222-v1.4.2.zip

Quote
Which FT4222H IC revision are you using?

D

Quote
Have you tested out the I2C examples provided with LibFT4222?

I am currently using a modified example, yes.

When I use FT4222_I2CMaster_Write() and tell it to write 7 bytes, the value returns with 11. I've tested it with other numbers, and see it returns 4 higher than what I passed in. Here's a slightly edited snippet:

Code: [Select]
sizeTransferred = 0;
ft42Status = FT4222_I2CMaster_Write(FTDIHandle, slaveAddress, writeBuf, (ushort)sizeToWrite, &sizeTransferred);

Writing 7 bytes...
11 SENT: aa 00 06 00 02 4e ff


As you see, I clear sizeTransferred before I pass it in.
Logged

FTDI Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 892
    • View Profile
Re: FT4222_I2CMaster_Write sizeTransferred returning 4 extra bytes.
« Reply #3 on: August 30, 2019, 04:39:21 PM »

Hello,

This is confirmed as a bug in FT4222_I2CMaster_Write().
It will be fixed with the next LibFT422 patch.
However the actual transaction is OK and the extra count of 4 can be discarded as a workaround.

Best Regards,
FTDI Community
Logged

allenhuffman

  • Newbie
  • *
  • Posts: 48
  • Mostly harmless.
    • View Profile
    • Sub-Etha Software
Re: FT4222_I2CMaster_Write sizeTransferred returning 4 extra bytes.
« Reply #4 on: August 30, 2019, 07:00:57 PM »

Awesome! Thanks for the confirmation.
Logged

allenhuffman

  • Newbie
  • *
  • Posts: 48
  • Mostly harmless.
    • View Profile
    • Sub-Etha Software

Looks like this is fixed in 1.4.3 (but we haven't tried it yet):

Release version
1.4.3 (Mar 19, 2020)
Maintenance release.

Release Fixes

•   Support Chip version “A”, “B”, “C” and “D”.
o   Fix issue. FT4222_I2CMaster_WriteEx does not return correct sizeTransferred.
Logged

allenhuffman

  • Newbie
  • *
  • Posts: 48
  • Mostly harmless.
    • View Profile
    • Sub-Etha Software

I do not think it was actually resolved in 1.4.3, but it definitely works in 1.4.4.
Logged