beautypg.com

1 setting the baud rate, Setting the baud rate – FUJITSU F2MCTM-16LX User Manual

Page 431

background image

415

CHAPTER 20 LIN-UART

20.6.1

Setting the Baud Rate

This section describes how the baud rates are set and the resulting serial clock
frequency is calculated.

Calculating the Baud Rate

The both 15-bit reload counters are programmed by the baud rate generator registers 1, 0 (BGR1/BGR0).

The following calculation formula should be used to set the desired baud rate:

Reload Value:

v = [

Φ / b] - 1,

where

Φ is the machine clock, b the baud rate and [] gaussian brackets (mathematical rounding function).

Example of calculation

If the machine clock is 16 MHz and the desired baud rate is 19200 bps baud then the reload value v is:

v = [16*10

6

/ 19200] - 1 = 832

The exact baud rate can then be recalculated: b

exact

=

Φ / (v + 1), here it is: 16*10

6

/ 833 = 19207.6831

Note:

Setting the reload value to 0 stops the reload counter. For this reason the minimum division ratio is 2.

For asynchronous communication, the reload value must be greater than equal to 4 because 5 times

over-sampling is performed to determine the reception value internally.