Jump to content
  • 0

AD2 FTDI connection conflict with FT232 breakout


mmar56

Question

I am using an FT232 breakout board to control a rotary sensor through Python 2.7

If I plug in the AD2 first, my python code fails due to "no device found".

If I plug in the FT232 first, and establish the connection with Python, everything works OK.

How can I track down the cause and resolve it?

The errors listed follow:

C:\Python27\lib\site-packages\adafruit_gpio-1.0.3-py2.7.egg\Adafruit_GPIO\FT232H.pyc in __init__(self, vid, pid, serial)
    148         if serial is None:
    149             # Open USB connection for specified VID and PID if no serial is specified.
--> 150             self._check(ftdi.usb_open, vid, pid)
    151         else:
    152             # Open USB connection for VID, PID, serial.

C:\Python27\lib\site-packages\adafruit_gpio-1.0.3-py2.7.egg\Adafruit_GPIO\FT232H.pyc in _check(self, command, *args)
    202         logger.debug('Called ftdi_{0} and got response {1}.'.format(command.__name__, ret))
    203         if ret != 0:
--> 204             raise RuntimeError('ftdi_{0} failed with error {1}: {2}'.format(command.__name__, ret, ftdi.get_error_string(self._ctx)))
    205
    206     def _poll_read(self, expected, timeout_s=5.0):

Here is my code:

# Python program to use FT232H from a USB port to read and program the MA302 encoder

import Adafruit_GPIO.FT232H as FT232H
import binascii
import sys
from time import sleep
 
# Temporarily disable FTDI serial drivers.
FT232H.use_FT232H()
 
# Find the first FT232H device.

ft232h = FT232H.FT232H()
 
q=spi.transfer([0x82, 0xbf]) #write register 2 with 0xdf
sleep(.020)
print "q=";q

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Hi @mmar56

Most probably your script tries to connect to the AD2 instead of the breakout board.

To make sure you are connecting to the breakout board, before "open" identify it based on some information like the device serial number of description.
The SN for AD2 start with "210321" and the description is "Digilent USB Device"

Use:
FT_CreateDeviceInfoList(int *lpdwNumDevs)
and for each:
FT_GetDeviceInfoDetail((DWORD dwIndex, LPDWORD lpdwFlags, LPDWORD lpdwType, LPDWORD lpdwID, LPDWORD lpdwLocId, PCHAR pcSerialNumber, PCHAR pcDescription, FT_HANDLE *ftHandle)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...