Skip to content
Documentation sections

UART Baud Rate & Frame Timing Calculator

POSThttps://rftools.io/api/py/v1/calculate

Slug uart-baud-rate. Calculate UART frame timing, throughput, and USART BRR register divisor from baud rate, data format, and MCU clock frequency. Identify baud rate error for reliable serial communication.

Inputs

Send every one of these in inputs, in the units shown. Most are required: a call without one is refused (400) and costs nothing; one the calculator can do without takes the default shown. An input outside its range is still computed and flagged in the provenance.

Inputs of uart-baud-rate
NameUnitRangeDefaultDescription
baudRatenumberbps300 … 4000000115200Serial baud rate in bits per second
dataBitsnumberbits5 … 98Number of data bits per frame (typically 8)
stopBitsnumberbits1 … 211 stop bit is standard; 2 may be used for slow receivers
paritynumberbits0 … 20Parity BitsOne of: 0 None · 1 Even or odd (1 bit)
clockFreqnumberMHz1 … 100016MCU peripheral (APB) clock frequency used for BRR divisor calculation
oversamplingnumbernone8 … 1616Samples per bit: 16× is the usual mode; 8× (STM32 OVER8, AVR U2X) doubles the fastest rate at the cost of noise immunityOne of: 16 16× · 8 8×
divisorFractionnumbernone0 … 10A whole divisor (AVR UBRR, the 16550) or one with a fraction of 1/OS (STM32 USARTDIV), which comes far closer to most ratesOne of: 0 Whole number · 1 With fraction (1/OS)
errorBudgetnumber%0.1 … 102The baud-rate error the link can take, ± both ends together; about ±2 % for 16× oversampling and 8N1 frames

Outputs

Returned in values, by key. A value that is unbounded or undefined is null.

Outputs of uart-baud-rate
FieldUnitDescription
frameBitsbits1 start + data bits + parity + stop bits
bitPeriod_usµsBit Period
framePeriod_usµsFrame Period
framesPerSecondfpsFrames per Second
throughputKbpskbpsEffective data rate (data bits only, not overhead)
brrDivisornoneThe clock over the oversampling rate times the baud rate, before rounding
actualBaudRatebpsBaud rate achieved with the divisor as set
baudRateError_pctheadline%Deviation of actual from target baud rate; keep below 2% for reliable operation
divisorSetnoneThe divisor the register holds: whole, or in steps of 1/OS
baudError_pct%Actual over target, signed: negative when the actual rate is slower
stopSampleOffset_bitsbitsHow far from the stop bit's centre a receiver at the actual rate samples a frame sent at the target rate; positive is late

Calling it

  • Calculate: one call, the request and response in full, and its errors.
  • Batch: this calculator with others, or a sweep, in one request.
  • Solve for a target: the value of one input that brings an output to a target.