Skip to content

FTD2XX_NET

Public Member Functions

FT_STATUS

GetNumberOfDevices(ref uint devcount)

Gets the number of FTDI devices available.

FT_STATUS

GetDeviceList(FT_DEVICE_INFO_NODE[] devicelist)

Gets information on all of the FTDI devices available.

FT_STATUS

OpenByIndex(uint index)

Opens the FTDI device with the specified index.

FT_STATUS

OpenBySerialNumber(string serialnumber)

Opens the FTDI device with the specified serial number.

FT_STATUS

OpenByDescription(string description)

Opens the FTDI device with the specified description.

FT_STATUS

OpenByLocation(uint location)

Opens the FTDI device at the specified physical location.

FT_STATUS

Close()

Closes the handle to an open FTDI device.

FT_STATUS

Read(byte[] dataBuffer, uint numBytesToRead, out uint numBytesRead)

Read data from an open FTDI device.

FT_STATUS

Read(out string dataBuffer, uint numBytesToRead, out uint numBytesRead)

Read data from an open FTDI device.

FT_STATUS

Write(byte[] dataBuffer, int numBytesToWrite, out uint numBytesWritten)

Write data to an open FTDI device.

FT_STATUS

Write(byte[] dataBuffer, uint numBytesToWrite, out uint numBytesWritten)

Write data to an open FTDI device.

FT_STATUS

Write(string dataBuffer, int numBytesToWrite, out uint numBytesWritten)

Write data to an open FTDI device.

FT_STATUS

Write(string dataBuffer, uint numBytesToWrite, out uint numBytesWritten)

Write data to an open FTDI device.

FT_STATUS

ResetDevice()

Reset an open FTDI device.

FT_STATUS

Purge(uint purgemask)

Purge data from the devices transmit and/or receive buffers.

FT_STATUS

SetEventNotification(uint eventmask, EventWaitHandle eventhandle)

Register for event notification.

FT_STATUS

StopInTask()

Stops the driver issuing USB in requests.

FT_STATUS

RestartInTask()

Resumes the driver issuing USB in requests.

FT_STATUS

ResetPort()

Resets the device port.

FT_STATUS

CyclePort()

Causes the device to be re-enumerated on the USB bus. This is equivalent to unplugging and replugging the device. Also calls FT_Close if FT_CyclePort is successful, so no need to call this separately in the application.

FT_STATUS

Rescan()

Causes the system to check for USB hardware changes. This is equivalent to clicking on the "Scan for hardware changes" button in the Device Manager.

FT_STATUS

Reload(ushort VendorID, ushort ProductID)

Forces a reload of the driver for devices with a specific VID and PID combination.

FT_STATUS

SetBitMode(byte Mask, byte BitMode)

Puts the device in a mode other than the default UART or FIFO mode.

FT_STATUS

GetPinStates(ref byte BitMode)

Gets the instantaneous state of the device IO pins.

FT_STATUS

ReadEEPROMLocation(uint Address, ref ushort EEValue)

Reads an individual word value from a specified location in the device's EEPROM.

FT_STATUS

WriteEEPROMLocation(uint Address, ushort EEValue)

Writes an individual word value to a specified location in the device's EEPROM.

FT_STATUS

EraseEEPROM()

Erases the device EEPROM.

FT_STATUS

ReadFT232BEEPROM(FT232B_EEPROM_STRUCTURE ee232b)

Reads the EEPROM contents of an FT232B or FT245B device.

FT_STATUS

ReadFT2232EEPROM(FT2232_EEPROM_STRUCTURE ee2232)

Reads the EEPROM contents of an FT2232 device.

FT_STATUS

ReadFT232REEPROM(FT232R_EEPROM_STRUCTURE ee232r)

Reads the EEPROM contents of an FT232R or FT245R device. Calls FT_EE_Read in FTD2XX DLL

FT_STATUS

ReadFT2232HEEPROM(FT2232H_EEPROM_STRUCTURE ee2232h)

Reads the EEPROM contents of an FT2232H device.

FT_STATUS

ReadFT4232HEEPROM(FT4232H_EEPROM_STRUCTURE ee4232h)

Reads the EEPROM contents of an FT4232H device.

FT_STATUS

ReadFT232HEEPROM(FT232H_EEPROM_STRUCTURE ee232h)

Reads the EEPROM contents of an FT232H device.

FT_STATUS

ReadXSeriesEEPROM(FT_XSERIES_EEPROM_STRUCTURE eeX)

Reads the EEPROM contents of an X-Series device.

FT_STATUS

WriteFT232BEEPROM(FT232B_EEPROM_STRUCTURE ee232b)

Writes the specified values to the EEPROM of an FT232B or FT245B device.

FT_STATUS

WriteFT2232EEPROM(FT2232_EEPROM_STRUCTURE ee2232)

Writes the specified values to the EEPROM of an FT2232 device. Calls FT_EE_Program in FTD2XX DLL

FT_STATUS

