8.1.3 Interfacing in SPI Mode

Four FLEXCOM interfaces configured in SPI mode are available on the SAM9X60D1G-I/LZB.

FLEXCOM offers several serial communication protocols that are managed by the USART, SPI and TWI submodules.

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 SPI devices. 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 in and out by the host. Different CPUs can take turns being hosts (multiple host protocol, as opposed to single host protocol, where one CPU is always the host while all 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. When multiple client devices are available, the host generates a separate client select signal (NPCS) for each.

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 transmitted.
  • Client Select (NSS)—This control line allows clients to be turned on and off by hardware.
Table 8-3. FLEXCOM Interface Configurations in SPI Mode
Interface Instance IO Set Pin No. PIO Pin Name Description
FLEXCOM1 1 73 PA5 FLEXCOM1_IO0 MOSI Signal
74 PA6 FLEXCOM1_IO1 MISO Signal
129 PC29 FLEXCOM1_IO2 SPCK Signal
128 PC28 FLEXCOM1_IO3 NPCS0 Signal
FLEXCOM3 1 120 PC22 FLEXCOM3_IO0 MOSI Signal
121 PC23 FLEXCOM3_IO1 MISO Signal
126 PC26 FLEXCOM3_IO2 SPCK Signal
125 PC25 FLEXCOM3_IO3 NPCS0 Signal
FLEXCOM4 1 145 PA12 FLEXCOM4_IO0 MOSI Signal
144 PA11 FLEXCOM4_IO1 MISO Signal
146 PA13 FLEXCOM4_IO2 SPCK Signal
147 PA14 FLEXCOM4_IO3 NPCS0 Signal
FLEXCOM4 2 145 PA12 FLEXCOM4_IO0 MOSI Signal
144 PA11 FLEXCOM4_IO1 MISO Signal
146 PA13 FLEXCOM4_IO2 SPCK Signal
147 PA14 FLEXCOM4_IO3 NPCS0 Signal
FLEXCOM5 1 35 PA22 FLEXCOM5_IO0 MOSI Signal
36 PA21 FLEXCOM5_IO1 MISO Signal
34 PA23 FLEXCOM5_IO2 SPCK Signal
33 PA8 FLEXCOM5_IO3 NPCS0 Signal
80 PA31 FLEXCOM5_IO5 NPCS2 Signal
79 PA30 FLEXCOM5_IO6 NPCS3 Signal
FLEXCOM5 2 35 PA22 FLEXCOM5_IO0 MOSI Signal
36 PA21 FLEXCOM5_IO1 MISO Signal
34 PA23 FLEXCOM5_IO2 SPCK Signal
33 PA8 FLEXCOM5_IO3 NPCS0 Signal
32 PA7 FLEXCOM5_IO4 NPCS1 Signal
80 PA31 FLEXCOM5_IO5 NPCS2 Signal
79 PA30 FLEXCOM5_IO6 NPCS3 Signal