Closed Mynogs closed 4 years ago
Confirmed. Fixed by #312 Please note that you will need to modify your lua code as well:
block.d = i2c.attach(i2c.I2C0, i2c.MASTER, 100000)
...
block.d:start()
block.d:address(0x08, false)
block.d:write(123)
block.d:start()
block.d:address(0x08, true)
local read1, read2, read3 = block.d:read(3)
block.d:stop()
print(read1, ' ', read2, ' ', read3)
I have an ESP32 (master) connected to an ATmega88 (slave) via I2C. I write this program on the ESP32:
When I trace the bus with the logic analyzer I see this:
Each time a byte is fetched from the slave, the value is incremented. You can see that four bytes are fetched, but in the program there are only three
blocks.d:read()
. Why is the reason for this behavior? It looks like the fourth byte is send afterblock.d:stop()
.