Hi,
I have a K210 unitV with default firmware. On this module is running a little demo software, essentially the I2C slave-demo
from 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 127
Any idea why thi happens?
Many thanks