UFTDI(4)
π uftdi(4) β the Future Technology Devices International USB to serial UART driver π
okay so bestie, meet uftdi(4) β the Future Technology Devices International USB to serial UART driver. Sheβs giving βsmall chip, big tty energy,β and weβre gonna go through the whole page together. β¨
β¨ NAME β¨
uftdi β Future Technology Devices International USB to serial UART driver
π§ SYNOPSIS π§
device usb
device ucom
device uftdi
In rc.conf(5):
kld_list="uftdi"
In sysctl.conf(5):
hw.usb.uftdi.debug=1
hw.usb.uftdi.skip_jtag_interfaces=0
πΈ DESCRIPTION πΈ
The uftdi driver supports FTDI USB to serial UART devices. If the appropriate hardware is detected, the driver will be loaded automatically by devmatch(8). To load the driver manually, add it to the kld_list in rc.conf(5), or use kldload(8) at runtime. The device is accessed through the ucom(4) driver which makes it behave like a tty(4).
Call out through this interface with applications like cu(1) or tip(1). π
π₯ HARDWARE π₯
The uftdi driver supports the following USB to serial UART controllers:
- FTDI FT4232H
- FTDI FT232R
- FTDI FT230X
- FTDI FT2232H
- FTDI FT2232D
- FTDI FT2232C
- FTDI FT8U232BM
- FTDI FT8U232AM
- FTDI FT8U100AX
π SYSCTL VARIABLES π
These settings can be entered in the loader(8) prompt, set in loader.conf(5), sysctl.conf(5), or changed at runtime with sysctl(8):
hw.usb.uftdi.debugβ enable debugging messages, default0hw.usb.uftdi.skip_jtag_interfacesβ ignore JTAG interfaces, default1
π IOCTLS π
Many of the supported chips provide additional functionality such as bitbang mode and the MPSSE engine for serial bus emulation. The uftdi driver provides access to that functionality with the following ioctl(2) calls, defined in <dev/usb/uftdiio.h>:
UFTDIIOC_RESET_IO (int)β reset the channel to its default configuration, flush RX and TX FIFOs.UFTDIIOC_RESET_RX (int)β flush the RX FIFO.UFTDIIOC_RESET_TX (int)β flush the TX FIFO.UFTDIIOC_SET_BITMODE (struct uftdi_bitmode)β put the channel into the operating mode specified inmode, and set the pins indicated by ones iniomaskto output mode. Themodemust be one of theuftdi_bitmodesvalues. SettingmodetoUFTDI_BITMODE_NONEreturns the channel to standard UART mode.
enum uftdi_bitmodes
{
UFTDI_BITMODE_ASYNC = 0,
UFTDI_BITMODE_MPSSE = 1,
UFTDI_BITMODE_SYNC = 2,
UFTDI_BITMODE_CPU_EMUL = 3,
UFTDI_BITMODE_FAST_SERIAL = 4,
UFTDI_BITMODE_CBUS = 5,
UFTDI_BITMODE_NONE = 0xff,
};
struct uftdi_bitmode
{
uint8_t mode;
uint8_t iomask;
};
Manuals and application notes published by FTDI describe these modes in detail. To use most of these modes, you first put the channel into the desired mode, then you read(2) and write(2) data which either reflects pin state or is interpreted as MPSSE commands and parameters, depending on the mode.
UFTDIIOC_GET_BITMODE (struct uftdi_bitmode)β return the current bitbang mode in themodemember, and the state of theDBUS0..DBUS7pins at the time of the call in theiomaskmember. The pin state can be read while the chip is in any mode, includingUFTDI_BITMODE_NONE(UART) mode.UFTDIIOC_SET_ERROR_CHAR (int)β set the character which is inserted into the buffer to mark the point of an error such as FIFO overflow.UFTDIIOC_SET_EVENT_CHAR (int)β set the character which causes a partial FIFO full of data to be returned immediately even if the FIFO is not full.UFTDIIOC_SET_LATENCY (int)β set the amount of time to wait for a full FIFO, in milliseconds. If more than this much time elapses without receiving a new character, any characters in the FIFO are returned.UFTDIIOC_GET_LATENCY (int)β get the current value of the latency timer.UFTDIIOC_GET_HWREV (int)β get the hardware revision number. This is thebcdDevicevalue from theusb_device_descriptor.UFTDIIOC_READ_EEPROM (struct uftdi_eeio)β read one or more words from the configuration eeprom. The FTDI chip performs eeprom I/O in 16-bit words. Setoffsetandlengthto values evenly divisible by two before the call, and thedataarray will contain the requested values from eeprom after the call.
struct uftdi_eeio
{
uint16_t offset;
uint16_t length;
uint16_t data[64];
};
The FT232R chip has an internal eeprom. An external serial eeprom is optional on other FTDI chips. The eeprom may contain 64, 128, or 256 words, depending on the part used. Multiple calls may be needed to read or write the larger parts. When no eeprom is present, all words in the returned data are 0xffff. An erased eeprom also reads as all 0xffff.
UFTDIIOC_WRITE_EEPROM (struct uftdi_eeio)β write one or more words to the configuration eeprom. Theuftdi_eeiovalues are as described forUFTDIIOC_READ_EEPROM.
The FTDI chip does a blind write to the eeprom, and it will appear to succeed even when no eeprom is present. To ensure a good write you must read back and verify the data. It is not necessary to erase before writing. Any position within the eeprom can be overwritten at any time. π
UFTDIIOC_ERASE_EEPROM (int)β erase the entire eeprom. This is useful primarily for test and debugging, as there is no need to erase before writing. To help prevent accidental erasure caused by calling the wrong ioctl, you must pass the special valueUFTDI_CONFIRM_ERASEas the argument to this ioctl. π«Ά
π¦ FILES π¦
/dev/ttyU*β for callin ports/dev/ttyU*.init/dev/ttyU*.lockβ corresponding callin initial-state and lock-state devices/dev/cuaU*β for callout ports/dev/cuaU*.init/dev/cuaU*.lockβ corresponding callout initial-state and lock-state devices
π SEE ALSO π
cu(1), tty(4), ucom(4), usb(4)
π HISTORY π
The uftdi driver appeared in FreeBSD 4.8 from NetBSD 1.5.
xoxo, your uftdi(4) bestie π β this page is from Debian, dated June 25, 2025. periodt. π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- π the page's license: BSD-2-Clause
- Copyright (c) 2000 The NetBSD Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms