Aliasing Serial Baud Rates in FTDI Drivers for Mac OS X

For a recent project, I needed to interface my computer to an embedded device over a RS-422 connection at 3.2Mbaud. Since this is a nonstandard serial rate, I set out to find a way to configure a relatively cheap USB UART bridge that supported communications at this speed.

FTDI makes a chip called the FT4232 that has four separate UART interfaces and supports baud rates from 3MBaud to 12MBaud using some extended clock settings. These extended baud rates are readily available with FTDI’s D2XX drivers, but I wanted to retain the ability to use a standard serial programming API to communicate with the hardware. As such, I was left with the task of aliasing some other standard baud rate to 3.2MBaud in the virtual com port drivers.

This is a task FTDI has outlined quite well for windows in an application note, and it is also buried in a application note for Mac OS X. I only located the Mac OS application note after figuring out the procedure myself, so I’ll break it down here for you.

  1. Install the FTDI VCP Drivers for Mac OS.
  2. Grab the VID and PID of your USB UART adapter, and convert them to decimal. These can be both be found under the device properties within the system profiler. Conversion to decimal can be done by googling “0xHEX_VALUE to decimal”. In the case of my FT4232, where I was interested in aliasing baud rates for port C of the device, the hex VID PID pair are 0x0403 and 0x6011, which translate to 1027 and 24593 decimal accordingly.
  3. Open the FTDI driver’s Info.plist in your favorite text editor as administrator. The Info.plist file can be found at /System/Library/Extensions/FTDIUSBSerialDriver.kext/Contents/Info.plist
  4. Locate the driver entry associated with the decimal encoded PID and VID of your USB device. The block of XML you’re interested in will look something like this:

    FT4232H_C
    
    	CFBundleIdentifier
    	com.FTDI.driver.FTDIUSBSerialDriver
    	IOClass
    	FTDIUSBSerialDriver
    	IOProviderClass
    	IOUSBInterface
    	bConfigurationValue
    	1
    	bInterfaceNumber
    	2
    	bcdDevice
    	2048
    	idProduct
    	24593
    	idVendor
    	1027
    
    
  5. Below the vendor ID configuration entry, add a new dictionary with a key of “ConfigData” to configure the baud rate alias you would like to set up. The last few lines of your device-specific configuration will then look like this:

    	idVendor
    	1027
    	ConfigData
    	
    		BaudRates
    		
    			B300
    			3200000
    		
    	
    
    

    As you can see, there’s a new key called “BaudRates” with an extra dictionary mapping standard baud rates to custom ones. Here, I’ve aliased 300 Baud to 3.2 MBaud. This section can also configure other functionality of the device, for which you should refer to the FTDI docs.

  6. Unplug your USB device.
  7. Unload the FTDI kext bundle with
    sudo kextunload -b com.FTDI.driver.FTDIUSBSerialDriver.
  8. Reload the FTDI kext bundle with
    sudo kextload -b com.FTDI.driver.FTDIUSBSerialDriver.
  9. Replug your USB device.
  10. Celebrate! Any serial connection you open at the standard baud rate you’ve aliased should now use the other clock rate you’ve specified.

Take care when configuring arbitrary serial baud rates. The clock divisors in the FT4232 and other FTDI chips have limited configurability. As such, it can be very easy to wind up with large enough of a clock skew (1-3%) between two serial devices to cause communication issues. For details on the clock rates your particular FTDI chip can achieve, take a close look at the baud rate calculation section of the Windows baud rate aliasing guide.