Automatic baud rate detection (ABR, autobaud) refers to the process by which a receiving device (such as a modem) determines the speed, code level, start bit, and stop bits of incoming data by examining the first character, usually a preselected sign-on character (syncword) on a UART connection. ABR allows the receiving device to accept data from a variety of transmitting devices operating at different speeds without needing to establish data rates in advance.
Feb 27, 2020 Some NI serial hardware can support additional standard baud rates. Some hardware can also support any arbitrary baud rate up to its specified maximum rate. For more information on what your hardware supports, refer to the NI Serial Hardware Specifications and Features Guide. Baud-rate is the desired baud rate setting for the RS-232 serial console port in bits per second (bps). Valid values are 110, 300, 1200, 2400, 4800, 9600, 19200, 38400, 57600, or 115200. The default value is 115200 on Solace PubSub+ 3260, 3530, and 3560. To view the baud rate used for the RS-232 serial console port, enter the show console command.
During the autobaud process, the baud rate of received character stream is determined by examining the received pattern and its timing, and the length of a start bit. These type of baud rate detection mechanism are supported by many hardware chips including processors such as STM32 MPC8280, MPC8360, and so on.
When start bit length is used to determine the baud rate, it requires the character to be odd since UART sends LSB bit first. Often symbols 'a' or 'A' (0x61 or 0x41) are used. For example, the MPC8270 SCC tries to detect the length of the UART start bit for autobaud.
Most modems seen in market currently support autobaud. Before receiving any input data, most modems use a default baud rate of 9600 for output. For example, the following modems have been verified for autobaud and default output baud rate 9600:
- USRobotics USR5686G 56K Serial Controller Fax modem
- Hayes V92 External modem
- microcom DeskPorte 28.8P
The baud rate of modems are adjusted automatically after receiving input data by the autobaud process.
Many protocols begin each frame with a preamble of alternating 1 and 0 bits that can be used for automatic baud rate detection.For example, the TI PGA460 uses a 'U' ( 0x55 ) sync byte for automatic baud rate detection as well as frame synchronization,[1]and so does the LIN header (Local Interconnect Network#Header).For example, the UART-based FlexWire protocol begins each frame with a 'U' (0x55) sync byte.FlexWire receivers use the sync byte to precisely set their UART bit-clock frequency without a high-precision oscillator.[2]For example, the Ethernet preamble contains 56 bits of alternating 1 and 0 bits for synchronizing bit clocks.
See also[edit]
References[edit]
- ^'Sync Field' section of'PGA460 Ultrasonic Signal Processor and Transducer Driver'.2017.p. 35.
- ^Texas Instruments.'TPS929121-Q1 12-Channel Automotive 40-V High-Side LED Driver With FlexWire'.2021.p. 37 and p. p. 39.
Serial Baud Rates List
- '17.2 Autobaud Operation on a UART in MPC8280 PowerQUICC™ II Family Reference Manual' http://www.nxp.com/files/netcomm/doc/ref_manual/MPC8280RM.pdf
- 'Automatic Baud Rate Detection on the MSP430' https://web.archive.org/web/20161026080239/http://www.ti.com/lit/an/slaa215/slaa215.pdf
- 'How to implement “auto baud rate detection” feature on Cortex-M3' https://stackoverflow.com/q/38979647
- 'mpc8270 SCC2 UART issue' https://community.nxp.com/message/906833
- This article is based on material taken from the Free On-line Dictionary of Computing prior to 1 November 2008 and incorporated under the 'relicensing' terms of the GFDL, version 1.3 or later.
As discussed on the prior page, the transmitter and receiver each needs to be within 2% of the agreed bps/baud rate to ensure accurate serial communication. Usually this means pre-programming or configuring the rate in both devices, and using either an individually compensated oscillator or a crystal.
In April 1989, Eddy Carroll published a method where the receiver could configure the baud rate based on the transmitter. The basic algorithm is for the receiver to start at a specific rate (9600), for the transmitter to transmit a known character (carriage return), and then for the receiver to adjust its rate based on what character it actually receives.
For example, if the carriage return is received correctly, then both the transmitter and receiver are at 9600 bps. However, if the receiver sees a lowercase 'x' character, then the receiver knows that the transmitter is at 2400 bps. Eddy logically worked out a list of predetermined values that would be received for the major bit rates.
Detect Serial Baud Rate Calculator
Unfortunately, the problem that I encounter most often is not a major baud mismatch, but instead a slightly inaccurate oscillator built into the microcontroller. That is, to save on expense, board space, and to free up a couple of pins, I tend to use the microcontroller’s built-in clock rather than a highly accurate external crystal. So, rather than only a 0.2% error for an 8 MHz clock at 38400 bps (result of around 38232), the microcontroller outputs something more like 37654 bps because the clock is actually 8.122802 MHz.
There are multiple ways of adjusting serial timing, but in any case I need to pull out my logic analyzer and measure the width of the start bit to know how much of an adjustment needs to be made. I’d rather have a tool to calculate it for me. So, I made one.
Serial bit rate detector project
Detect Serial Baud Rate Speeds
The project box is a red Hammond Manufacturing 1591C enclosure obtained from All Electronics (CAT# 1591-CTRD). The LED display is the Lite-On LTM-Y2K19JF-03.
Inside the serial bit rate detector
The tool can supply its own power from the internal 9 volt battery, can optionally output 5 V to the project being tested, or can be supplied power from the project being tested. I had hoped to use this tool with voltages from 2.7 V to 5.5 V; however the display becomes too dim to read at 3.5 V.
The circuit itself is simple:
① MCP1702-5002E voltage regulator can supply up to 250 mA at 5 V from up to a 13.2 V source. It uses very little current and has a low dropout voltage. It was chosen primarily because it is small and can supply power from a 9 V battery. A 78L05 in the same package tops out at 100 mA. The LED display needs around 200 mA.
② Header for 5 V, ground, potentiometer analog input, timer capture (serial input), and button digital input. This connects to the controls and all but one hook point on the enclosure. The timer capture pin is the most interesting, as it measures the length of the bits being transmitted by the project being tested.
③ Crystal at 18.432 MHz. This was chosen to provide very accurate measurement, to precisely match most baud rates, and to be as fast as possible so that high baud rates can be measured. (I upgraded to a 22.1184 MHz crystal on my next Mouser or DigiKey order, even though that clock speed is faster than the chip is officially spec’d. This works because I’m not using the microcontroller’s eeprom, and it is being run at room temperature and a full 5 V. Microcontroller manufacturers derate the maximum speed to be sure the microcontroller runs under more difficult conditions.)
④ Atmel AVR ATtiny84 8-bit microcontroller. This board was created years before envisioning this tool, using leftover room on a PCB. The 14-pin DIP ATtiny84 fits nicely in the space available. As you can see, other than the microcontroller and voltage regulator, the remainder of the circuit was built into the prototyping area (sea of holes).
⑤ PNP transistor for turning power on and off to the display. Being an LED display as opposed to an LCD display, the light emitting diodes use a lot of energy for a battery-powered project. If inadvertently left idle, the tool can turn off the display to save power.
⑥ Header for 5 V, ground, clock, and data for the display.
UPDATE: I have since designed a clean printed circuit board for this project, which you can download for free.
Hookup and Usage
To measure the serial bit rate (same as baud rate for this tool), simply connect the ground wire of the tool and target project together. Then, connect the input capture pin of the tool to the serial TX (transmit output) pin of the target project. You can still connect the target project to the computer’s serial port at the same time, if desired. The tool is just “listening” to the conversation.
That’s it.
The tool displays the exact bit rate of whatever the target project transmits. Pressing the “clear” button causes the tool to start sampling over again, in case you want to tweak the target project’s serial rate on the fly.
Next we'll take a closer look at the timer capture capability of the microcontroller, as well as the relevant source code.