2 double speed operation (u2xn), 3 external clock, 4 synchronous clock operation – Rainbow Electronics ATmega128RFA1 User Manual
Page 342: Atmega128rfa1

342
8266A-MCU Wireless-12/09
ATmega128RFA1
Operating Mode
Equation for Calculating
Baud Rate
(1)
Equation for Calculating
UBRR Value
Synchronous Master Mode
)
1
(
2
+
=
UBRRn
f
BAUD
OSC
1
2
−
=
BAUD
f
UBRRn
OSC
Note:
1. The baud rate is defined to be the transfer rate in bit per second (bps).
BAUD
Baud rate (in bits per second, bps)
f
OSC
System oscillator clock frequency
UBRRn
Contents of the UBRRHn and UBRRLn registers, (0-4095)
Some examples of UBRRn values for some system clock frequencies are found in
.
23.3.2 Double Speed Operation (U2Xn)
The transfer rate can be doubled by setting the U2Xn bit in UCSRnA. Setting this bit
only has effect for the asynchronous operation. Set this bit to zero when using
synchronous operation.
Setting this bit will reduce the divisor of the baud rate divider from 16 to 8, effectively
doubling the transfer rate for asynchronous communication. Note however that the
receiver will in this case only use half the number of samples (reduced from 16 to 8) for
data sampling and clock recovery, and therefore a more accurate baud rate setting and
system clock are required when this mode is used. For the transmitter, there are no
downsides.
23.3.3 External Clock
External clocking is used by the synchronous slave modes of operation. The description
in this section refers to
for details.
External clock input from the XCKn pin is sampled by a synchronization register to
minimize the chance of meta-stability. The output from the synchronization register
must then pass through an edge detector before it can be used by the transmitter and
receiver. This process introduces a two CPU clock period delay and therefore the
maximum external XCKn clock frequency is limited by the following equation:
4
OSC
XCK
f
f
<
Note that f
OSC
depends on the stability of the system clock source. It is therefore
recommended to add some margin to avoid possible loss of data due to frequency
variations.
23.3.4 Synchronous Clock Operation
When synchronous mode is used (UMSELn = 1), the XCKn pin will be used as either
clock input (slave) or clock output (master). The dependency between the clock edges
and data sampling or data change is the same. The basic principle is that data input (on
RxDn) is sampled at the opposite XCKn clock edge of the edge the data output (TxDn)
is changed.