Setting USB232/485i Custom Baud Rates in Windows


The Windows drivers for the USB232 and USB485i USB to serial converters can generate a wide selection of baud rates. The new USB232U and USB485Ui can generate an even wider selection of baud rates. However, many Windows applications and some software components offer a fairly restricted choice of baud rates to the user or programmer.

Example 1:
The Windows HyperTerminal program only allows the baud rate to be chosen from a drop-down list.
Example 2:
The MSComm control supplied with Microsoft Visual Basic only allows certain baud rates to be specified in its Settings property.

The available solutions to these problems depend on how much control as a user or a programmer one has over the application in question.

Prebuilt Application With A Limited Choice of Baud Rates

If the application being used cannot be modified and does not support the desired baud rate, it is possible to spoof one of the supported baud rates in the driver so that the desired baud rate is generated instead. This is a fairly tricky operation and involves either:

  1. modifying an INF file before installing a device for the first time (or after using the FTDIUNIN.EXE program to remove the existing driver files); or
  2. modifying the registry settings for a device after installation.

See Spoofing Baud Rates for USB232 and USB485i for details of the process.

Custom Visual Basic Application Using MSComm Control

If one has written an application in Visual Basic, using the supplied MSComm control for serial communications, one finds that only a limited set of baud rates is available when setting the MSComm object's Settings property. The options in this case are as follows:

  1. use a supported baud rate and spoof it in the driver, as for a prebuilt application;
  2. call the Win32 API directly to change the baud rate, as in this example code; or
  3. obtain a third-party serial communications control that supports any baud rate, or write your own.

Custom Application Using Win32 API

If one is programming serial communications at the Win32 API level, using the GetCommState and SetCommState functions, one may set theBaudRate member of the DCB to any baud rate supported by the driver.

Custom .NET Application

See the Serial Comm feature by John Hind in the October 2002 issue of MSDN Magazine.