40.1 Description
The Serial Peripheral Interface (SPI) circuit is a synchronous serial data link that provides communication with external devices in Host or Client mode. It also enables communication between processors if an external processor is connected to the system.
The Serial Peripheral Interface is essentially a shift register that serially transmits data bits to other SPIs. During a data transfer, one SPI system acts as the “Host”' which controls the data flow, while the other devices act as “Clients'' which have data shifted into and out by the Host. Different CPUs can take turn being Hosts (multiple Host protocol, contrary to single Host protocol where one CPU is always the Host while all of the others are always Clients). One Host can simultaneously shift data into multiple Clients. However, only one Client can drive its output to write data back to the Host at any given time.
A Client device is selected when the Host asserts its NSS signal. If multiple Client devices exist, the Host generates a separate Client select signal for each Client (NPCS).
The SPI system consists of two data lines and two control lines:
- Host Out Client In (MOSI)—This data line supplies the output data from the Host shifted into the input(s) of the Client(s).
- Host In Client Out (MISO)—This data line supplies the output data from a Client to the input of the Host. There may be no more than one Client transmitting data during any particular transfer.
- Serial Clock (SPCK)—This control line is driven by the Host and regulates the flow of the data bits. The Host can transmit data at a variety of baud rates; there is one SPCK pulse for each bit that is transmitted.
- Client Select (NSS)—This control line allows Clients to be turned on and off by hardware.