I2C (advanced) Read Issue
I2C (advanced) Read Issue
Hello,
In searching through this forum I found a reference to the advanced I2C functions having an issue with the I2CRead, specifically that the first read did not return correctly and that an I2C_SET_NO_ACK had to be issued after the first I2CRead and then another I2CRead to obtain the correct value. This was stated to be fixed but still looks to be broken. Will there be a proper fix to I2CRead?
Thanks,
Mark
In searching through this forum I found a reference to the advanced I2C functions having an issue with the I2CRead, specifically that the first read did not return correctly and that an I2C_SET_NO_ACK had to be issued after the first I2CRead and then another I2CRead to obtain the correct value. This was stated to be fixed but still looks to be broken. Will there be a proper fix to I2CRead?
Thanks,
Mark
Re: I2C (advanced) Read Issue
Hi Mark. Can you send a link to the post you are referring to?
Re: I2C (advanced) Read Issue
Code: Select all
{
int iRtn;
BYTE address = 0x22; //mpc23008 address, U13
BYTE addr_gpio = 0x09; //gpio register address
BYTE data_gpio = 0; //variable to hold gpio read
iRtn = I2CStart(address, I2C_START_WRITE, I2C_START_TIMEOUT);
iprintf( "I2CStart = %d\r\n>", iRtn );
iRtn = I2CSend(addr_gpio, I2C_RX_TX_TIMEOUT);
iprintf( "I2CSend = %d,I2CRtn= %d\r\n>", addr_gpio, iRtn );
iRtn = I2CRestart(address, I2C_START_READ);
iprintf( "I2CRestart = %d\r\n>", iRtn );
iRtn = I2CRead(&data_gpio, I2C_RX_TX_TIMEOUT);
iprintf( "I2CRead = %d,I2CRtn= %d\r\n>", data_gpio, iRtn );
iprintf("LED Value= %X\r\n>", data_gpio);
//This is an issue that was supposed to be resolved (see NB forum and i2cmaster.h description)
I2C_SET_NO_ACK;
iRtn = I2CRead(&data_gpio, I2C_RX_TX_TIMEOUT);
iprintf( "I2CRead = %d,I2CRtn= %d\r\n>", data_gpio, iRtn );
iprintf("LED Value= %X\r\n>", data_gpio);
iRtn = I2CStop();
printf( "I2CStop = %x\r\n>", iRtn );
return data_gpio;
}
Re: I2C (advanced) Read Issue
Thanks Mark, but what I was really looking for was just a link to the thread so we can read the details.
Re: I2C (advanced) Read Issue
I gave the link!
Re: I2C (advanced) Read Issue
Sorry, I scrolled to the last entry and saw your code post. Didn't realize you made two separate ones. What release are you using?
Re: I2C (advanced) Read Issue
Release 2.7.5
Re: I2C (advanced) Read Issue
BTW, the code snippet that I provided is my code that will help demonstrate the issue. If the remove the I2C_SET_NO_ACK along with the second read you will see that the first read provides incorrect data.
Re: I2C (advanced) Read Issue
Any updates on this issue? Has it been verified/corrected?