WriteFT232REEPROM(FT232R_EEPROM_STRUCTURE ee232r)

Writes the specified values to the EEPROM of an FT232R or FT245R device. Calls FT_EE_Program in FTD2XX DLL

FT_STATUS

WriteFT2232HEEPROM(FT2232H_EEPROM_STRUCTURE ee2232h)

Writes the specified values to the EEPROM of an FT2232H device. Calls FT_EE_Program in FTD2XX DLL

FT_STATUS

WriteFT4232HEEPROM(FT4232H_EEPROM_STRUCTURE ee4232h)

Writes the specified values to the EEPROM of an FT4232H device. Calls FT_EE_Program in FTD2XX DLL

FT_STATUS

WriteFT232HEEPROM(FT232H_EEPROM_STRUCTURE ee232h)

Writes the specified values to the EEPROM of an FT232H device. Calls FT_EE_Program in FTD2XX DLL

FT_STATUS

WriteXSeriesEEPROM(FT_XSERIES_EEPROM_STRUCTURE eeX)

Writes the specified values to the EEPROM of an X-Series device. Calls FT_EEPROM_Program in FTD2XX DLL

FT_STATUS

EEReadUserArea(byte[] UserAreaDataBuffer, out uint numBytesRead)

Reads data from the user area of the device EEPROM.

FT_STATUS

EEWriteUserArea(byte[] UserAreaDataBuffer)

Writes data to the user area of the device EEPROM.

FT_STATUS

GetDeviceType(ref FT_DEVICE DeviceType)

Gets the chip type of the current device.

FT_STATUS

GetDeviceID(ref uint DeviceID)

Gets the Vendor ID and Product ID of the current device.

FT_STATUS

GetDescription(out string Description)

Gets the description of the current device.

FT_STATUS

GetSerialNumber(out string SerialNumber)

Gets the serial number of the current device.

FT_STATUS

GetRxBytesAvailable(ref uint RxQueue)

Gets the number of bytes available in the receive buffer.

FT_STATUS

GetTxBytesWaiting(ref uint TxQueue)

Gets the number of bytes waiting in the transmit buffer.

FT_STATUS

GetEventType(ref uint EventType)

Gets the event type after an event has fired. Can be used to distinguish which event has been triggered when waiting on multiple event types.

FT_STATUS

GetModemStatus(ref byte ModemStatus)

Gets the current modem status.

FT_STATUS

GetLineStatus(ref byte LineStatus)

Gets the current line status.

FT_STATUS

SetBaudRate(uint BaudRate)

Sets the current Baud rate.

FT_STATUS

SetDataCharacteristics(byte DataBits, byte StopBits, byte Parity)

Sets the data bits, stop bits and parity for the device.

FT_STATUS

SetFlowControl(ushort FlowControl, byte Xon, byte Xoff)

Sets the flow control type.

FT_STATUS

SetRTS(bool Enable)

Asserts or de-asserts the Request To Send (RTS) line.

FT_STATUS

SetDTR(bool Enable)

Asserts or de-asserts the Data Terminal Ready (DTR) line.

FT_STATUS

SetTimeouts(uint ReadTimeout, uint WriteTimeout)

Sets the read and write timeout values.

FT_STATUS

SetBreak(bool Enable)

Sets or clears the break state.

FT_STATUS

SetResetPipeRetryCount(uint ResetPipeRetryCount)

Gets or sets the reset pipe retry count. Default value is 50.

FT_STATUS

GetDriverVersion(ref uint DriverVersion)

Gets the current FTDIBUS.SYS driver version number.

FT_STATUS

GetLibraryVersion(ref uint LibraryVersion)

Gets the current FTD2XX.DLL driver version number.

FT_STATUS

SetDeadmanTimeout(uint DeadmanTimeout)

Sets the USB deadman timeout value. Default is 5000ms.

FT_STATUS

SetLatency(byte Latency)

Sets the value of the latency timer. Default value is 16ms.

FT_STATUS

GetLatency(ref byte Latency)

Gets the value of the latency timer. Default value is 16ms.

FT_STATUS

InTransferSize(uint InTransferSize)

Sets the USB IN and OUT transfer sizes.

//UInt32

InTransferSize(UInt32 InTransferSize, UInt32 OutTransferSize)

Sets the USB IN and OUT transfer sizes.

FT_STATUS

SetCharacters(byte EventChar, bool EventCharEnable, byte ErrorChar, bool ErrorCharEnable)

Sets an event character, an error character and enables or disables them.

FT_STATUS

EEUserAreaSize(ref uint UASize)

Gets the size of the EEPROM user area.

FT_STATUS

GetCOMPort(out string ComPortName)

Gets the corresponding COM port number for the current device. If no COM port is exposed, an empty string is returned.

FT_STATUS

VendorCmdGet(ushort request, byte[] buf, ushort len)

Get data from the FT4222 using the vendor command interface.

FT_STATUS

VendorCmdSet(ushort request, byte[] buf, ushort len)

