Serial peripheral interface (SPI)
signals are input from the external master connected to the I
need, for the user, to configure the clock.
The configuration steps to follow are listed below:
1.
Set the I2SMOD bit in the SPI_I2SCFGR register to reach the I
choose the I
DATLEN[1:0] bits and the number of bits per channel for the frame configuring the
CHLEN bit. Select also the mode (transmission or reception) for the slave through the
I2SCFG[1:0] bits in SPI_I2SCFGR register.
2.
If needed, select all the potential interrupt sources and the DMA capabilities by writing
the SPI_CR2 register.
3.
The I2SE bit in SPI_I2SCFGR register must be set.
Transmission sequence
The transmission sequence begins when the external master device sends the clock and
when the NSS_WS signal requests the transfer of data. The slave has to be enabled before
the external master starts the communication. The I
the master initiates the communication.
2
For the I
data register corresponds to the data for the left channel. When the communication starts,
the data are transferred from the Tx buffer to the shift register. The TXE flag is then set in
order to request the right channel data to be written into the I
The CHSIDE flag indicates which channel is to be transmitted. Compared to the master
transmission mode, in slave mode, CHSIDE is sensitive to the WS signal coming from the
external master. This means that the slave needs to be ready to transmit the first data
before the clock is generated by the master. WS assertion corresponds to left channel
transmitted first.
Note:
The I2SE has to be written at least two PCLK cycles before the first clock of the master
comes on the CK line.
The data half-word is parallel-loaded into the 16-bit shift register (from the internal bus)
during the first bit transmission, and then shifted out serially to the MOSI/SD pin MSB first.
The TXE flag is set after each transfer from the Tx buffer to the shift register and an interrupt
is generated if the TXEIE bit in the SPI_CR2 register is set.
Note that the TXE flag should be checked to be at 1 before attempting to write the Tx buffer.
For more details about the write operations depending on the I
refer to
Section 25.4.2: Supported audio
To secure a continuous audio data transmission, it is mandatory to write the SPI_DR
register with the next data to transmit before the end of the current transmission. An
underrun flag is set and an interrupt may be generated if the data are not written into the
SPI_DR register before the first clock edge of the next data communication. This indicates
to the software that the transferred data are wrong. If the ERRIE bit is set into the SPI_CR2
register, an interrupt is generated when the UDR flag in the SPI_SR register goes high. In
this case, it is mandatory to switch off the I
left channel.
To switch off the I
0.
729/1128
2
S standard through the I2SSTD[1:0] bits, the data length through the
S, MSB justified and LSB justified modes, the first data item to be written into the
2
S, by clearing the I2SE bit, it is mandatory to wait for TXE = 1 and BSY =
DocID13902 Rev 15
2
S interface. There is then no
2
S data register has to be loaded before
2
S data register.
protocols.
2
S and to restart a data transfer starting from the
RM0008
2
S functionalities and
2
S standard mode selected,
Need help?
Do you have a question about the STM32F101 series and is the answer not in the manual?
Questions and answers