FTDI4222 Project Setup for Windows



Setup

Software required

Download the relevent drivers for the IC

D2XX Drivers: FTD2XX

FT4222H Driver: FT4222H

This link may not work if the driver has been updated. If this is the case then the link can be found at FTDI4222 Windows Library

Install the D2xx driver from the downloaded installer.

FTDI4222 Library Folder

├── FT4222H_Lib_1.4.4_Release_info.rtf
├── imports
│   ├── LibFT4222
│   │   ├── dll
│   │   │   ├── LibFT4222.dll
│   │   │   ├── LibFT4222.lib
│   │   │   ├── amd64
│   │   │   │   ├── LibFT4222-64.dll
│   │   │   │   └── LibFT4222-64.lib
│   │   │   └── i386
│   │   │       ├── LibFT4222.dll
│   │   │       └── LibFT4222.lib
│   │   ├── inc
│   │   │   └── LibFT4222.h
│   │   └── lib
│   │       ├── amd64
│   │       │   ├── LibFT4222-64.lib
│   │       │   ├── libboost_atomic-vc100-mt-1_54.lib
│   │       │   ├── libboost_chrono-vc100-mt-1_54.lib
│   │       │   ├── libboost_date_time-vc100-mt-1_54.lib
│   │       │   ├── libboost_exception-vc100-mt-1_54.lib
│   │       │   ├── libboost_system-vc100-mt-1_54.lib
│   │       │   └── libboost_thread-vc100-mt-1_54.lib
│   │       └── i386
│   │           ├── LibFT4222.lib
│   │           ├── libboost_atomic-vc100-mt-1_54.lib
│   │           ├── libboost_chrono-vc100-mt-1_54.lib
│   │           ├── libboost_date_time-vc100-mt-1_54.lib
│   │           ├── libboost_exception-vc100-mt-1_54.lib
│   │           ├── libboost_system-vc100-mt-1_54.lib
│   │           └── libboost_thread-vc100-mt-1_54.lib
│   └── ftd2xx
│       ├── amd64
│       │   └── ftd2xx.lib
│       ├── ftd2xx.h
│       └── i386
│           └── ftd2xx.lib

File Structure

We are interested in the i386 versions of the libraries. Create folder with the file structure like below and place the .lib and .dll files in the correct folders. note the makedfile is generated by CMake.

├── build
│   ├── program.exe (generated from Makefile)
│   ├── LibFT4222.dll
│   └── Makefile (generated by CMake)
├── lib
│   ├── LibFT4222.lib
│   └── ftd2xx.lib
│   └── LibFT4222.dll
└── src
    ├── CMakeLists.txt
    ├── program.c
    ├── program.h
    ├── WinTypes.h
    ├── ftd2xx.h
    └── libft4222.h

CMake

To use CMake a CMakeLists.txt file is required.

cmake_minimum_required(VERSION 3.20.0)

project (<project_name>)

set (PROJECT_LINK_LIBS ftd2xx FT4222)
link_directories (<path_to_lib_directory>) 

include_directories (
     "C:/MinGW/include"
     <path_to_src_directory> 
     )

add_executable(<program_name> program.c) 
target_link_libraries(<program_name> ${PROJECT_LINK_LIBS} )

From the root of the folder call

cmake -S ./src -B ./build

This will have made a makefile in the build folder. To run the make file call ming32-make in the build folder.

cd build
mingw32-make
comments powered by Disqus