FTDI Community

General Category => Discussion - Software => Topic started by: Marcoz on January 12, 2021, 12:22:17 PM

Title: FT4222 Python Interface
Post by: Marcoz on January 12, 2021, 12:22:17 PM
Hey,

I am working on an interface for FTDI devices based on the provided api (dlls ftd2xx64.dll + LibFT4222-64.dll in this case). I implemented the basic functions to open a device, read the usb desciptors ect. Everything went well, every function returns FT_OK!
Then I went to get the device specific system layer working, in this case it was porting all functions from LibFT4222-64.dll
Now every function from the API just returns 1000... First I thought I had some issue with the device handle but after I tryed almost everything I decided to change to 32-Bit.
So I used a 32-Bit Python and the correcponding 32-Bit dlls ftd2xx.dll + LibFT4222.dll

Now the same code works... So I think there is an issue with the 64 Bit Library of the FT4222...
Did you had such issues before?

Best regards


INFO: I am using windows 10 64 Bit
Title: Re: FT4222 Python Interface
Post by: FTDI Community on January 13, 2021, 04:33:19 PM
Hello,

The LibFT4222 API return code 1000 is FT4222_DEVICE_NOT_SUPPORTED.

Which revision of silicon are you using?

Which mode are you using the device in? Which hardware are you using?

Which version of the D2xx driver are you using and which version of LibFT4222?
Note the following versions for the 64bit dlls and libs:

.\CDM v2.12.28 WHQL Certified\amd64
.\LibFT4222-v1.4.4\imports\LibFT4222\dll\amd64

This issue has never been reported before.
Have you tried the 32bit and 64bit dlls with the standard examples provided with LibFT4222? This would take the python aspect out of the equation, if you say that it’s a problem with our dll:

.\LibFT4222-v1.4.4\samples

Unfortunately we have no support for Python, but you can check out the following information with respect to the D2xx driver (not specifically LibFT4222):

It is possible implement the D2XX driver in python scripts.

The following imports are required:

import os
import sys
import ctypes

And the library can be loaded in the following manner:

class D2XXTest(object):
    def __init__(self):
        #Load driver binaries
        if sys.platform.startswith('linux'):
            self.d2xx = ctypes.cdll.LoadLibrary("libftd2xx.so")
        elif sys.platform.startswith('darwin'):
            self.d2xx = ctypes.cdll.LoadLibrary("libftd2xx.1.1.0.dylib")
        else:
            self.d2xx = ctypes.windll.LoadLibrary("ftd2xx")
        print 'D2XX library loaded OK'
        print
        sys.stdout.flush()

Also see some other Third Party Implementations:

http://bleyer.org/pyusb/
https://pypi.org/project/pylibftdi/
https://pypi.org/project/pyftdi/
https://learn.adafruit.com/adafruit-ft232h-breakout/mpsse-setup
https://iosoft.blog/category/ftdi/ 
 
ctypes Wrapper for D2XX:
https://pypi.org/project/ftd2xx/

I found one for LibFT4222 also:
https://pypi.org/project/ft4222/

There also may be other FTDI Community users with Python knowledge and LibFT4222 who may be able to help you further.

Best Regards,
FTDI Community