Interfacing with FTDIs FT4222H USB 2.0 to Quad SPI / I2C Bridge IC



A tutorial for interfacing with FTDIs FT4222H USB 2.0 to Quad SPI / I2C Bridge IC on macOS

Setup

Download the relevent drivers for the IC

D2XX Drivers: FTD2XX

FT4222H Driver: FT4222H

  1. Open D2XX1.4.16.dmg and copy the D2XX folder to your desktop
  2. Inside we are interested in 3 files:
  1. Open a terminal and navigate to the D2XX folder on your desktop
  2. Move .h files to /usr/local/include
mv ftd2xx.h WinTypes.h /usr/local/include 
  1. Move ‘.dylib’ file to /usr/local/lib
mv libftd2xx.1.14.16.dylib /usr/local/lib 
  1. Create second folder on Desktop and copy contents of libft4222.1.4.4.14.dmg to it
  2. move libft4222.1.4.4.14.dylib to /usr/local/lib
  3. move files libboost_system.dylib and libboost_thread-mt.dylib located in boost_libs to /usr/local/lib
  4. move libft4222.h to /usr/local/include
  5. Create symbolic links for libft4222.1.4.4.14.dylib and libftd2xx.1.4.16.dylib
sudo ln -s /usr/local/lib/libft4222.1.4.4.14.dylib /usr/local/lib/libft4222.dylib
sudo ln -s /usr/local/lib/libftd2xx.1.4.16.dylib /usr/local/lib/libftd2xx.dylib

Notes on installing

If using a device with standard FTDI vendor and product identifiers, install D2xxHelper to prevent mac OS from claiming the device as a serial port (locking out D2XX programs). This will prevent the device being used with the VCP driver as a standard COM port. D2xxHelper can be found here : D2xxHelper

Testing

1. Find chip version

Inside libft4222.1.4.4.14.dmg is a folder called examples with a .c file called get-version.c. using the following command

cc get-version.c -lft4222 -lftd2xx  -Wl,-L/usr/local/lib -o version.out

If compilation has gone well and all libraries have been found version.out will have been made. execute using

./version.out

This should return something similar to this

Device 0: 'FT4222 A'
  Chip version: 42220400, LibFT4222 version: 01040409

2. Accessing EEPROM

Create a folder in the root directory of D2XX called build and move libftd2xx.a into it.

mkdir build
mv libftd2xx.a build

now navigate to the folder Samples

Inside the D2XX folder navigate to the folder samples and execute make

make

once this has complete navigate to D2XX/Samples/EEPROM/read and exectute read

./read

This should return something similar to this

Signature1 = 0
Signature2 = -1
Version = 0
VendorId = 0x0403
ProductId = 0x601C
Manufacturer = FTDI
ManufacturerId =
Description = FT4222
SerialNumber =
MaxPower = 100
PnP = 1
SelfPowered = 0
RemoteWakeup = 1
Returning 0

3. Using Cmake

Navigate to the examples folder as before containing get-version.c
Create a directory called build

create a text file called CMakeLists.txt

Inside add the following

cmake_minimum_required(VERSION 3.17.2)

project (FT4222H_test)

set ( PROJECT_LINK_LIBS libft4222.dylib libftd2xx.dylib )
link_directories ( ~/work/CERN/FTDI/example/build /usr/local/lib)

include_directories ( /usr/local/include )

add_executable( FT4222H_Version get-version.c ) 
target_link_libraries( FT4222H_Version ${PROJECT_LINK_LIBS} )

This tells the compiler where to find our files and links them to the project.
Inside link directories replace the first directory with the location of your build folder. Navigate to the build folder and run

cmake ..
make

The file FT4222H_Version should now be built.

execute with

./FT4222H_Version

Again, the following should be returned

Device 0: 'FT4222 A'
  Chip version: 42220400, LibFT4222 version: 01040409
comments powered by Disqus