Datasheet
74
ATmega323(L)
1457E–11/01
XCK (transfer clock) pin is only used by synchronous transfer mode. The transmitter
consists of a single write buffer, a serial shift register, parity generator and control logic
for handling different serial frame formats. The write buffer allows a continuous transfer
of data without any delay between frames. The receiver is the most complex part of the
USART module due to its clock and data recovery units. The recovery units are used for
asynchronous data reception. In addition to the recovery units, the receiver includes a
parity checker, control logic, a shift register and a two level receive buffer (UDR). The
receiver supports the same frame formats as the transmitter, and can detect frame
error, data overrun and parity errors.
ATmega323 USART Pin
Specification
Table 28 shows the ATmega323 specific USART pin placement.
As XCK is placed on PB0, DDR_XCK in the following refers to DDB0.
About Code Examples This USART documentation contains simple code examples that briefly show how to
use the USART. These code examples assume that the part specific header file is
included before compilation. Be aware that not all C compiler vendors include bit defini-
tions in the header files, and that interrupt handling in C is compiler dependent. Please
confirm with the C compiler documentation.
AVR USART vs. AVR
UART – Compatibility
The USART is fully compatible with the AVR UART regarding:
• Bit locations inside all USART registers
• Baud Rate Generation
• Transmitter Operation
• 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 operates 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 45) 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
Table 28. ATmega323 Specific USART Pin Placement
USART Pin Name Corresponding ATmega323 Pin
RxD PD0
TxD PD1
XCK PB0