Menu

#13 I2c support for FT4222

2.1
open
None
2020-08-19
2020-05-11
Peter
No

Hello, i was currenlty trying to use your library with the FT4222 for I2C commands. The first step of opening the communication ports interfaces did work, but after i tryed to send some read/write commands I got an error that my device doesnt support MPSSE. I checked it and yes it doesnt support it. So my question is is there a way to use your library without using the MPSSE?
- I am running this on windows 10
- using Intellij IDEA for IDE
- java 8
thanks a lot in advance.

Discussion

<< < 1 2 3 > >> (Page 2 of 3)
  • Stephen Davies

    Stephen Davies - 2020-05-15

    Ok, plan B. Try adding c:\Users\Peter\d2xx to your PATH.

     
  • Peter

    Peter - 2020-05-15

    if you mean the path in environmental variable then i already have it from before. I removed it and tryed and gor the same error, so i put it back in.

     
  • Stephen Davies

    Stephen Davies - 2020-05-15

    Try "regsvr32 /n /i c:\Users\Peter\d2xx\LibFT4222.dll"

     
  • Peter

    Peter - 2020-05-15

    got the exactly same error.

     
  • Stephen Davies

    Stephen Davies - 2020-05-15

    OK, I've run out of ideas. I'm going to build my own Windows 10 environment to try this out. I don't have one readily available so this may take a day to two. Will let you know when I get there.

     
  • Stephen Davies

    Stephen Davies - 2020-05-15

    Actually, did you try copying LibFT4222.dll to C:\Windows\system32 ?

     
  • Peter

    Peter - 2020-05-15

    I really appreciate your help. I will delete all of the thinks i did, and try to follow the instructions one by one, and try again. maybe i did something wrong. And also if you wanted we could start an call in teams and i could share you my screen.

     
  • Peter

    Peter - 2020-05-15

    I did copy it now. and tryed the executing this command in cmd:
    regsvr32 /n /i c:\Users\Peter\d2xx\LibFT4222.dll
    but got the same error.(I did reopen the CMD)

     
  • Stephen Davies

    Stephen Davies - 2020-05-15

    Think I've got it. C:\Users\Peter\d2xx should have the files (amd64):
    1. ftd2xx.h
    2. ftd2xx.lib
    3. LibFT4222.h
    4. LibFT4222.lib

    The .dll files go in C:\Windows\System32. ftd2xx.dll will get installed automatically by windows the first time you install an FTDI device. This is normal PnP (plug and play) behaviour. FTDI have given the driver to Microsoft. You do not need to copy ftd2xx.dll into C:\Windows\System32.

    For me, note I am testing with an old UM232R module, not an FT4222 based device, I had to manually copy the amd64 file LibFT4222-64.dll to C:\Windows\System32. Do not rename the file.

    You shold have two FTDI files in C:\Windows\System32:
    1. ftd2xx.dll (autoinstalled)
    2. LibFT4222-64.dll (copied manually)

    To test from the windows command prompt:
    C:\Users\sjdavies\projects\yad2xx>java -cp yad2xxJava/target/yad2xxJava-2.1-SNAPSHOT-jar-with-dependencies.jar net.sf.yad2xx.samples.ListDevices

    This ran and displayed useful output:
    FTDI Device List
    -------------------
    Got 1 devices
    Dev 0:
    Flags=0 (isOpen: false isHighSpeed: false)
    Type=5 (FT_DEVICE_232R)
    ID=4036001
    locID=222
    SerialNumber=FTCVMMQL
    Description=UM232R USB <-> Serial
    ftHandle=0

    You will also need to resync with Github, do another "git pull".

     

    Last edit: Stephen Davies 2020-05-15
  • Stephen Davies

    Stephen Davies - 2020-05-15

    Arrrgh!, thought I had it but no. Forgot I was using the old version of FTDIInterface.dll. Still broken. It's late, I'll look at it again tomorrow.

     
  • Stephen Davies

    Stephen Davies - 2020-05-15

    I had one last go at it, writing a simple C code sample, rather than Java. Looks like LibFT4222 depends on an old Microsoft dll that doesn't get installed as part of the regular build, MSCVP100.dll. With the C program I was getting a popup error message, something that is supressed by Java.

    Try installing the Visual Studio 2010 C++ Redistributable -
    http://www.microsoft.com/download/details.aspx?id=26999

     
  • Peter

    Peter - 2020-05-15

    you are awesome! :D I will try it now. Acutally i have an working example in c in eclipse that is perfectly working. Example is from the ftdi that i tweekt a little.

     
  • Peter

    Peter - 2020-05-15

    i tryied with the new src code you uploaded and installed the visual studio 2010 c++, but got the same error. Also the listdevices in samples doesnt even work...

     
  • Stephen Davies

    Stephen Davies - 2020-05-15

    ListDevices has stopped working because you've moved to the new dll which depends on ftd2xx .dll and LibFT4222.dll. The old version depends only on ftd2xx.dll.

    When I was testing my simple C program I first installed the current c++ redistributable from https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads , i.e. the version for 2015,2017,2019.

    When that didn't fix the error I installed the 2010 redistributable. Maybe you need both?

     
  • Stephen Davies

    Stephen Davies - 2020-05-16

    My C test file

     
  • Stephen Davies

    Stephen Davies - 2020-05-16

    The associated makefile. Use command "mingw32-make" to build.

     
  • Peter

    Peter - 2020-05-17

    i wanst online, tomorrow morning i will go back into action!

     
  • Stephen Davies

    Stephen Davies - 2020-05-18

    I spent some time working on this over the weekend on macOS. I encountered similar problems with 3rd party libraries.

    It looks like LibFT4222 has been written in C++ and this means that the driver is not standalone, it requires additional libraries to function. On macOS this means the boost libraries need to be present. FTDI ships the correct versions as part of the LibFt4222 download but because they don't provide any install instructions it's easy to overlook. I hadn't set my environment up correctly, initially this problem was being masked because I was using the old version of FTDIInterface. Once I updated, things fell apart. Luckily for me the macOS error message is pretty clear, library libboost_system was missing. On macOS copying two .dylib files from the FTDI download fixes the problem.

    On Windows I suspect LibFT4222.dll has been built using the Microsoft tools and is dependent on the MSVC runtime. I don't understand their tools and what needs to be done. More online reading required.

    Reading the FT4222 datasheet got me interested in the device. A superspeed capable I2C/SPI/GPIO device sounded interesting so I ordered one from Mouser. It will arrive tomorrow and will help me test this stuff before I release it.

     
  • Peter

    Peter - 2020-05-18

    COOL. Also im in contact with FTDI so i can just ask them how they builded it(if thats not a secret). I will also check a little more about MSVC runtime.

    Thats good!

     
  • Stephen Davies

    Stephen Davies - 2020-05-20

    Hi Peter,
    the UMFT4222EV module turned up yesterday. I've got the example code working correctly on macOS with a PCF8575 I2C slave device:

    yad2xx$ java -cp yad2xxJava/target/yad2xxJava-2.1-SNAPSHOT-jar-with-dependencies.jar net.sf.yad2xx.ft4222.samples.I2cMasterSample
    Dev 0:
    Flags=2 (isOpen: false isHighSpeed: true)
    Type=a (FT_DEVICE_4222H_0)
    ID=403601c
    locID=14111
    SerialNumber=
    Description=FT4222 A
    ftHandle=0

    Init FT4222 as I2C master
    I2C master write data to the slave(0x20)...
    bytes written: 2
    I2C master read data from the slave(0x20)...
    slave data: 0xa5, 0xc3,
    UnInitialize FT4222
    Close FT device

    As usual, you'll need to "git pull" to update to the latest changes.

    I tried to get it working on Windows 7 and 10. Both are giving me weird output that has nothing to do with Java. I'm wondering if there is something broken with VMWare Fusion, I run Windows as a guest VM inside macOS.

    Have you heard back from FTDI support?

     
  • Peter

    Peter - 2020-05-22

    Hi

    That sounds awesome!!
    So we just need to figure out why it isnt working on windows.
    I will try to figure it on tomorrow.
    No i didnt get any information from FTDI yet.

     
  • Peter

    Peter - 2020-05-28

    Hi,
    i downloaded the Depedency Walker tool to find the dependencies of the LIBFT4222.DLL
    so the MSVCP100.DLL and MSVCR100.DLL files are in Microsoft visual C++ 2010 Redistributable package which i installed(86x and 64x version) and after rebooting tryed to run the programm without success.
    and also checked my C/windows/system32 an have all of the DLL files shown in the attachment there.

     
  • Peter

    Peter - 2020-05-28

    also this

     
<< < 1 2 3 > >> (Page 2 of 3)

Log in to post a comment.