SparkFun Pro Micro RP2040 Qwiic I2C does not behave as expected.

The Qwiic connector on the ProMicro RP2040 does not seem to be usable as a hardware-supported I2C connector under MicroPython. (MicroPython v1.17 on 2021-09-02; Raspberry Pi Pico with RP2040).

The only rp2 module that I can find is the version for the original Raspberry Pi Pico. It seems to hard code allowed values for hardware resources like I2C(1).

The code I am attempting to use is:

import rp2
import machine

print("i2c bus: 1")
i2c1 = machine.I2C(1, scl=machine.Pin(17), sda=machine.Pin(16), freq=100000)
output = i2c1.scan()
print(output, len(output))
print("Done")

The response I consistently receive is:

i2c bus: 0
[] 0
i2c bus: 1
Traceback (most recent call last):
  File "<stdin>", line 20, in <module>
ValueError: bad SCL pin
>>>

I get the same behavior with other ‘improved’ version boards such as AdaFruit’s QtPy RP2040 that provide a Qwiic connector.

The same code works nicely on the original Raspberry Pi Pico board. It seems that the pins need to be mapped exactly as on the original board or or some changes must be setup in a custom rp2 module for the Qwiic connector to behave usefully.

It is suggestive that your ‘Getting started’ documents show using the Qwiic connector in an odd and rather silly way, not for I2C.

Can you suggest a source for an rp2 module that will work correctly with your board? Or some other work around? I don’t want to use SoftI2C.

Carbuncle

FWIW, the SoftI2C works on these pins, but this is totally not what I want.

as in:

i2cs = machine.SoftI2C(scl=machine.Pin(17), sda=machine.Pin(16), freq=100000, timeout=200)
output = i2cs.scan()

That might do for some folks, but not me.

Close reading of the of the “RP2040 Datasheet” seems to imply that the machine.Pin.PIN_ALT parameter might allow selection of alternate pin functions as I wish, but I see no indication that this is implemented on the RP2 port of MicroPython,

If this is so, it should be noted in the product information.

If it applies to I2C, it applies to all the other ‘ALT’ function pin assignments.

Carbuncle