# How does 16550 UART handle non-integer baud rates? [closed]

The 16550 UART calculates the baud rate using formula 115200 divided by the 16-bit number obtained by concatinating the High and Low DL registers. There are several well-known divisors that get you well known baud rates, and are easy to calculate. A baud rate of 9600 is just 115200/12. 57600 is 115200/2, 300 baud is 115200/384, etc... 115200 has 90 integer divisors.

My question, which I don't /think/ is answered in the datasheet, is that happens when you input a value for the divisor that doesn't come out to an integer like, say, 7. 115200/7 = 16457.142....

I can see any one of the following being potential outcomes:

• The chip attempts to operate at the baud rate specified including fractional timings
• The divisor is considered invalid, the change is ignored, and the chip continues to transmit at the previous rate (perhaps raising an error?)
• The baud rate is rounded to the nearest integer (i.e, '7' would result in a baud rate of 16457)
• The baud rate is rounded to the nearest integer divisor of 115200 (one of the 90, so '7' would result in 14400 baud)
• Something else I haven't thought of. I know, for example, some datasheets warn about writing '0' to these registers, as 115200/0 is undefined.

I was going to test this on a Raspberry Pi 3, only to discover the UARTs on there aren't real 16550s. I will attempt to test real hardware as soon as I can lay my hands on some, but that may be a while and my little project is stalled until I know the answer. Any ideas?

## closed as too broad by Chris Stratton, Enric Blanco, Dmitry Grigoryev, PeterJ, uint128_tJul 4 '17 at 21:58

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• It matters not a bit if the baud rate (ie, the quotient) is an integer, as long as sending and receiving rates match within tolerance. However, your title mismatches your question. It's relatively rare, and quite complex, for a chip to be able to handle a non-integer divisor. – Chris Stratton Jul 2 '17 at 5:25
• A baud rate physically is a frequency: 1/time. If we would not use "seconds" but another unit for time all "common" baud rates would be non-integer. Why do you think a baud rate must be an integer? – Martin Rosenau Jul 2 '17 at 13:46
• @Chris Stratton: I corrected the title. I shouldn't write questions while tired. – clemej Jul 2 '17 at 15:22
• @Martin, being a cheap digital IC, I assumed that complex things like floating point wouldn't be implemented. So fractional clocks wouldn't make sense. I'm guessing I obviously don't understand how this works internally. – clemej Jul 2 '17 at 15:26
• @clemej You didn't understand the comment: The baud rate is an analogue value just like the volatage. The exact voltage of a circuit will never be 5.000000V but maybe 5.00123V. The same is true for the baud rate. The IC generates the baud rate by dividing the analogue input frequency by an integer divider. If the input frequency is 100 Hz and the divider is 3 the result will be 33.333... Bauds. If the input frequency is 99.999 Hz and the divider is 1 you'll get 99.999 Bauds although the divider is 1! – Martin Rosenau Jul 2 '17 at 16:31