Xmega USART fractional baud-rate speadsheet2010/06/16
The default baud rate on the Bluetooth adapters I’m using to program and debug the current generation of board for my main contract is 115.2K. That’s actually rather slow when shoving 50-80KB onto the chip every time I make a code change. The adapters are capable of up to 921.6K, but even at 32MHz a normal USART baud-rate generator ends up with a particularly ugly error percentage (8.5% as it happens, well outside the allowed 2.0%). However, the Xmega has a fractional baud-rate generator. I’m not actually sure how it operates, but I know it’s capable of generating much more accurate serial clocks.
Because the calculations are rather tedious, I designed a simple spreadsheet to tell you what the usable BSEL and BSCALE values are for a given rate. Plug in your main clock rate and target baud rate, and it’ll show you the viable combinations. For 32MHz 921.6Kbaud, the BSCALE has to be set to -2 or lower, with -7 providing a combination that’s only off 0.1% of nominal.