I2CDevice fails to probe device_address on Itsybitsy rp2040

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
2bndy5
 
Posts: 10
Joined: Mon Jun 24, 2019 10:11 pm

I2CDevice fails to probe device_address on Itsybitsy rp2040

Post by 2bndy5 »

I'm working on a lib that uses a sensor with no built-in pull-ups for the SDA and SCL lines. I've tried 4.7 kohm and 10 kohm resistors pulling up the SDA and SCL lines to 3v.

I noticed that my itsybitsy rp2040 fails to probe the specified address (0x2A) when instantiating an I2CDevice object. However, if I manually probe for the address using a busio.I2C.scan() first, then the I2CDevice object can correctly probe the device_address upon instantiation. I tried CirPy v8.0.4 and v7.3.3, and both exhibit the same behavior.

Code: Select all

import board
from adafruit_bus_device.i2c_device import I2CDevice

i2c = board.I2C()

while i2c.try_lock():
    pass
addrs = i2c.scan()  # needed on itsy rp2
i2c.unlock()
assert 0x2A in addrs,  "could not find device at address 0x2A"

device = I2CDevice(i2c, 0x2A)
I2CDevice instantiates fine without manual probing the address on my Itsybitsy M4 using either 4.7 kohm or 10 kohm resistors. So, now I'm wondering if this is still a wiring issue or an actual bug. I'm starting to suspect the later.

Code: Select all

import board
from adafruit_bus_device.i2c_device import I2CDevice

i2c = board.I2C()
device = I2CDevice(i2c, 0x2A)  # probes address correctly on itsy m4
Running the above code on itsybitsy rp2040 results in

Code: Select all

ValueError: No I2C device at address: 0x2a
However, if I run the last line again, then I2CDevice instantiates without error.

User avatar
2bndy5
 
Posts: 10
Joined: Mon Jun 24, 2019 10:11 pm

Re: I2CDevice fails to probe device_address on Itsybitsy rp2040

Post by 2bndy5 »

I'm now seeing a similar issue on github (https://github.com/adafruit/circuitpython/issues/5871), but it is related to using the pure python lib where my problem is with the builtin lib.

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”