Serial peripheral interface / inter-IC sound (SPI/I2S)
RM0365
905/1080
DocID025202 Rev 7
Four I/O pins are dedicated to SPI communication with external devices.
•
MISO:
Master In / Slave Out data. In the general case, this pin is used to transmit data
in slave mode and receive data in master mode.
•
MOSI:
Master Out / Slave In data. In the general case, this pin is used to transmit data
in master mode and receive data in slave mode.
•
SCK:
Serial Clock output pin for SPI masters and input pin for SPI slaves.
•
NSS:
Slave select pin. Depending on the SPI and NSS settings, this pin can be used to
either:
–
select an individual slave device for communication
–
synchronize the data frame or
–
detect a conflict between multiple masters
See
Section 30.5.5: Slave select (NSS) pin management
for details.
The SPI bus allows the communication between one master device and one or more slave
devices. The bus consists of at least two wires - one for the clock signal and the other for
synchronous data transfer. Other signals can be added depending on the data exchange
between SPI nodes and their slave select signal management.
30.5.2 Communications
between one master and one slave
The SPI allows the MCU to communicate using different configurations, depending on the
device targeted and the application requirements. These configurations use 2 or 3 wires
(with software NSS management) or 3 or 4 wires (with hardware NSS management).
Communication is always initiated by the master.
Full-duplex communication
By default, the SPI is configured for full-duplex communication. In this configuration, the
shift registers of the master and slave are linked using two unidirectional lines between the
MOSI and the MISO pins. During SPI communication, data is shifted synchronously on the
SCK clock edges provided by the master. The master transmits the data to be sent to the
slave via the MOSI line and receives data from the slave via the MISO line. When the data
frame transfer is complete (all the bits are shifted) the information between the master and
slave is exchanged.
Figure 341. Full-duplex single master/ single slave application
1. The NSS pins can be used to provide a hardware control flow between master and slave. Optionally, the
pins can be left unused by the peripheral. Then the flow has to be handled internally for both master and
slave. For more details see
Section 30.5.5: Slave select (NSS) pin management
.
5[VKLIWUHJLVWHU
7[VKLIWUHJLVWHU
5[VKLIWUHJLVWHU
7[VKLIWUHJLVWHU
63,FORFN
JHQHUDWRU
0DVWHU
6ODYH
0,62
026,
6&.
166
0,62
026,
6&.
166
06Y9