FT232H using Python 3.8.1 on a PC to drive I2C devices

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
markm1701
 
Posts: 3
Joined: Wed Jun 07, 2017 2:11 am

FT232H using Python 3.8.1 on a PC to drive I2C devices

Post by markm1701 »

Hi Everyone

I'm attempting to use the FT232H breakout board to drive a I2C SMART LED (ThingM, BlinkM)
I've followed the setup article here https://learn.adafruit.com/circuitpytho ... 2h/overiew

one point to note is that when i attempt to connect to my ft232h i don't get a serial number
interfacelist.png
interfacelist.png (10.8 KiB) Viewed 1441 times
i did read some other users that found the FT232H chips had blank eeproms

Normal GPIO is work (blinking a led on the C0 pin of the board
I've tested the Smart LED on a Raspberry PI using the blinka libraries and i'm able to control it here just fine at i2c addresss 0x09

I'm now trying to use the I2C bus using the FT232H board

i've tied my D0 pin to the SCL pin the led
ive tied my D1 + D2 pins to the SDA pin on the led
both of these pins are pulled up via a 4.7K resistor to 5V near the FT232H board
5v and Gnd operating to my LED also


the following code gives me an exception from the pyftdi library

Code: Select all

import board
import busio
addr=0x09
bus=busio.I2C(board.SCL,board.SDA)
buffer=bytearray([0x70,0x05,0x00,0x00])
bus.writeto(addr,buffer)

Code: Select all

Traceback (most recent call last):
  File "d:/Devwork/Python/working/source/busio_i2c_test.py", line 7, in <module>
    bus.writeto(addr,buffer)
  File "d:\Devwork\Python\working\lib\site-packages\busio.py", line 86, in writeto
    return self._i2c.writeto(address, buffer, stop=stop)
  File "d:\Devwork\Python\working\lib\site-packages\adafruit_blinka\microcontroller\ft232h\i2c.py", line 19, in writeto
    port.write(buffer[start:end], relax=stop)
  File "d:\Devwork\Python\working\lib\site-packages\pyftdi\i2c.py", line 130, in write
    return self._controller.write(
  File "d:\Devwork\Python\working\lib\site-packages\pyftdi\i2c.py", line 704, in write
    self._do_prolog(i2caddress)
  File "d:\Devwork\Python\working\lib\site-packages\pyftdi\i2c.py", line 1009, in _do_prolog
    raise I2cNackError('NACK from slave')
pyftdi.i2c.I2cNackError: NACK from slave
any suggestion or help would be appreciated, thanks in advance

markm1701
 
Posts: 3
Joined: Wed Jun 07, 2017 2:11 am

Re: FT232H using Python 3.8.1 on a PC to drive I2C devices

Post by markm1701 »

well i managed to find the issue, it appears to be default frequency which is 400,000
i have reduced this down to 1000.
I don't know yet if its the SMART LED or something else with my setup but the reduced speed works,

after further trials i can increase to 50,000 before i start to see failures

Code: Select all

import board
import busio

addr=0x09
bus=busio.I2C(board.SCL,board.SDA,frequency=1000)
buffer=bytearray([0x70,0x04,0x00,0x00])
bus.writeto(addr,buffer)


markm1701
 
Posts: 3
Joined: Wed Jun 07, 2017 2:11 am

Re: FT232H using Python 3.8.1 on a PC to drive I2C devices

Post by markm1701 »

One Additional note here, as i mentioned in my original post the code that tests the connection to the FT232H chip
showed no serial number

This was caused by the EEPROM being blank on FT232H

I downloaded and installed FT_PROG from FTDI here https://www.ftdichip.com/Support/Utilities.htm#FT_PROG

FT_PROG uses the FTDI driver in order to communicate, so if you have already run ZADIAG to install the LibusbK driver
you'll need to uninstall the Libusbk driver using device manager. (make sure you choose the option to uninstall the driver, or
when you plug the FT232H board back it will re-use the LibusbK driver.
Now unplug the board and plug the board back in again, this should revert installation back to the FTDI driver

when you run FT_PROG, goto the Device menu and click on Scan and Parse.
This will detect the any FT232H boards connected and it will confirm if the EEPROM is blank
if it is blank it load all the default settings. the only settings I changed where under the tree FT EEPROM / Hardware Specific / IO Controls,
set C8 to TX&RXLED# and C9 to PWREN#
Now Click on the Devices Menu and choose program
Finally click on the Program button to program the EEPROM.
Once this completes remove the connection and re-connect the device to your system.
you now can run ZADIAG again to re-install the LibusbK driver.

I don't think caused any of my issues, but i was suprised the FT232H was blank

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”