circuitpython: Feather S2 i2c issue - can't find board
I’ve got a Feather S2 and this sparkfun board: https://www.sparkfun.com/products/16294 . The sparkfun board is at address 0x60 vs the 0x67 that adafruit has for their MCP9600 CircuitPython library.
So I wrote this code:
import time
import board
import busio
import adafruit_mcp9600
# frequency must be set for the MCP9600 to function.
# If you experience I/O errors, try changing the frequency.
i2c = busio.I2C(board.SCL, board.SDA, frequency=100000)
mcp = adafruit_mcp9600.MCP9600(i2c, address=0x60) # sparkfun default address is 60
while True:
print((mcp.ambient_temperature, mcp.temperature, mcp.delta_temperature))
time.sleep(1)
I get this error:
File “adafruit_bus_device/i2c_device.py”, line 102, in write OSError: [Errno 19] Unsupported operation
Then, after hitting control-D in the Mu REPL it just tells me there isn’t an I2C device at 0x60.
Someone in the Adafruit Discord mentioned running this code:
"""CircuitPython Essentials I2C Scan example"""
# If you run this and it seems to hang, try manually unlocking
# your I2C bus from the REPL with
# >>> import board
# >>> board.I2C().unlock()
import time
import board
i2c = board.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(2)
finally: # unlock the i2c bus when ctrl-c'ing out of the loop
i2c.unlock()
When I did that, it showed up once and then it stopped discovering the board.
On the Feather S2 I tried both with Circuit Python 6.0.1 and 6.1.0-beta2.
So, here are some steps I did to isolate the Feather S2:
- I tried different Stemma QT cables
- I tried the Adafruit AHT20 and that DID work with the Feather S2
- But for the sparkfun board that’s giving me issues, I tried it with a QT Py and that worked perfectly, It worked both with my original code and with the I2C scan Adafruit code.
So, in conclusion:
- The Sparkfun board works with the QT Py (Circuit Python 6.0.0).
- The Sparkfun board does not work with the Feather S2 neither with Circuit Python 6.0.1 nor Circuit Python 6.1.0-beta 2
- The Feather S2 isn’t completely broken for I2C as it works with the AHT20 - or at least it pases the I2C scan for the AHT 20.
Thanks!
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 18 (4 by maintainers)
all good, the MCP9600 really just isnt that great. we’re hoping the MCP9601 will fix that (but it isnt available to purchase yet)
Thanks for that reply - this is the first time I’m using a cutting edge board with Adafruit and so I wasn’t sure if the suggestion to use another chip was an indication of where development was going. Please don’t take my previous comment as whiny or ungrateful. I just read something between the lines that wasn’t there. Thanks again, both the CPY team and @UnexpectedMaker for your work on the board.