30.4.2 Operation

The SPI is a synchronous data transfer interface. It allows high-speed communication between the device and peripheral devices.

The SPI can operate as either a host or a client. As a host, the SPI initiates and controls all data transactions. The SPI is single-buffered for transmitting and double-buffered for reception. When transmitting data, the DATA register can be loaded with the next character to be transmitted while the current transmission is in progress. During reception, the data are transferred to the two-level receive buffer, and the receiver is ready for a new character.

The SPI transaction format is shown in the following figure. Each transaction can contain one or more characters. The character size is configurable and can be either eight or nine bits.

Figure 30-2. SPI Transaction Format

The SPI host must pull the SPI select (SS) line of the desired client low to initiate a transaction if multiple clients are connected to the bus. The SPI select (SS) line can be wired low if there is only one SPI client on the bus. The host and client prepare data to send using their respective shift registers, and the host generates the serial clock on the SCK line.

Data are always shifted from host to client on the Host Output Client Input line (MOSI); and from client to host on the Host Input Client Output (MISO) line.

Each time a character is shifted out by the host, a character is shifted out by the client simultaneously. To signal the end of a transaction, the host pulls the SS line high.