Set data from the FT4222 using the vendor command interface.

Private Functions

extern

IntPtr(string dllToLoad)

Built-in Windows API functions to allow us to dynamically load our own DLL. Will allow us to use old versions of the DLL that do not have all of these functions available.

extern

IntPtr(IntPtr hModule, string procedureName)

Built-in Windows API functions to allow us to dynamically load our own DLL. Will allow us to use old versions of the DLL that do not have all of these functions available.

extern

bool(IntPtr hModule)

Built-in Windows API functions to allow us to dynamically load our own DLL. Will allow us to use old versions of the DLL that do not have all of these functions available.

void

ErrorHandler(FT_STATUS ftStatus, FT_ERROR ftErrorCondition)

Method to check ftStatus and ftErrorCondition values for error conditions and throw exceptions accordingly.

Public Attributes

const

byte

8 data bits

const

byte

7 data bits

const

byte

1 stop bit

const

byte

2 stop bits

const

byte

No parity

const

byte

Odd parity

const

byte

Even parity

const

byte

Mark parity

const

byte

Space parity

const

ushort

No flow control

const

ushort

RTS/CTS flow control

const

ushort

DTR/DSR flow control

const

ushort

Xon/Xoff flow control

const

byte

Purge Rx buffer

const

byte

Purge Tx buffer

const

byte

Clear To Send (CTS) modem status

const

byte

Data Set Ready (DSR) modem status

const

byte

Ring Indicator (RI) modem status

const

byte

Data Carrier Detect (DCD) modem status

const

byte

Overrun Error (OE) line status

const

byte

Parity Error (PE) line status

const

byte

Framing Error (FE) line status

const

byte

Break Interrupt (BI) line status

uint

Flags

Indicates device state. Can be any combination of the following: FT_FLAGS_OPENED, FT_FLAGS_HISPEED

FT_DEVICE

Type

Indicates the device type. Can be one of the following: FT_DEVICE_232R, FT_DEVICE_2232C, FT_DEVICE_BM, FT_DEVICE_AM, FT_DEVICE_100AX or FT_DEVICE_UNKNOWN

uint

ID

The Vendor ID and Product ID of the device

uint

LocId

The physical location identifier of the device

string

SerialNumber

The device serial number

string

Description

The device description

IntPtr

ftHandle

The device handle. This value is not used externally and is provided for information only. If the device is not open, this value is 0.

ushort

VendorID

Vendor ID as supplied by the USB Implementers Forum

ushort

ProductID

Product ID

string

Manufacturer

Manufacturer name string

string

ManufacturerID

Manufacturer name abbreviation to be used as a prefix for automatically generated serial numbers

string

Description

Device description string

string

SerialNumber

Device serial number string

ushort

MaxPower

Maximum power the device needs

bool

SelfPowered

Indicates if the device has its own power supply (self-powered) or gets power from the USB port (bus-powered)

bool

RemoteWakeup

Determines if the device can wake the host PC from suspend by toggling the RI line

Private Attributes

//bool

PnP

Maximum power the device needs

Enums

FT_STATUS

[FT_OK = 0, FT_INVALID_HANDLE = 1, FT_DEVICE_NOT_FOUND = 2, FT_DEVICE_NOT_OPENED = 3, FT_IO_ERROR = 4, FT_INSUFFICIENT_RESOURCES = 5, FT_INVALID_PARAMETER = 6, FT_INVALID_BAUD_RATE = 7, FT_DEVICE_NOT_OPENED_FOR_ERASE = 8, FT_DEVICE_NOT_OPENED_FOR_WRITE = 9, FT_FAILED_TO_WRITE_DEVICE = 10, FT_EEPROM_READ_FAILED = 11, FT_EEPROM_WRITE_FAILED = 12, FT_EEPROM_ERASE_FAILED = 13, FT_EEPROM_NOT_PRESENT = 14, FT_EEPROM_NOT_PROGRAMMED = 15, FT_INVALID_ARGS = 16, FT_OTHER_ERROR = 17]

Status values for FTDI devices.

FT_ERROR

[FT_NO_ERROR = 0, FT_INCORRECT_DEVICE = 1, FT_INVALID_BITMODE = 2, FT_BUFFER_SIZE = 3]

Error states not supported by FTD2XX DLL.

FT_DEVICE

[FT_DEVICE_BM = 0, FT_DEVICE_AM = 1, FT_DEVICE_100AX = 2, FT_DEVICE_UNKNOWN = 3, FT_DEVICE_2232 = 4, FT_DEVICE_232R = 5, FT_DEVICE_2232H = 6, FT_DEVICE_4232H = 7, FT_DEVICE_232H = 8, FT_DEVICE_X_SERIES = 9, FT_DEVICE_4222H_0 = 10, FT_DEVICE_4222H_1_2 = 11, FT_DEVICE_4222H_3 = 12, FT_DEVICE_4222_PROG = 13]

List of FTDI device types