4.6.5 Connecting to the SPI Interface

Four different FLEXCOM interfaces, with seven possible configurations (configured in SPI mode), and two pure SPI Interfaces, with four possible configurations, are available on the ATSAMA5D27-WLSOM1 module.

The Flexible Serial Communication Controller (FLEXCOM) offers several serial communication protocols that are managed by the three submodules USART, SPI, and TWI.

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 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.
Table 4-7. SPI Interface Configurations
Interface InstanceIO setPin #PIOPin NameComments
SPI0121PA14SPI0_SPCK
SPI0122PA15SPI0_MOSI
SPI0123PA16SPI0_MISO
SPI0124PA17SPI0_NPCS0
SPI0276PA30SPI0_NPCS0
SPI0275PA31SPI0_MISO
SPI0281PB00SPI0_MOSI
SPI0280PB01SPI0_SPCK
SPI0118PC01SPI1_SPCK
SPI1117PC02SPI1_MOSI
SPI1116PC03SPI1_MISO
SPI1119PC04SPI1_NPCS0
SPI1120PC05SPI1_NPCS1
SPI11176PC06SPI1_NPCS2
SPI11177PC07SPI1_NPCS3
SPI13132PD25SPI1_SPCK
SPI13127PD26SPI1_MOSI
SPI13123PD27SPI1_MISO
SPI13124PD28SPI1_NPCS0
SPI13131PD29SPI1_NPCS1
SPI13130PD30SPI1_NPCS2
Table 4-8. FLEXCOM Interfaces Configurations in SPI Mode
Interface InstanceIO setPin #PIOPin NameComments
FLEXCOM0128PB28FLEXCOM0_IO0MOSI Signal
FLEXCOM0127PB29FLEXCOM0_IO1MISO Signal
FLEXCOM0130PB30FLEXCOM0_IO2SPCK Signal
FLEXCOM0126PB31FLEXCOM0_IO3NPCS0 Signal
FLEXCOM0115PC00FLEXCOM0_IO4NPCS1 Signal
FLEXCOM21171PA06FLEXCOM2_IO0MOSI Signal
FLEXCOM21173PA07FLEXCOM2_IO1MISO Signal
FLEXCOM21167PA08FLEXCOM2_IO2SPCK Signal
FLEXCOM21172PA09FLEXCOM2_IO3NPCS0 Signal
FLEXCOM21168PA10FLEXCOM2_IO4NPCS1 Signal
FLEXCOM22127PD26FLEXCOM2_IO0MOSI Signal
FLEXCOM22123PD27FLEXCOM2_IO1MISO Signal
FLEXCOM22124PD28FLEXCOM2_IO2SPCK Signal
FLEXCOM22131PD29FLEXCOM2_IO3NPCS0 Signal
FLEXCOM22130PD30FLEXCOM2_IO4NPCS1 Signal
FLEXCOM3256PC18FLEXCOM3_IO2SPCK Signal
FLEXCOM3270PC19FLEXCOM3_IO1MISO Signal
FLEXCOM3258PC20FLEXCOM3_IO0MOSI Signal
FLEXCOM3263PC21FLEXCOM3_IO3NPCS0 Signal
FLEXCOM3265PC22FLEXCOM3_IO4NPCS1 Signal
FLEXCOM4139PC28FLEXCOM4_IO0MOSI Signal
FLEXCOM4138PC29FLEXCOM4_IO1MISO Signal
FLEXCOM4134PC30FLEXCOM4_IO2SPCK Signal
FLEXCOM4136PC31FLEXCOM4_IO3NPCS0 Signal
FLEXCOM4133PD00FLEXCOM4_IO4NPCS1 Signal
FLEXCOM42119PD12FLEXCOM4_IO0MOSI Signal
FLEXCOM42116PD13FLEXCOM4_IO1MISO Signal
FLEXCOM42117PD14FLEXCOM4_IO2SPCK Signal
FLEXCOM42114PD15FLEXCOM4_IO3NPCS0 Signal
FLEXCOM42115PD16FLEXCOM4_IO4NPCS1 Signal