General Category > Discussion - Drivers

[Confirmed Bug] FT4222_I2CMaster_Write sizeTransferred returning 4 extra bytes.

(1/2) > >>

allenhuffman:
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?

FTDI Community:
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

allenhuffman:

--- Quote from: FTDI Community on August 29, 2019, 09:14:43 AM ---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).
--- End quote ---

I am using the latest ZIP, downloaded recently:

LibFT4222-v1.4.2.zip


--- Quote ---Which FT4222H IC revision are you using?
--- End quote ---

D


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

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: ---sizeTransferred = 0;
ft42Status = FT4222_I2CMaster_Write(FTDIHandle, slaveAddress, writeBuf, (ushort)sizeToWrite, &sizeTransferred);

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


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

FTDI Community:
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

allenhuffman:
Awesome! Thanks for the confirmation.

Navigation

[0] Message Index

[#] Next page

Go to full version