Tested locally with an MCP2221 and SGP40 connected via STEMMA QT cable.
(blinka) hellokitty@bench:~$ python3
Python 3.8.10 (default, Jun 2 2021, 10:49:15)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import board
>>> import adafruit_sgp40
>>> sgp = adafruit_sgp40.SGP40(board.I2C())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/hellokitty/blinka/lib/python3.8/site-packages/adafruit_sgp40.py", line 115, in __init__
self.initialize()
File "/home/hellokitty/blinka/lib/python3.8/site-packages/adafruit_sgp40.py", line 144, in initialize
self._reset()
File "/home/hellokitty/blinka/lib/python3.8/site-packages/adafruit_sgp40.py", line 152, in _reset
self._read_word_from_command(delay_ms=50)
File "/home/hellokitty/blinka/lib/python3.8/site-packages/adafruit_sgp40.py", line 243, in _read_word_from_command
i2c.write(self._command_buffer)
File "/home/hellokitty/blinka/lib/python3.8/site-packages/adafruit_bus_device/i2c_device.py", line 84, in write
self.i2c.writeto(self.device_address, buf, start=start, end=end)
File "/home/hellokitty/blinka/lib/python3.8/site-packages/busio.py", line 157, in writeto
return self._i2c.writeto(address, memoryview(buffer)[start:end], stop=stop)
File "/home/hellokitty/blinka/lib/python3.8/site-packages/adafruit_blinka/microcontroller/mcp2221/i2c.py", line 19, in writeto
self._mcp2221.i2c_writeto(address, buffer, start=start, end=end)
File "/home/hellokitty/blinka/lib/python3.8/site-packages/adafruit_blinka/microcontroller/mcp2221/mcp2221.py", line 315, in i2c_writeto
self._i2c_write(0x90, address, buffer, start, end)
File "/home/hellokitty/blinka/lib/python3.8/site-packages/adafruit_blinka/microcontroller/mcp2221/mcp2221.py", line 233, in _i2c_write
raise RuntimeError("I2C slave address was NACK'd")
RuntimeError: I2C slave address was NACK'd
>>>
The _reset func looks a bit hack-ish, like it expects some kind of exception to be thrown. And for MCP2221, this ends up being a different exception. Otherwise, traffic looks nominally the same for MCP2221 and a QtPy running native CP.
Re this thread: https://forums.adafruit.com/viewtopic.php?f=19&t=182647
Tested locally with an MCP2221 and SGP40 connected via STEMMA QT cable.
The
_reset
func looks a bit hack-ish, like it expects some kind of exception to be thrown. And for MCP2221, this ends up being a different exception. Otherwise, traffic looks nominally the same for MCP2221 and a QtPy running native CP.QTPY
MCP2221