645
SAM4CP [DATASHEET]
43051E–ATPL–08/14
33.
Serial Peripheral Interface (SPI)
33.1
Description
The Serial Peripheral Interface (SPI) circuit is a synchronous serial data link that provides communication with external
devices in Master or Slave 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 “master”' which controls the data flow, while the other devices act as “slaves'' which
have data shifted into and out by the master. Different CPUs can take turn being masters (multiple master protocol,
contrary to single master protocol where one CPU is always the master while all of the others are always slaves). One
master can simultaneously shift data into multiple slaves. However, only one slave can drive its output to write data back
to the master at any given time.
A slave device is selected when the master asserts its NSS signal. If multiple slave devices exist, the master generates a
separate slave select signal for each slave (NPCS).
The SPI system consists of two data lines and two control lines:
Master Out Slave In (MOSI): This data line supplies the output data from the master shifted into the input(s) of the
slave(s).
Master In Slave Out (MISO): This data line supplies the output data from a slave to the input of the master. There
may be no more than one slave transmitting data during any particular transfer.
Serial Clock (SPCK): This control line is driven by the master and regulates the flow of the data bits. The master
can transmit data at a variety of baud rates; there is one SPCK pulse for each bit that is transmitted.
Slave Select (NSS): This control line allows slaves to be turned on and off by hardware.
33.2
Embedded Characteristics
Master or Slave Serial Peripheral Bus Interface
8-bit to 16-bit Programmable Data Length Per Chip Select
Programmable Phase and Polarity Per Chip Select
Programmable Transfer Delay Between Consecutive Transfers and Delay before SPI Clock per Chip Select
Programmable Delay Between Chip Selects
Selectable Mode Fault Detection
Master Mode can drive SPCK up to peripheral clock
Master Mode Bit Rate can be Independent of the Processor/Peripheral Clock
Slave Mode operates on SPCK, asynchronously with Core and Bus Clock
Four Chip Selects with External Decoder Support Allow Communication with Up to 15 Peripherals
Communication with Serial External Devices Supported
Serial Memories, such as DataFlash and 3-wire EEPROMs
Serial Peripherals, such as ADCs, DACs, LCD Controllers, CAN Controllers and Sensors
External Coprocessors
Connection to PDC Channel Capabilities Optimizing Data Transfers
One Channel for the Receiver
One Channel for the Transmitter
Register Write Protection