DocID025202 Rev 7
926/1080
RM0365
Serial peripheral interface / inter-IC sound (SPI/I2S)
959
baud rate value set in through the BR[2:0] bits in the SPIx_CR1 register. It is given by the
formula:
If the slave detects a misplaced NSS pulse during a data frame transaction the TIFRE flag is
set.
If the data size is equal to 4-bits or 5-bits, the master in full-duplex mode or transmit-only
mode uses a protocol with one more dummy data bit added after LSB. TI NSS pulse is
generated above this dummy bit clock cycle instead of the LSB in each period.
This feature is not available for Motorola SPI communications (FRF bit set to 0).
shows the SPI communication waveforms when TI mode is
selected.
Figure 355. TI mode transfer
30.5.14 CRC
calculation
Two separate CRC calculators are implemented in order to check the reliability of
transmitted and received data. The SPI offers CRC8 or CRC16 calculation independently of
the frame data length, which can be fixed to 8-bit or 16-bit. For all the other data frame
lengths, no CRC is available.
CRC principle
CRC calculation is enabled by setting the CRCEN bit in the SPIx_CR1 register before the
SPI is enabled (SPE = 1). The CRC value is calculated using an odd programmable
polynomial on each bit. The calculation is processed on the sampling clock edge defined by
the CPHA and CPOL bits in the SPIx_CR1 register. The calculated CRC value is checked
automatically at the end of the data block as well as for transfer managed by CPU or by the
DMA. When a mismatch is detected between the CRC calculated internally on the received
data and the CRC sent by the transmitter, a CRCERR flag is set to indicate a data corruption
error. The right procedure for handling the CRC calculation depends on the SPI
configuration and the chosen transfer management.
t
baud_rate
2
----------------------
4
t
pclk
×
+
t
release
t
baud_rate
2
----------------------
6
t
pclk
×
+
<
<
069
06%
0,62
166
6&.
WULJJHU VDPSOLQJWULJJHU VDPSOLQJWULJJHUVDPSOLQJ
'RQRWFDUH
/6%
026,
RU
06%
/6%
06%
/6%
06%
/6%
)5$0(
)5$0(
W
5(/($6(