8-bit AVR Microcontroller

Data Modes

There are four combinations of SCK phase and polarity with respect to serial data, which are determined by control bits CPHA and CPOL. The SPI data transfer formats are shown in the figures in this section. Data bits are shifted out and latched in on opposite edges of the SCK signal, ensuring sufficient time for data signals to stabilize. This is clearly seen by summarizing Table 1 and Table 2, as done below:

Table 1. CPOL and CPHA Functionality
SPI Mode Conditions Leading Edge Trailing Edge
0 CPOL=0, CPHA=0 Sample (Rising) Setup (Falling)
1 CPOL=0, CPHA=1 Setup (Rising) Sample (Falling)
2 CPOL=1, CPHA=0 Sample (Falling) Setup (Rising)
3 CPOL=1, CPHA=1 Setup (Falling) Sample (Rising)
Figure 1. SPI Transfer Format with CPHA = 0
Figure 2. SPI Transfer Format with CPHA = 1