h1

Xmega USART fractional baud-rate speadsheet

2010/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.

http://www.omegacs.net/products/atxmega/USART-fractional.ods

4 comments

  1. So regarding to the baud rate, it seems that the information in xmega datasheets is not as friendly as the one for previous mega micros… for them I was able to choose the crystal oscillator from a table, which shows some examples for common oscillator frequencies and baud rates.

    That’s why I truly appreciate your spreadsheet. Thanks a lot for it!


  2. Yeah, given the potential for PLL settings, BSEL, and BSCALE, putting tables in would have be prohibitively large. The spreadsheet gives you a pretty good view of how it works and what kind of rates you can pull off with a given clock.

    Also check out the later post with compile-time and run-time calculation code.

    Glad it’s been useful! ;-)


  3. […] I posted a spreadsheet I created that calculated the BSEL and BSCALE for the Xmega’s fractional baud-rate generator.  This works well to determine what the […]


  4. Very nice spreadsheet, thank you.



Leave a reply to omegacs Cancel reply