I believe there's a bug in the mbed library r91. I have been dealing with other unrelated I2C issues, but when creating new test apps, this bug sent me off on a tangent when trying to debug.
Using the following code, I can reproduce issues with r91 vs. r88.
#include "mbed.h"
I2C i2c(PTE25, PTE24); // sda, scl
int main()
{
while( true) {
// this block works with mbed r88, but does not with r91
// r91 results in the address getting sent on the bus, but not the data
char data[4] = { 'n', 0, 255, 0 };
i2c.write( 0x12, data, 4);
// this block works with mbed r88 and r91
/*
i2c.start();
i2c.write( 0x12);
i2c.write( 'n');
i2c.write( 0);
i2c.write( 255);
i2c.write( 0);
i2c.stop();
*/
}
}
Running this as-is under r91, you'll see that only the address 0x12 is sent on the bus. Running this as-is under r88, you'll see that the address AND data are sent on the bus. I wish I could attach photos, but for whatever reason the file upload dialog doesn't seem to be working on this site.
Running the commented block of code instead, both revisions of the mbed library work.
I believe there's a bug in the mbed library r91. I have been dealing with other unrelated I2C issues, but when creating new test apps, this bug sent me off on a tangent when trying to debug.
Using the following code, I can reproduce issues with r91 vs. r88.
Running this as-is under r91, you'll see that only the address 0x12 is sent on the bus. Running this as-is under r88, you'll see that the address AND data are sent on the bus. I wish I could attach photos, but for whatever reason the file upload dialog doesn't seem to be working on this site.
Running the commented block of code instead, both revisions of the mbed library work.