MOD5270, I2C and latest software problem
Posted: Tue May 10, 2011 5:19 am
We have the MOD5270. Our old NetBurner software is from around2009ish... I've formatted my computer since then, so I do not have it. We bought the latest software, and I ported the source code into a new project. The OLD .s19 program reads the I2C values correctly. The exact same source code compiled on the new NetBurner SDK has all sorts of problems reading the I2C values.
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):
And some output from this:
Thanks,
Brian
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