With the old .s19, everything seems to work as it should, so I can only assume something has changed in the new SDK that has broken my code. Is there anything new I have to do in the new SDK (2.5.2) to make I2C read correctly?
Some observations:
With both the send and read, when you power cycle the device, you get two good reads, then an I2C_TIMEOUT (4).
With only the send, if the device had I2C_TIMEOUTS before (not power cycled) and it is programmed, I get more I2C_TIMEOUTS.
With only the send, and you power cycle the device, you always get I2C_OK back.
Here's a simplified version of what I am trying to do (I'm using I2CMaster):
Code: Select all
I2CInit();
while(1)
{
BYTE command = 0x88;
BYTE buffer = '\0';
I2CStat = I2CSendBuf(0x28, &command, 1, true);
Log("S:%X\r\n", I2CStat);
I2CStat = I2CReadBuf(0x28, &buffer, 1, true);
Log("R:%X\r\n", I2CStat);
unsigned short test = (&buffer)[0];
endian_swap(test);
Log("%i\r\n", test);
OSTimeDly(10);
}
Code: Select all
S:0 <-- Send result
R:2 <-- Read Result
1536 <-- read value
S:0
R:2
768
S:4
R:4
0
S:4
R:4
0
Brian