1
Discussion - Software / Multi-byte read fails in I2C_DeviceRead, LibMPSSE_1.0.3 - no NACK by FT2232H
« on: July 31, 2023, 10:42:16 PM »
I'm using LibMPSSE_1.0.3 and encountered a problem doing multi-byte reads using I2C_DeviceRead on an FT2232H (FTDI-Click board). The FT2232H reads the first byte (from an EEPROM) correctly, but shows a NACK. This causes the following bytes to be read as 0xFF, 0xFF, etc. which also have NACKs.
I'm using the command:
FtStatus = I2C_DeviceRead(FtHandle, SlaveAddress, sizeof(ReadData), ReadData, &SizeXferred,
I2C_TRANSFER_OPTIONS_START_BIT | // Give repeated start after address write
I2C_TRANSFER_OPTIONS_STOP_BIT |
I2C_TRANSFER_OPTIONS_FAST_TRANSFER_BYTES );
I also tried:
FtStatus = I2C_DeviceRead(FtHandle, SlaveAddress, sizeof(ReadData), ReadData, &SizeXferred,
I2C_TRANSFER_OPTIONS_START_BIT | // Give repeated start
I2C_TRANSFER_OPTIONS_STOP_BIT |
I2C_TRANSFER_OPTIONS_NACK_LAST_BYTE);
This also reads the data back as <correct 1st byte>, 0xFF, 0xFF...
This appears to be related to an older post: http://www.ftdicommunity.com/index.php?topic=241.msg741#msg741
Given the age of the previous post, and that it refers to lib SW which I can no longer find (for example, the poster refers to changing an "if 1" statement to an "if 0" statement on line 1400 of ftdi_i2c.c - and there's no statement anything like that in the latest ftdi_i2c.c), I'm wondering the following:
Thanks,
Bryant (just getting started with FTDI devices, appreciate the help)
I'm using the command:
FtStatus = I2C_DeviceRead(FtHandle, SlaveAddress, sizeof(ReadData), ReadData, &SizeXferred,
I2C_TRANSFER_OPTIONS_START_BIT | // Give repeated start after address write
I2C_TRANSFER_OPTIONS_STOP_BIT |
I2C_TRANSFER_OPTIONS_FAST_TRANSFER_BYTES );
I also tried:
FtStatus = I2C_DeviceRead(FtHandle, SlaveAddress, sizeof(ReadData), ReadData, &SizeXferred,
I2C_TRANSFER_OPTIONS_START_BIT | // Give repeated start
I2C_TRANSFER_OPTIONS_STOP_BIT |
I2C_TRANSFER_OPTIONS_NACK_LAST_BYTE);
This also reads the data back as <correct 1st byte>, 0xFF, 0xFF...
This appears to be related to an older post: http://www.ftdicommunity.com/index.php?topic=241.msg741#msg741
Given the age of the previous post, and that it refers to lib SW which I can no longer find (for example, the poster refers to changing an "if 1" statement to an "if 0" statement on line 1400 of ftdi_i2c.c - and there's no statement anything like that in the latest ftdi_i2c.c), I'm wondering the following:
- Did this bug get fixed going from previous version (0.6?) to 1.0.3?
- If not fixed, is anyone acquainted with this problem and have a solution?
- If fixed, what settings in the function call will properly read multiple bytes?
Thanks,
Bryant (just getting started with FTDI devices, appreciate the help)