Maixduino's I2C support for MaixPy

Schematic of Maixduino shows I2C1_SCL and I2C1_SDA are 31 and 32 pins. It also indicates that both pins are pulled up by 2K resistors. However, the result of board_info doesn’t match:

|---Pin----|-----Function----------|
|   31     |     MIC0_DATA         |
+----------|-----------------------+
|---Pin----|-----Function----------|
|   32     |     MIC0_BCK          |
+----------|-----------------------+

How can I use I2C with MaixPy on Maixduino?

http://dl.sipeed.com/MAIX/HDK/Maixduino/Maixduino-4.30/Maixduino-4.30%28schematic%29.pdf

I don’t have a maixduino but have a maix go. The schematic for the go looks similar with SCL and SDA marked as 31 and 32 in pdf. However printed on back of my board shows SCL of 30 and SDA of 31.

I think it’s probably confusion on both our parts. Maix go schematic shows the following:

SCL - Pin 31 (io30)
SCD - Pin 32 (io31)

I guess we should be using the io numbering and not the pin numbering. Out-by-one bug strikes again!

Here is some python that prints out two devices [38, 72] on my go.

from machine import I2C

print("I2C Scan")
i2c = I2C(I2C.I2C0, freq=100000, scl=30, sda=31)
devices = i2c.scan()
print(devices)
print("Done")

Thank you for replying.
Unfortunately, the I2C device isn’t listed in i2c.scan() result with even scl=30, sda=31 settings. The device works well with Arduino Uno R3.
I’m wondering I2C.I2C0 part as well.
Looks like some device (slave id 33) is connected to Maixduino by default at I2C2.

Hi guys, i would like help, but

maybe here there is something
https://maixpy.sipeed.com/zh/libs/machine/i2c.html

1 Like