Automatic BAUD Rate Generator

Automatic BAUD Rate Generator


Category: Communication Controller

Created: September 17, 2002

Updated: January 27, 2020

Other project properties

Development Status: Stable

WishBone compliant: No

WishBone version: n/a

License: n/a


This module scans an incoming stream of rs232 serial characters. It constantly looks for a new character, which it detects by seeing the "start" bit. When a condition resembling a start bit is detected, the module then begins a measurement window, to try and determine the BAUD rate of the incoming character. Since many different characters have different bit transitions because of their different data content, this module actually only "targets" a single character -- in this case the "carriage return" character (0x0d). How can it tell if the character is the carriage return?

Well, once it finishes the measurement interval (first 2 bits of the received character) then it uses the measurement to produce a BAUD rate clock. The module uses this BAUD rate clock internally to verify the remaining 8 bits in the serial character (total of 10 bits per received character, including start/stop bits. Parity is supported, but has never been tested.)

If the remainder of the character verifies correctly to be a carriage return character, the measurement is accepted as valid, and the module then produces the BAUD rate clock externally, and flags that it has "locked" onto the BAUD rate of the incoming characters.
There are two versions of this module: One for a single lock at the beginning of the session, which is then maintained for the entire duration of the session (this one is called "auto_baud.v"). And another version constantly tracks the incoming characters, which allows for changes in the clock rate and/or BAUD rate of incoming characters to happen at any time, and the BAUD rate will adjust as soon as the carriage return character is detected (this one is called "auto_baud_with_tracking.v") Because of the extra logic needed to produce a BAUD rate while checking a possible new BAUD rate at the same time, the tracking version is slightly larger than the "single lock" version, and it will work with faster clock speeds.

The auto_baud generator is intended for use in "human interface" rs232 serial applications. It has also been tested with "text file transfer" in hyperterm and SecureCRT terminal programs, to see if it would function during higher speed character transfer, and it worked just fine.


- Tested in Xilinx XC2V200 hardware, no simulation available.
- Test results, and documentation given in code header comments.
- A PC using "hyperterm" and "SecureCRT" was used for testing.
- "auto_baud.v" consumes 59 slices and works up to 87 MHz (no constraints.)
- "auto_baud_with_tracking.v" consumes 93 slices, operates up to 102 MHz (no constraints.)
- Code is written in Verilog and VHDL. Both versions have been tested.
- Default parameter settings work from 300 BAUD up to 115200 BAUD with any FPGA board clock between 30 MHz and 100 MHz.
- Clock speeds lower than 30 MHz support lower BAUD rates, like 9600. See code for details.
- The new VHDL version is a package file in the SVN repository trunk.
- Fully parameterized module.
- Will operate just fine with "non standard" BAUD rates -- such as MIDI (musical instrument digital interface.) No calculations required.
- Works with "rs232_syscon" for an easier bring up of debugging sessions.