FTDI Community

General Category => Discussion - Software => Topic started by: BigApple on January 08, 2024, 08:18:38 PM

Title: LibMPSSE I2C Library ACK Issue
Post by: BigApple on January 08, 2024, 08:18:38 PM
I downloaded the DLL libraries, examples, and source code from the following link
https://ftdichip.com/software-examples/mpsse-projects/libmpsse-i2c-examples/

After running the code I noticed that the library is having an issue reading the ACK bit.

In the attached scope capture, the slave successfully acknowledges the 9th bit.  However, the FTDI device does not see it.

In LibMPSSE-I2C, I noticed there's a function called: static FT_STATUS I2C_Write8bitsAndGetAck(FT_HANDLE handle, uint8 data, bool *ack)

The function appears to call

Code: [Select]
status = FT_Channel_Write(I2C, handle, noOfBytes, buffer, &noOfBytesTransferred);
which writes a byte a data along with the 9th clock for the acknowledge bit.

For some reason, the code then calls this
Code: [Select]
{/*Get ack*/
noOfBytes = 1;
noOfBytesTransferred = 0;
INFRA_SLEEP(1);
status = FT_Channel_Read(I2C, handle, noOfBytes, inBuffer,
&noOfBytesTransferred);

I'm confused about the
Code: [Select]
/*Get Ack*/ code.  Exactly where does the I2C library read the ACK bit?

From what I can tell the library reads the acknowledge bit AFTER the 9th clock.  Is this correct?

Based on my understanding of I2C, this is the wrong time to read the acknowledge bit.



Title: Re: LibMPSSE I2C Library ACK Issue
Post by: FTDI Community on January 09, 2024, 01:36:13 PM
Hi,

This is a known issue, and there is a fix. if you send an email to support1@ftdichip.com, we can send you a fixed version.

Best Regards
FTDI Community
Title: Re: LibMPSSE I2C Library ACK Issue
Post by: BigApple on January 09, 2024, 04:52:01 PM
Sounds good thank you!