Skip to content

I2C device error on Teensy 4.1 when trying to initialize a second device at the same address #4629

@anecdata

Description

@anecdata

Firmware

Adafruit CircuitPython 6.2.0 on 2021-04-05; FeatherS2 with ESP32S2
# vs.
Adafruit CircuitPython 6.2.0 on 2021-04-05; Teensy 4.1 with IMXRT1062DVJ6A

Code/REPL & Behavior

This works on 6.2.0 on a FeatherS2, with a SHT31D connected, but no SHT40 connected:

import board

i2c = board.I2C()

try:
    import adafruit_sht4x
    temp_dev = adafruit_sht4x.SHT4x(i2c)
    t = temp_dev.temperature
    print("SHT40", t, "°C")
except (OSError, RuntimeError) as e:
    import adafruit_sht31d
    temp_dev = adafruit_sht31d.SHT31D(i2c)
    t = temp_dev.temperature
    print("SHT31D", t, "°C")

Result:

code.txt output:
SHT31D 26.0841 °C

But same doesn't work on a Teensy 4.1:

code.txt output:
Traceback (most recent call last):
  File "code.txt", line 14, in <module>
  File "code.txt", line 12, in <module>
  File "adafruit_sht31d.py", line 155, in __init__
  File "adafruit_bus_device/i2c_device.py", line 50, in __init__
  File "adafruit_bus_device/i2c_device.py", line 166, in __probe_for_device
  File "adafruit_bus_device/i2c_device.py", line 163, in __probe_for_device
ValueError: No I2C device at address: 0x44

As expected, this is fine on the Teensy 4.1:

import board

i2c = board.I2C()

import adafruit_sht31d
temp_dev = adafruit_sht31d.SHT31D(i2c)
t = temp_dev.temperature
print("SHT31D", t, "°C")

Result:

code.txt output:
SHT31D 26.3806 °C

I tried to set temp_dev to None on exception and gc.collect(), but same result. Tried with context manager but there's no __exit__.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmimxrt10xxiMX RT based boards such as Teensy 4.x

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions