Scan does, driver doesn't find chip
Closed this issue · 15 comments
I have a custom build Adafruit CircuitPython 7.3.0-alpha.0-38-g862210b3f-dirty on 2022-03-13; Adafruit Trinket M0 with samd21e18
with 24lc32
frozen.
I can find the chip via I2C scan at the address 0x50 but the driver doesn't find it there.
import board
import time
import adafruit_24lc32
import supervisor
supervisor.disable_autoreload()
i2c = board.I2C()
# scan I2C
while not i2c.try_lock():
pass
try:
while True:
print(
"I2C addresses found:",
[hex(device_address) for device_address in i2c.scan()],
)
time.sleep(1)
finally: # unlock the i2c bus when ctrl-c'ing out of the loop
i2c.unlock()
# setup for EEPROM
eeprom = adafruit_24lc32.EEPROM_I2C(i2c_bus=i2c)
I2C addresses found: ['0x50']
Traceback (most recent call last):
File "code.py", line 24, in <module>
File "adafruit_24lc32.py", line 240, in __init__
ValueError: No I2C device at address: 0x50
Does that code work if it's not baked into the UF2?
After adding adafruit_bus_device
too, I get:
Traceback (most recent call last):
File "code.py", line 49, in <module>
File "adafruit_24lc32.py", line 240, in __init__
File "/lib/adafruit_bus_device/i2c_device.py", line 61, in __init__
File "/lib/adafruit_bus_device/i2c_device.py", line 183, in __probe_for_device
ValueError: No I2C device at address: 0x50
Latest firmware and bundle.
I noticed that i2c.scan()
picks up the chip only on a fraction of the tries. I'm new to i2c so I thought it was normal but an mcp23017 is picked up on every try so I suspect this is not the right behavior. I think the pulls are OK: addresses and WP are pulled down directly, SCL and SCK are pulled up through 5k resistors.
Could it be a faulty chip, or is my circuit wrong, or...?
@muranyia if your up for it I would recomend to join our discord https://adafruit.it/discord there is a help-with-circuitpython channel where you can get help troubleshooting things.
can you post a picture of your wiring? also let us know what specific device you are connecting to, is it this? https://www.adafruit.com/product/5146
The device is a bare DIL 24lc32a and the wiring is like this.
Never used discord but I'll try to figure it out.
No reply on discord...
I figured out that once I connect an ssd1306 device to the bus, the 24lc32 gets picked up too.
When I disconnect the clock pin of the ssd1306 the board loses the 24lc32 too.
Tried with a Trinket M0 and a Feather M4 Express, same behavior.
Tried with different pullups, no dice. The question is, what does the ssd1306 do to the bus that makes it work?
Wait, SCK? Did you mean SDA?
You could also try 10k resistors. Also try another 24LC32 as well just to rule out something wrong with that unit.
Yes I meant SDA... sry. Will try with 10k. 5k and 2k didn't work.
You could also try changing the frequency using the frequency
argument:
i2c = busio.I2C(board.SCL, board.SDA, frequency=50000) # Set frequency to 50 kHz
Not sure if that will work, but it's something to try.
frequency=50000
throws Unsupported baudrate
. N.B. with the ssd1306 connected I had no problems going up to 400kHz. I only have an issue when the ssd1306 is not on the bus.
But! The 10k pullups seem to work. I test a few things (my display is not working right now) and if everything is fine I will come back to close the issue.
Sounds great! Glad it's working out so far!
Did your tests end up working out?
Couldn't test extensively but len()
gives the right length so I assume everything is fine. Thanks again!