Building with the ftd2xx Library (USB2PMB2, CMake)

This guide describes how to build a no-OS project that uses the ftd2xx library (FTDI D2XX + LibMPSSE) with the USB2PMB2 evaluation board (FT2232HQ USB-to-MPSSE adapter) as a host-side peripheral bridge.

The ftd2xx library is supported on three host operating systems:

  • Linuxusb2pmb2 board preset (linux-userspace platform)

  • Windowswin-usb2pmb2 board preset (win platform)

  • macOSmac-usb2pmb2 board preset (mac platform)

The resulting binary runs natively on the host PC and communicates with the target evaluation board over USB via the USB2PMB2 adapter.

Supported boards

Preset / Board

Host OS

Description

usb2pmb2

Linux

Linux host with USB2PMB2 adapter (linux-userspace platform)

win-usb2pmb2

Windows

Windows host with USB2PMB2 adapter (win platform)

mac-usb2pmb2

macOS

macOS host with USB2PMB2 adapter (mac platform)

Prerequisites

CMake and build tools

All host OSes require CMake 3.28+ and Ninja.

sudo apt install cmake ninja-build build-essential python3 python3-venv

Install the following tools (ensure they are on PATH):

Install Xcode Command Line Tools and Homebrew, then:

brew install cmake ninja python3

ftd2xx library setup

FTDI's website uses Cloudflare bot protection that blocks automated downloads. The required archives must be downloaded manually first.

  1. Download LibMPSSE for your host OS from FTDI's website:

    • Linux: D2XX_MPSSE_1.0.7_Linux.zip

    • macOS: D2XX_MPSSE_1.0.7_MacOS.zip

    • Windows: D2XX_MPSSE_1.0.7_Win.zip

  2. Download libftd2xx for your host OS and architecture from FTDI's D2XX drivers page. For Linux x86_64 the file is libftd2xx-linux-x86_64-1.4.35.tgz. Windows uses CDM-v2.12.36.20-WHQL-Certified.zip.

  3. Run the setup script from the no-OS root directory:

    python3 tools/scripts/config_ftd2xx.py \
        --local-mpsse D2XX_MPSSE_1.0.7_Linux.zip \
        --local-d2xx  libftd2xx-linux-x86_64-1.4.35.tgz
    
    python tools\scripts\config_ftd2xx.py ^
        --local-mpsse D2XX_MPSSE_1.0.7_Win.zip ^
        --local-d2xx  CDM-v2.12.36.20-WHQL-Certified.zip
    
    python3 tools/scripts/config_ftd2xx.py \
        --local-mpsse D2XX_MPSSE_1.0.7_MacOS.zip \
        --local-d2xx  D2XX1.4.35.dmg
    

The script installs both libraries to libraries/ftd2xx/release/ (which is git-ignored). CMake finds them automatically from that location — no FTD2XX_LIBRARY environment variable is needed.

Linux: kernel module conflict

The ftdi_sio kernel module claims FTDI USB devices automatically and must be unloaded before running any ftd2xx application:

sudo rmmod ftdi_sio usbserial

This must be repeated every time the adapter is replugged. To make it permanent, blacklist the module:

echo "blacklist ftdi_sio" | sudo tee /etc/modprobe.d/ftdi_sio.conf
sudo update-initramfs -u

Listing build combinations

From the no-OS repository root, list all valid USB2PMB2 combinations:

python3 tools/scripts/no_os_build.py list --board usb2pmb2

Each row is a PROJECT  VARIANT  BOARD  PLATFORM tuple that can be fed directly to the build subcommand.

Building a project

Manual CMake invocation

You can also drive CMake directly:

cmake --preset usb2pmb2 \
      -B build-<project>-<variant>-usb2pmb2 \
      -DPROJECT_DEFCONFIG=<project>/<variant>.conf

cmake --build build-<project>-<variant>-usb2pmb2 --target <project>

Replace usb2pmb2 with win-usb2pmb2 or mac-usb2pmb2 for Windows and macOS respectively.

Running

On Linux, libftd2xx accesses the USB device directly and typically requires root (or a udev rule granting access):

sudo ./build/<project>-<variant>-usb2pmb2/build/<project>

Run the executable from a Command Prompt or PowerShell. The FTDI D2XX driver is installed system-wide (CDM driver package) so no elevated privileges are normally required:

.\build\<project>-<variant>-win-usb2pmb2\build\<project>.exe
./build/<project>-<variant>-mac-usb2pmb2/build/<project>

IIO projects

Projects built with the iio_example variant start an IIOD server on the host. Connect to it from any IIO client using the IP backend:

iio_info -u ip:127.0.0.1

Example: building max14916 basic on Linux

cd no-OS

# Install ftd2xx libraries (one-time setup)
python3 tools/scripts/config_ftd2xx.py \
    --local-mpsse D2XX_MPSSE_1.0.7_Linux.zip \
    --local-d2xx  libftd2xx-linux-x86_64-1.4.35.tgz

# Unload the conflicting kernel module
sudo rmmod ftdi_sio usbserial

# Build
python3 tools/scripts/no_os_build.py build \
    --project max14916 --variant basic --board usb2pmb2

# Run
sudo ./build/max14916-basic-usb2pmb2/build/max14916