Author Topic: python connection FT2232D problem  (Read 759 times)

0 Members and 1 Guest are viewing this topic.

Offline blackberryerTopic starter

  • Newbie
  • Posts: 1
  • Country: cn
python connection FT2232D problem
« on: February 03, 2020, 09:42:23 am »
I connected the FT2232D with python and can detect the device ID, but the problem of open failure occurs.
Channel A of FT2232D is used for JATG to download the program to FPGA, and channel B is used for 245 FIFO mode to communicate with FPGA.
The driver settings are shown in the screenshot(driver-set.png) below.
921096-0" alt="" class="bbc_img" />
The python test code is as follows(result is test_connect.png):
921100-1" alt="" class="bbc_img" />
Code: [Select]
from pylibftdi import Driver, Device

dev_list  = Driver().list_devices()
if len(dev_list) != 0:
print "Following devices found:"
for device_ in dev_list:
print device_
# Create Device instance: Channel B in binary mode
dev = Device(mode='b', interface_select=2)

# Open the instantiated device
dev.open()

# Write value 16 to FTDI over USB, returns number of bytes written
dev.write(bytearray([16,]))

# Read one byte
rx_data =  bytearray(dev.read(1))

# Print the byte received. Should be 16+1 i.e, 17
print rx_data[0]

# Close device after use
dev.close()
« Last Edit: February 03, 2020, 01:21:25 pm by blackberryer »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf