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?