Clock generation, Atmega128(l) – Rainbow Electronics ATmega128L User Manual

Page 167

Advertising
background image

167

ATmega128(L)

2467B–09/01

Transmit Buffer Functionality

Receiver Operation

However, the receive buffering has two improvements that will affect the compatibility in
some special cases:

A second buffer register has been added. The two buffer registers operate as a
circular FIFO buffer. Therefore the UDR must only be read once for each incoming
data! More important is the fact that the error flags (FE and DOR) and the 9th data
bit (RXB8) are buffered with the data in the receive buffer. Therefore the status bits
must always be read before the UDR register is read. Otherwise the error status will
be lost since the buffer state is lost.

The receiver shift register can now act as a third buffer level. This is done by
allowing the received data to remain in the serial shift register (see

Figure 78) if the

buffer registers are full, until a new start bit is detected. The USART is therefore
more resistant to data overrun (DOR) error conditions.

The following control bits have changed name, but have same functionality and register
location:

CHR9 is changed to UCSZ2

OR is changed to DOR

Clock Generation

The clock generation logic generates the base clock for the transmitter and receiver.
The USART supports four modes of clock operation: normal asynchronous, double
speed asynchronous, master synchronous and slave synchronous mode. The UMSEL
bit in USART Control and Status Register C (UCSRC) selects between asynchronous
and synchronous operation. Double speed (asynchronous mode only) is controlled by
the U2X found in the UCSRA register. When using synchronous mode (UMSEL = 1), the
Data Direction Register for the XCK pin (DDR_XCK) controls whether the clock source
is internal (master mode) or external (slave mode). The XCK pin is only active when
using synchronous mode.

Figure 79 shows a block diagram of the clock generation logic.

Figure 79. Clock Generation Logic, Block Diagram

Signal description:

txclk

Transmitter clock. (Internal Signal)

rxclk

Receiver base clock. (Internal Signal)

Prescaling

Down-Counter

/ 2

UBRR

/ 4

/ 2

fosc

UBRR+1

Sync

Register

OSC

XCK

Pin

txclk

U2X

UMSEL

DDR_XCK

0

1

0

1

xcki

xcko

DDR_XCK

rxclk

0

1

1

0

Edge

Detector

UCPOL

Advertising