An archive of community.esquilo.io as of Saturday January 26, 2019.

# I2C Not Transmitting

SJM_JFK

Having trouble writing data via I2C.

I thought maybe the problem was with the PCA9956B LED driver we're evaluating but just to be sure, I scoped the SDA and SCL pins and they never go low for a start condition.

i2C0 <- I2C(0);
i2C0.speed(100000);
i2C0.write8(1, 0); -- Halts here with error: %%Runtime error [I2C write error]

I'm using 2.2Kohm pullups on both lines and the documentation looks like instantiating I2C overrides the GPIO use of the port.

Scott_Shumate

An I2C write error is almost always because the device did not ACK the address byte on the I2C bus. This can be for a number of reasons - using the wrong device address, a wiring or pull-up problem, or a problem with the device itself. You can use the code below to scan all addresses on the bus for your device:

i2c <- I2C(0);
i2c.speed(100000);
for (local i = 1; i < 128; i++) {
}