MAIX BIT I2C Slave_Mode not working, can anyone help?

Hello,
I am quite new to Sipeed and have purchased a Maix Bit v2.

I need to configure the board as a slave device but the example on the Sipeed website doesn’t seem to work. The board works okay in the master mode but just hangs the I2C lines when configured as a slave using the following routine.

from machine import I2C

count = 0

def on_receive (data):
    print ("on_receive:", data)

def on_transmit ():
    count = count + 1
    print ("on_transmit, send:", count)
    return count

def on_event (event):
    print ("on_event:", event)

i2c = I2C (I2C.I2C0, mode = I2C.MODE_SLAVE, scl = 28, sda = 29, addr = 0x09, addr_size = 7, on_receive = on_receive, on_transmit = on_transmit, on_event = on_event)

If I hold down the Maix BIT reset button the rest of the i2c bus works okay.  it would appear that the SCL is clocking okay on pin 28 but the SDA on pin 29 is being held high.

The master device is an arduino nano and I am using a voltage shifter to manage the different logic levels.  The hardware works okay when the Maix Bit is the Master and the nano is the Slave.
Can anyone help me on this please?.

Thanks

ikna

Hello,

I am quite new to Sipeed and have purchased a Maix Bit v2.

I need to configure the board as a slave device but the example on the Sipeed website doesn’t seem to work. The board works okay in the master mode but just hangs the I2C lines when configured as a slave using the routine below.

If I hold down the Maix BIT reset button the rest of the i2c bus works okay. it would appear that the SCL is clocking okay on pin 28 but the SDA on pin 29 is being held high.

The master device is an arduino nano and I am using a voltage shifter to manage the different logic levels. The hardware works okay when the Maix Bit is the Master and the nano is the Slave.
Can anyone help me on this please?.

Thanks

ikna

from machine import I2C

count = 0

def on_receive (data):
    print ("on_receive:", data)

def on_transmit ():
    count = count + 1
    print ("on_transmit, send:", count)
    return count

def on_event (event):
    print ("on_event:", event)

i2c = I2C (I2C.I2C0, mode = I2C.MODE_SLAVE, scl = 28, sda = 29, addr = 0x09, addr_size = 7, on_receive = on_receive, on_transmit = on_transmit, on_event = on_event)

Hello,

I should have mentioned that I have included an endless while loop at the end of the routine that does nothing.

I got it working.

Hi. I had the same problem. How did you solve it? Thanks.