descriptionFTDI USB-to-serial emulation for LUFA
ownerJim Paris
last changeWed, 3 Jun 2015 20:35:50 +0000 (16:35 -0400)

FTDI serial chip emulation for LUFA

Written by Jim Paris


This project is an example of FTDI usb-to-serial chip emulation for LUFA. It is fully interrupt-driven. It acts as a FT232RL with id 0403:6001. On Linux, the corresponding host driver is ftdi_sio.

Note that it's probably against the EULA of the proprietary FTDI Windows driver to use it with non-FTDI hardware. And using someone else's VID will prevent you from passing USB-IF compliance tests.


git submodule init
git submodule update


Basic configuration of the FTDI emulation is in ftdi.h. Read and write buffers are maintained in a FIFO queue of length FTDI_TX_QUEUE_LEN and FTDI_RX_QUEUE_LEN. The latter must be greater than the endpoint size. For a smaller memory footprint, FTDI_TXRX_EPSIZE can be reduced (try 16).


Call void ftdi_init(int flags) after the corresponding LUFA USB_Init(). Valid flags are a bitwise OR of the following:

FTDI_NO_STDIO     Don't reconfigure libc's stdio
FTDI_STDIO        Point stdio routines to ftdi_putchar / ftdi_getchar

FTDI_NONBLOCKING  Neither ftdi_putchar nor ftdi_getchar will block.
FTDI_BLOCKING_IN  ftdi_getchar will block if no data is available
FTDI_BLOCKING_OUT ftdi_putchar will block is no room in TX buffer
FTDI_BLOCKING     Both ftdi_getchar and ftdi_putchar will block

When input is nonblocking, ftdi_getchar will return -1 if no data is available. When output is nonblocking, ftdi_putchar will drop data if no TX buffer space is available. Regardless of blocking status, if the RX buffer is full, data received from the PC will be dropped.


BSD 2-clause, see LICENSE

2015-06-03  Jim ParisFix submodule; upstream code has rebased master
2013-11-10  Jim ParisRemoved -- use
2012-10-12  Jim ParisShow nonprinting characters in terminal
2012-10-08  Jim ParisFind and use the optimal number of banks.
2012-10-08  Jim ParisReuse product string as interface string, like real...
2012-10-01  Jim ParisInclude dfu makefile
2012-10-01  Jim ParisFix README
2012-10-01  Jim ParisAdd license
2012-10-01  Jim ParisUpdate README
2012-10-01  Jim ParisAdd submodule warnings to Makefile
2012-10-01  Jim ParisFix submodule build instructions
2012-10-01  Jim ParisUpdated README
2012-10-01  Jim ParisInitial commit, based on code from my accelog project
3 years ago master
5 years ago atmega8u2
5 years ago stack-debug
5 years ago atmega32u2