There are two ways to open a connection to an Ftdi object.
The recommended way to open a connection is to specify connection details using a URL. The URL scheme is defined as:
vendor: the USB vendor ID of the manufacturer
product: the USB product ID of the device
Supported product IDs:
Supported product aliases:
ftprefix for all aliases is also accepted, as for example
serial: the serial number as a string. This is the preferred method to uniquely identify a specific FTDI device. However, some FTDI device are not fitted with an EEPROM, or the EEPROM is either corrupted or erased. In this case, FTDI devices report no serial number
bus:addess: it is possible to select a FTDI device through a bus:address pair, specified as hexadecimal integer values.
(0x)10= 16 (decimal) and address
(0x)22= 34 (decimal)
index: an integer - not particularly useful, as it depends on the enumeration order on the USB buses, and may vary from on session to another.
interface: the interface of FTDI device, starting from 1
1for 230x and 232* devices,
2for 2232* devices,
4for 4232* devices
All parameters but the interface are optional, PyFtdi tries to find the best
match. Therefore, if you have a single FTDI device connected to your system,
ftdi:///1 should be enough.
You can also ask PyFtdi to enumerate all the compatible devices with the
ftdi:///? syntax. This syntax is useful to retrieve the available
FTDI URLs with serial number and/or bus:address selectors.
There are several APIs available to enumerate/filter available FTDI device. See ftdi - FTDI low-level driver.
Note that opening an FTDI connection with a URL ending with ? is interpreted as a query for matching FTDI devices and immediately stop. With this special URL syntax, the avaialble devices are printed out to the standard output, and the Python interpreter is forced to exit (SystemExit is raised).
When simple enumeration of the available FTDI devices is needed - so that
execution is not interrupted, two helper methods are available as
pyftdi.ftdi.Ftdi.show_devices() and accept the same URL syntax.
Opening a connection¶
URL-based methods to open a connection¶
open_from_url() open_mpsse_from_url() open_bitbang_from_url()
Device-based methods to open a connection¶
You may also open an Ftdi device from an existing PyUSB device, with the help
open_from_device() helper method.
open_from_device() open_mpsse_from_device() open_bitbang_from_device()
Legacy methods to open a connection¶
The old, deprecated method to open a connection is to use the
methods without the
_from_url suffix, which accept VID, PID, and serial
parameters (among others).
open() open_mpsse() open_bitbang()
See the ftdi_urls tool to obtain the URLs for the connected FTDI devices.