Datasheet
372
7674F–AVR–09/09
ATmega164P/324P/644P
16 SPI – Serial Peripheral Interface ......................................................... 161
16.1 Features ........................................................................................................161
16.2 Overview ........................................................................................................161
16.3 SS
Pin Functionality ......................................................................................166
16.4 Data Modes ...................................................................................................166
16.5 Register Description ......................................................................................168
17 USART ................................................................................................... 171
17.1 Features ........................................................................................................171
17.2 USART1 and USART0 ..................................................................................171
17.3 Overview ........................................................................................................171
17.4 Clock Generation ...........................................................................................173
17.5 Frame Formats ..............................................................................................176
17.6 USART Initialization .......................................................................................177
17.7 Data Transmission – The USART Transmitter ..............................................178
17.8 Data Reception – The USART Receiver .......................................................181
17.9 Asynchronous Data Reception ......................................................................185
17.10 Multi-processor Communication Mode ..........................................................188
17.11 Register Description ......................................................................................190
17.12 Examples of Baud Rate Setting .....................................................................195
18 USART in SPI Mode ............................................................................. 199
18.1 Features ........................................................................................................199
18.2 Overview ........................................................................................................199
18.3 Clock Generation ...........................................................................................199
18.4 SPI Data Modes and Timing ..........................................................................200
18.5 Frame Formats ..............................................................................................200
18.6 Data Transfer .................................................................................................203
18.7 AVR USART MSPIM vs. AVR SPI ................................................................205
18.8 Register Description ......................................................................................206
19 2-wire Serial Interface .......................................................................... 209
19.1 Features ........................................................................................................209
19.2 2-wire Serial Interface Bus Definition ............................................................209
19.3 Data Transfer and Frame Format ..................................................................210
19.4 Multi-master Bus Systems, Arbitration and Synchronization .........................213
19.5 Overview of the TWI Module .........................................................................215
19.6 Using the TWI ................................................................................................217