Hey guys, I've been playing around with the FT232H board: https://www.adafruit.com/products/2264 and I've come to a point where I actually want to use 2 of these boards on the same computer. Is there a way to connect to the different boards individually (at the same time)? I'm using the adafruit python library and it looks like it just looks for the first boards it sees and connects to that one (and they all have the same vid and pid).
Any idea how to make this work?
Using multiple FT232H devices on one computer
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Using multiple FT232H devices on one computer
What OS are you using?
- snabkey
- Posts: 3
- Joined: Sat Feb 14, 2015 8:04 pm
Re: Using multiple FT232H devices on one computer
I have the same question.. I am using Linux.
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Using multiple FT232H devices on one computer
From the host computer, the FT232 is a USB device, so you should be able to target your code for whatever device file or COM port is appropriate.
- snabkey
- Posts: 3
- Joined: Sat Feb 14, 2015 8:04 pm
Re: Using multiple FT232H devices on one computer
So I get that... I dont find any reference in the GPIO USB code that it pays attention to which device. It appears just to look for the FIRST device it finds. Do you have an example that might show us HOW to pick which one of the FT232h's we would be targeting?
I am a rookie - so be gentle.
Thanks so much for your help!
I am a rookie - so be gentle.
Thanks so much for your help!
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Using multiple FT232H devices on one computer
Hmm.. you're right that the code uses the first FTDI chip it finds, and I don't see a function that lets you specify a device file in the underlying code.
I know libftdi has functions to handle multiple devices.. you can get a list of all the FTDI chips connected to the bus, select them by index in the list, or by device file.
Let me check with the team who wrote the FT232 code and see if they know how to get at those functions.
I know libftdi has functions to handle multiple devices.. you can get a list of all the FTDI chips connected to the bus, select them by index in the list, or by device file.
Let me check with the team who wrote the FT232 code and see if they know how to get at those functions.
- tdicola
- Posts: 1074
- Joined: Thu Oct 17, 2013 9:11 pm
Re: Using multiple FT232H devices on one computer
Ah good question, yep right now the library just grabs the first device it finds by VID and PID. However I can push some changes to support enumerating and picking a device by number. Let me check what options are available in libftdi to see what we can expose for picking devices.
- tdicola
- Posts: 1074
- Joined: Thu Oct 17, 2013 9:11 pm
Re: Using multiple FT232H devices on one computer
Alright I just made a few small updates to the python library so you can list all connected device serial numbers, and open a specific device given the serial number.
First you'll want to update your python code by grabbing the latest code from github here: https://github.com/adafruit/Adafruit_Python_GPIO Download the zip of the repository, unzip it, then in a terminal navigate to the folder and run:
(skip the sudo if running on Windows)
Now there's a new global function on the Adafruit_GPIO.FT232H module called enumerate_device_serials. It will return a list of all connected FT232H device serial numbers (and you can optionally override the USB VID & PID for the devices to search, but by default it uses the FT232H VID & PID). For example code like this would list the devices:
Make sure to run the above as root with sudo if on mac or linux and it should list connected FT232H device serials.
The other change I made is to the FT232H class constructor, now it takes an optional serial parameter that you can pass a string serial number to select that specific device. For example if you know the serial of a device is 'FT123' you can open it like this:
Give that a shot and let me know if you run into any issues, thanks!
First you'll want to update your python code by grabbing the latest code from github here: https://github.com/adafruit/Adafruit_Python_GPIO Download the zip of the repository, unzip it, then in a terminal navigate to the folder and run:
Code: Select all
sudo python setup.py install --force
Now there's a new global function on the Adafruit_GPIO.FT232H module called enumerate_device_serials. It will return a list of all connected FT232H device serial numbers (and you can optionally override the USB VID & PID for the devices to search, but by default it uses the FT232H VID & PID). For example code like this would list the devices:
Code: Select all
import Adafruit_GPIO.FT232H as FT232H
# Unload any FTDI drivers built into the kernel/OS.
FT232H.use_FT232H()
# Get list of device serial numbers
serials = FT232H.enumerate_device_serials()
print 'Found', len(serials), 'FT232H devices with serial numbers:'
for s in serials:
print s
The other change I made is to the FT232H class constructor, now it takes an optional serial parameter that you can pass a string serial number to select that specific device. For example if you know the serial of a device is 'FT123' you can open it like this:
Code: Select all
import Adafruit_GPIO.FT232H as FT232H
# Unload any FTDI drivers built into the kernel/OS.
FT232H.use_FT232H()
# Open device with serial number FT123
device = FT232H.FT232H(serial='FT123')
# Now device is open and can be used like any other FT232H device!
- snabkey
- Posts: 3
- Joined: Sat Feb 14, 2015 8:04 pm
Re: Using multiple FT232H devices on one computer
Thanks so MUCH! I will try it out as soon as I am able! Awesome!
- enkoder
- Posts: 2
- Joined: Wed Apr 04, 2012 3:19 pm
Re: Using multiple FT232H devices on one computer
I am getting a -7 (get product manufacturer failed) error when using enumerate_device_serials(). I have tried several different versions of libftdi and am using the latest. Could this be an issue with the chip? I assume the serials are being pulled off the eeprom.
Note there's also an issue with the error number to string translation, but it shows the manufacturer error. Any ideas?RuntimeError: ftdi_usb_get_strings returned error -7: libusb_get_string_descriptor_ascii() failed
- enkoder
- Posts: 2
- Joined: Wed Apr 04, 2012 3:19 pm
Re: Using multiple FT232H devices on one computer
The problem is the eeprom is not readable when the we just get the ft232h. After I erased the device using
config.conf looked like thissudo ftdi_eeprom --flash-eeprom config.conf
I was able to re-flash using FTProg and then enumerate_device_serials worked fine. IMO you should add a screen in your manufacturing test to see if you can pull the serial and mfg info from eeprom before shipping to customers. Seems like several people have had the same problem as I have.vendor_id=0x403
product_id=0x6014
filename="eeprom.bin"
- tdicola
- Posts: 1074
- Joined: Thu Oct 17, 2013 9:11 pm
Re: Using multiple FT232H devices on one computer
Oh thanks for digging in and finding that erasing the chip makes it visible to FTProg. We've been using libftdi to flash the chips during tests but I'll look to see if there's a better way to have them in a clean state for FTProg to use. I can update our usage guide to call out using the FTDI eeprom erase though so folks find it easily in the future. Thanks for checking out the FT232H board and finding the fix!
- mailhouse
- Posts: 107
- Joined: Sat Jul 25, 2015 8:06 pm
Re: Using multiple FT232H devices on one computer
The problem is that while the serial number field is populated, the board ships with eeprom field SerNumEnableH set to zero instead of one.
erasing the eeprom makes it so the power LED no longer lights up. which field in the eeprom is that on?
also, for mac users, the eeprom can be read from and written to with the sample apps in the D2XX driver code.
erasing the eeprom makes it so the power LED no longer lights up. which field in the eeprom is that on?
also, for mac users, the eeprom can be read from and written to with the sample apps in the D2XX driver code.
- tdicola
- Posts: 1074
- Joined: Thu Oct 17, 2013 9:11 pm
Re: Using multiple FT232H devices on one computer
Oh interesting, thanks for the tip on the EEPROM setting. It looks like that might be set by libftdi when its writing the EEPROM.
For the LEDs on the board there's one connected to ACBUS8 (red LED) and another connected to ACBUS9 (green LED). You can actually set them up to have different behaviors by changing the EEPROM values, check out section 3.4 of the datasheet: http://www.ftdichip.com/Support/Documen ... FT232H.pdf For example they can be a UART TX/RX LED, or just driven high/low to turn on or off. To have the green light always turned on use FT_prog to set the EEPROM to drive ACBUS9 low (the LEDs have pull-ups to 3.3V so drive them low to turn on).
For the LEDs on the board there's one connected to ACBUS8 (red LED) and another connected to ACBUS9 (green LED). You can actually set them up to have different behaviors by changing the EEPROM values, check out section 3.4 of the datasheet: http://www.ftdichip.com/Support/Documen ... FT232H.pdf For example they can be a UART TX/RX LED, or just driven high/low to turn on or off. To have the green light always turned on use FT_prog to set the EEPROM to drive ACBUS9 low (the LEDs have pull-ups to 3.3V so drive them low to turn on).
- Kryptonite
- Posts: 4
- Joined: Mon Oct 19, 2015 12:50 pm
Re: Using multiple FT232H devices on one computer
I have been using this board for I2C and SPI based communication & no issues seen with that. However I cant seem to detect the device based on serial number.
I only keep getting Found 0 FT232H devices with serial numbers:
Here is what i have in my script !
I only keep getting Found 0 FT232H devices with serial numbers:
Here is what i have in my script !
Code: Select all
import Adafruit_GPIO.FT232H as FT232H
# Unload any FTDI drivers built into the kernel/OS.
FT232H.use_FT232H()
# Get list of device serial numbers
serials = FT232H.enumerate_device_serials(vid=0403, pid=6014)
print 'Found', len(serials), 'FT232H devices with serial numbers:'
for s in serials:
print s
Please be positive and constructive with your questions and comments.