77
ATmega161(L)
1228B–09/01
Double-speed
Transmission
The ATmega161 provides a separate UART mode that allows the user to double the
communication speed. By setting the U2X bit in UART Control and Status Register
UCSRnA, the UART speed will be doubled. The data reception will differ slightly from
normal mode. Since the speed is doubled, the receiver front-end logic samples the sig-
nals on RXDn pin at a frequency 8 times the baud rate. While the line is idle, one single
sample of logical “0” will be interpreted as the falling edge of a start bit, and the start bit
detection sequence is initiated. Let sample 1 denote the first zero-sample. Following the
1-to-0 transition, the receiver samples the RXDn pin at samples 4, 5 and 6. If two or
more of these three samples are found to be logical “1”s, the start bit is rejected as a
noise spike and the receiver starts looking for the next 1-to-0 transition.
If, however, a valid start bit is detected, sampling of the data bits following the start bit is
performed. These bits are also sampled at samples 4, 5 and 6. The logical value found
in at least two of the three samples is taken as the bit value. All bits are shifted into the
transmitter shift register as they are sampled. Sampling of an incoming character is
shown in Figure 48.
Figure 48.
Sampling Received Data when the Transmission Speed is Doubled
The Baud Rate Generator in
Double UART Speed Mode
Note that the baud rate equation is different from the equation on page 75 when the
UART speed is doubled:
•
BAUD = Baud rate
•
f
CK
= Crystal Clock frequency
•
UBR = Contents of the UBRRHI and UBRR registers (0 - 4095)
•
Note that this equation is only valid when the UART transmission speed is doubled.
For standard crystal frequencies, the most commonly used baud rates can be generated
by using the UBR settings in Table 24. UBR values that yield an actual baud rate differ-
ing less than 1.5% from the target baud rate are boldface in the table. However, since
the number of samples are reduced and the system clock might have some variance
(this applies especially when using resonators), it is recommended that the baud rate
error be less than 0.5%.
START BIT
D0
D1
D2
D3
D4
D5
D6
D7
STOP BIT
RXD
RECEIVER
SAMPLING
BAUD
f
CK
8(UBR
1
)
+
------------------------------
=