FTDI USB-to-Serial Chips

The FT232R chips are a nice replacement for direct serial interfaces on any stand-alone electronic you design. However, they are more complicated and there are more settings to play with to get just the right performance. Lots of information is available at ftdichip.com, but some of the important links and info will be summarized here, as well as external links/info from other sources.

Simple Setup

If you don't care too much about precise timing or throughput and only want simple, non-time-sensitive read/write capability then there is very little to setup. For Windows, download the VCP drivers here. When you plug in the device will automatically show up as a new serial device on the next available COM port. A loadable kernel module (ftdi_sio) is included in Linux kernels 2.6.31 and later. When you plug in the device will automatically show up as /dev/ttyUSBx, where x is the next available number starting with 0.

In both cases, you can now use the device in any way that you would use a normal serial device; i.e. via Matlab or PySerial.

Advanced Options

This document outlines some of the advanced driver options. If you want to get predictable throughput for streaming data, you will probably need to play with the latency timer and the read/write chunk sizes, or setup an event character and/or use handshaking.

In windows, the options are accessible via the device properties in the Device Manager. Linux takes a bit more work.

Linux

As far as I can tell, the built-in VCP module in the Linux kernel only lets you play with the latency timer, and then only if you manually load the kernel module rather than letting the system automatically load it. This is done by running the following command as root before inserting the device:

modprobe ftdi_sio ndi_latency_timer=x

where x is the desired latency time in ms (1-255)

The more flexible option is to use libftdi instead of treating the device as any other serial device. Libftdi is a library which gives you more direct control over all the parameters but is a bit more unwieldy for reading/writing. It exists for C and C++, and has bindings for Python (and maybe others). All are easily installed via the Package Manager in Ubuntu.

-- BarrettHeyneman - 30 Jan 2011

 
This site is powered by the TWiki collaboration platformCopyright &© by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback