Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

"No I2C device at address" for multiple sensors with FT232H
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

"No I2C device at address" for multiple sensors with FT232H

by dcuccia on Sun Aug 30, 2020 7:18 pm

Hello!

I 'm trying to use Blinka library to talk to I2C devices, such as the TCS34725 and TSL2591 light sensors, via the Adafruit FT232H breakout.

I have been unable to successfully connect to either sensor. I've tried with two FT232H boards (one with soldered pins, one "free floating"), via D0/D1 pins or via the StemmaQT connector (just in case the StemmaQT pinout was wrong).

Here's some example code that succeeds on busio.I2C() initialization, but fails on connection ("No I2C device at address: 29"):

Code: Select all | TOGGLE FULL SIZE
PS C:\Users\David> python
>>> import board
>>> import busio
>>> import adafruit_tcs34725
>>> i2c = busio.I2C(board.SCL, board.SDA)
>>> sensor = adafruit_tcs34725.TCS34725(i2c)
Traceback (most recent call last):
  File "C:\Users\David\AppData\Roaming\Python\Python38\site-packages\adafruit_bus_device\i2c_device.py", line 172, in __probe_for_device
    self.i2c.writeto(self.device_address, b"")
  File "C:\Users\David\AppData\Roaming\Python\Python38\site-packages\busio.py", line 116, in writeto
    return self._i2c.writeto(address, buffer, stop=stop)
  File "C:\Users\David\AppData\Roaming\Python\Python38\site-packages\adafruit_blinka\microcontroller\ft232h\i2c.py", line 27, in writeto
    port.write(buffer[start:end], relax=stop)
  File "C:\Users\David\AppData\Roaming\Python\Python38\site-packages\pyftdi\i2c.py", line 134, in write
    return self._controller.write(
  File "C:\Users\David\AppData\Roaming\Python\Python38\site-packages\pyftdi\i2c.py", line 724, in write
    self._do_prolog(i2caddress)
  File "C:\Users\David\AppData\Roaming\Python\Python38\site-packages\pyftdi\i2c.py", line 1022, in _do_prolog
    self._send_check_ack(cmd)
  File "C:\Users\David\AppData\Roaming\Python\Python38\site-packages\pyftdi\i2c.py", line 1054, in _send_check_ack
    raise I2cNackError('NACK from slave')
pyftdi.i2c.I2cNackError: NACK from slave

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\David\AppData\Roaming\Python\Python38\site-packages\adafruit_bus_device\i2c_device.py", line 178, in __probe_for_device
    self.i2c.readfrom_into(self.device_address, result)
  File "C:\Users\David\AppData\Roaming\Python\Python38\site-packages\busio.py", line 106, in readfrom_into
    return self._i2c.readfrom_into(address, buffer, stop=stop)
  File "C:\Users\David\AppData\Roaming\Python\Python38\site-packages\adafruit_blinka\microcontroller\ft232h\i2c.py", line 33, in readfrom_into
    result = port.read(len(buffer[start:end]), relax=stop)
  File "C:\Users\David\AppData\Roaming\Python\Python38\site-packages\pyftdi\i2c.py", line 120, in read
    return self._controller.read(
  File "C:\Users\David\AppData\Roaming\Python\Python38\site-packages\pyftdi\i2c.py", line 684, in read
    self._do_prolog(i2caddress)
  File "C:\Users\David\AppData\Roaming\Python\Python38\site-packages\pyftdi\i2c.py", line 1022, in _do_prolog
    self._send_check_ack(cmd)
  File "C:\Users\David\AppData\Roaming\Python\Python38\site-packages\pyftdi\i2c.py", line 1054, in _send_check_ack
    raise I2cNackError('NACK from slave')
pyftdi.i2c.I2cNackError: NACK from slave

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\David\AppData\Roaming\Python\Python38\site-packages\adafruit_tcs34725.py", line 93, in __init__
    self._device = i2c_device.I2CDevice(i2c, address)
  File "C:\Users\David\AppData\Roaming\Python\Python38\site-packages\adafruit_bus_device\i2c_device.py", line 68, in __init__
    self.__probe_for_device()
  File "C:\Users\David\AppData\Roaming\Python\Python38\site-packages\adafruit_bus_device\i2c_device.py", line 180, in __probe_for_device
    raise ValueError("No I2C device at address: %x" % self.device_address)
ValueError: No I2C device at address: 29


i2c.scan() returns empty for both TCS34725 and TSL2591 breakouts.

My setup:
    - Python 3.8.5 on Windows 10 x64 (Windows 10 Insider Preview Build 20175).
    - libusbK driver installed
    - environment variable set ($env:BLINKA_FT232H=1)

Here's the result of pip list:

Code: Select all | TOGGLE FULL SIZE
PS C:\Projects\temp> pip list
Package                          Version
-------------------------------- -------
Adafruit-Blinka                  5.3.2
adafruit-circuitpython-busdevice 5.0.1
adafruit-circuitpython-tcs34725  3.3.3
adafruit-circuitpython-tsl2591   1.2.4
Adafruit-PlatformDetect          2.15.0
Adafruit-PureIO                  1.1.5
pip                              20.2.2
pyftdi                           0.51.2
pyserial                         3.4
pyusb                            1.0.2
setuptools                       47.1.0


I've done my best to test the wired connections for proper voltage and lack of "air gaps". I don't have a logic analyzer, so I'm not sure the best way to keep debugging.

Any thoughts? Does address 29 sound like the correct default? Should I move to testing with a CircuitPlaygroundExpress or equivalent, to confirm it's not the FT232H code?

Thanks in advance for any help you can provide!

David

dcuccia
 
Posts: 20
Joined: Fri Jan 25, 2013 9:13 pm

Re: "No I2C device at address" for multiple sensors with FT2

by mikeysklar on Mon Aug 31, 2020 1:32 pm

Hi David,

Thank you for your detailed troubleshooting write up. It certainly helps that you have used two FT232H boards and tried different wiring combinations. It looks to me like you are using all the correct CircuitPython libraries and libusbk support.

In your example I did not see you set the necessary environment variable for running BLINKA in FT232H mode.

Code: Select all | TOGGLE FULL SIZE
$env:BLINKA_FT232H=1


https://learn.adafruit.com/circuitpytho ... 2h/windows

Is it possible that you might have installed the FTDI VCP drivers which can conflict with the FTDI FT232H device? This is a Win10 issue that can arise.

viewtopic.php?f=19&t=166999

mikeysklar
 
Posts: 1695
Joined: Mon Aug 01, 2016 8:10 pm

Re: "No I2C device at address" for multiple sensors with FT2

by dcuccia on Mon Aug 31, 2020 2:51 pm

Thanks @mikeysklar. Yes, I did set that in the terminal (referenced above, but didn't show it, sorry!).

dcuccia
 
Posts: 20
Joined: Fri Jan 25, 2013 9:13 pm

Re: "No I2C device at address" for multiple sensors with FT2

by dcuccia on Mon Aug 31, 2020 6:07 pm

FWIW, I also have now replicated this issue on a separate machine (Windows 10 x64 version 20H2 - a non-preview release).

dcuccia
 
Posts: 20
Joined: Fri Jan 25, 2013 9:13 pm

Re: "No I2C device at address" for multiple sensors with FT2

by dcuccia on Mon Aug 31, 2020 6:29 pm

Attaching photo of my general setup
Attachments
IMG_20200831_151414-min.jpg
IMG_20200831_151414-min.jpg (923.41 KiB) Viewed 15 times

dcuccia
 
Posts: 20
Joined: Fri Jan 25, 2013 9:13 pm

Re: "No I2C device at address" for multiple sensors with FT2

by dcuccia on Mon Aug 31, 2020 6:45 pm

So...I feel dumb. Guess this is a good example of rubber duck debugging. I was glancing at the photo I uploaded and had a glancing thought..."Hey, what's that switch right there in the middle of the board for?? I2C Mode you say??". Looks like I failed the engineer test of reading Tony DiCola's docs close enough.

I'm all set - board's working as expected. Thanks for jumping in to help!

dcuccia
 
Posts: 20
Joined: Fri Jan 25, 2013 9:13 pm

Re: "No I2C device at address" for multiple sensors with FT2

by mikeysklar on Mon Aug 31, 2020 7:49 pm

Ha, thanks for pointing out the i2c switch. I've never used the device so it is good to know that it could be a factor. Good job getting it all going.

mikeysklar
 
Posts: 1695
Joined: Mon Aug 01, 2016 8:10 pm

Please be positive and constructive with your questions and comments.