Menu

FirstSteps

Stephen Davies

First Steps

Two classes are central to Yad2xx operations, FTDIInterface and Device.

FTDIInterface is a simply a Java Native Interface (JNI) wrapper. In general its methods correspond one to one with the functions in the D2XX C library. Most methods are declared native, i.e. they are implemented in C (see FTDIInterface.c). With the exception of FTDIInterface.getDevices() you can generally ignore it exists.

Most of the time you will be using a Device instance (object) to interact with your FTDI chip.

Code Overview

// Get all available FTDI Devices
Device[] devices = FTDIInterface.getDevices();

if (devices.length == 0) {
    // No Devices suggests:
    // 1) device not attached
    // 2) FTDI driver install problem
    // 3) VID/PID issue (Linux/macOS)
}

// Select a Device from the list
Device dev = devices[0];

dev.open();

// use the device

dev.close();

See the ListDevices sample program for a more complete example.

Next Steps

Where you go next depends on your application:
1. Asynchronous Serial Port
2. SPI
3. I2C


Related

Wiki: Home