40.7.2 Data Transfer
Four combinations of polarity and phase are available for data transfers. The clock polarity is programmed with the CPOL bit in the SPI Chip Select registers (SPI_CSRx). The clock phase is programmed with the NCPHA bit. These two parameters determine the edges of the clock signal on which data is driven and sampled. Each of the two parameters has two possible states, resulting in four possible combinations that are incompatible with one another. Consequently, a Host/Client pair must use the same parameter pair values to communicate. If multiple Clients are connected and require different configurations, the Host must reconfigure itself each time it needs to communicate with a different Client.
The table below shows the four modes and corresponding parameter settings.
SPI Mode | CPOL | NCPHA | Shift SPCK Edge | Capture SPCK Edge | SPCK Inactive Level |
---|---|---|---|---|---|
0 | 0 | 1 | Falling | Rising | Low |
1 | 0 | 0 | Rising | Falling | Low |
2 | 1 | 1 | Rising | Falling | High |
3 | 1 | 0 | Falling | Rising | High |
The following figures show examples of data transfers.