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.
- Install the FTDI VCP Drivers for Mac OS.
- 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
0x6011, which translate to
- Open the FTDI driver’s Info.plist in your favorite text editor as administrator. The Info.plist file can be found at
- 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:
<key>FT4232H_C</key> <dict> <key>CFBundleIdentifier</key> <string>com.FTDI.driver.FTDIUSBSerialDriver</string> <key>IOClass</key> <string>FTDIUSBSerialDriver</string> <key>IOProviderClass</key> <string>IOUSBInterface</string> <key>bConfigurationValue</key> <integer>1</integer> <key>bInterfaceNumber</key> <integer>2</integer> <key>bcdDevice</key> <integer>2048</integer> <key>idProduct</key> <integer>24593</integer> <key>idVendor</key> <integer>1027</integer> </dict>
- 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:
<key>idVendor</key> <integer>1027</integer> <key>ConfigData</key> <dict> <key>BaudRates</key> <dict> <key>B300</key> <integer>3200000</integer> </dict> </dict> </dict>
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.
- Unplug your USB device.
- Unload the FTDI kext bundle with
sudo kextunload -b com.FTDI.driver.FTDIUSBSerialDriver.
- Reload the FTDI kext bundle with
sudo kextload -b com.FTDI.driver.FTDIUSBSerialDriver.
- Replug your USB device.
- 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.