UnitV maixpy I2C slave
-
Hi,
I have a K210 unitV with default firmware. On this module is running a little demo software, essentially the I2C slave-demofrom machine import I2C import time def on_receive(data): print(data) def on_transmit(): print("on_transmit") def on_event(event): print("on_event:", event) i2c = I2C(I2C.I2C0, mode=I2C.MODE_SLAVE, scl=34, sda=35, addr=0x24, addr_size=7, on_receive=on_receive, on_transmit=on_transmit, on_event= on_receive) print("start") while True: time.sleep(20)
On the other side I have a M5StickPro, with this code inside loop:
Wire.beginTransmission(0x24); Wire.write(1); int error = Wire.endTransmission();
I have seen that the on_receive function receives an extra 0 before the data and an extra 2 after... something like:
0 // ??
1 // This is the data sent
2 // ??
Moreover, if I change the address (say 0x23 instead of 0x24) on the M5Stick beginTransmission, the unit receives always a 0
I have tested the I2C scanner default software of M5StickPro and it identifies the right address of UnitV, however on K210 side it is full of zeroes foreach
Wire.beginTransmission(address) // Here address changes from 1 to 127Any idea why thi happens?
Many thanks -
Ehy there!
We're having essentially what seems to be the same problem: we're able to use raw i2c to read data from other m5stack sensor units, but the k210 (ov7740 version) has to be programmed from scratch with the maixpy port of micropython, and every test we did so far ends up causing the other device we're using as i2c master (core2 specifically) to throw an "OSError: I2C bus error (110)", which we are guessing (maybe wrongly) to be a timeout error.The maixpy documentation on i2c slaves as opposed to master mode seems somewhat lacking in regards to this specific use case, and so we were wondering if anyone was able to properly initialize the i2c object within the unitv unit so that data can be read from the bus.
-