How to use I2C on imp005?

Hello all,

I am so new in electric imp and am trying to use the I2C on imp005 and looking at sample codes in electric imp tutorials.
Even I copy source code from tutorial to my model, it does not work well.

What is the problem with below code?

i2c <- hardware.i2c0;
i2c.configure(CLOCK_SPEED_100_KHZ);
i2c.write(0x08, “\xA5”);

When I check I2C lines using Logic Analyzer, I am seeing just address byte (0x08) on I2C SDA line. Where is the missing 0xA5 data?
If I send one more byte like i2c.write(0x08, “\xA5\xA6”), I am seeing one more byte but it says ‘address 0x08’ for writing, ‘address 0xFF’ byte for reading.

Any idea?
Thank you.

Unless the address byte is ACKed by the I2C slave, no data will be sent. You will be seeing an error returned from your i2c write indicating that the slave did not ACK.

(based on the ticket which says you’re using an ADS7924…)

See page 22 of the ADS7924 datasheet. If the chip does not recognize the address on the bus (or is configured for address 0x92, for example) then SDA will be high on the 9th clock, which means the device is not acknowledging the transaction.

If you post a picture of the waveforms - either here or on the ticket - we may be able to help more.