You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Serial interfaces<br />
<strong>STM32W108C8</strong><br />
Table 44.<br />
SCx_SPICFG<br />
SPI slave mode formats (continued)<br />
SC_SPIxxx (1)<br />
Frame format<br />
MST ORD PHA POL<br />
nSSEL<br />
0 0 1 1<br />
SCLK in<br />
MOSI in<br />
RX[7]<br />
RX[6]<br />
RX[5]<br />
RX[4]<br />
RX[3]<br />
RX[2]<br />
RX[1]<br />
RX[0]<br />
MISOout<br />
TX[7]<br />
TX[6]<br />
TX[5]<br />
TX[4]<br />
TX[3]<br />
TX[2]<br />
TX[1]<br />
TX[0]<br />
0 1 - - Same as above except LSB first instead of MSB first.<br />
1. The notation xxx means that the corresponding column header below is inserted to form the field name.<br />
9.4.2 Operation<br />
When the slave select (nSSEL) signal is asserted by the master, SPI transmit data is driven<br />
to the output pin MISO, and SPI data is received from the input pin MOSI. The nSSEL pin<br />
has to be asserted to enable the transmit serializer to drive data to the output signal MISO.<br />
A falling edge on nSSEL resets the SPI slave shift registers.<br />
Characters transmitted and received by the SPI slave controller are buffered in the transmit<br />
and receive FIFOs that are both 4 entries deep. When software writes a character to the<br />
SCx_DATA register, it is pushed onto the transmit FIFO. Similarly, when software reads from<br />
the SCx_DATA register, the character returned is pulled from the receive FIFO. If the<br />
transmit and receive DMA channels are used, the DMA channels also write to and read from<br />
the transmit and receive FIFOs.<br />
Characters received are stored in the receive FIFO. Receiving characters sets the<br />
SC_SPIRXVAL bit in the SCx_SPISTAT register, to indicate that characters can be read<br />
from the receive FIFO. Characters received while the receive FIFO is full are dropped, and<br />
the SC_SPIRXOVF bit in the SCx_SPISTAT register is set. The receive FIFO hardware<br />
generates the INT_SCRXOVF interrupt, but the DMA register will not indicate the error<br />
condition until the receive FIFO is drained. Once the DMA marks a receive error, two<br />
conditions will clear the error indication: setting the appropriate SC_TX/RXDMARST bit in<br />
the SCx_DMACTRL register, or loading the appropriate DMA buffer after it has unloaded.<br />
Receiving a character causes the serial transmission of a character pulled from the transmit<br />
FIFO. When the transmit FIFO is empty, a transmit underrun is detected (no data in transmit<br />
FIFO) and the INT_SCTXUND bit in the INT_SCxFLAG register is set. Because no<br />
character is available for serialization, the SPI serializer retransmits the last transmitted<br />
character or a busy token (0xFF), determined by the SC_SPIRPT bit in the SCx_SPICFG<br />
register.<br />
When the transmit FIFO and the serializer are both empty, writing a character to the transmit<br />
FIFO clears the SC_SPITXIDLE bit in the SCx_SPISTAT register. This indicates that not all<br />
characters have been transmitted. If characters are written to the transmit FIFO until it is full,<br />
the SC_SPITXFREE bit in the SCx_SPISTAT register is cleared. Shifting out a transmit<br />
character to the MISO pin causes the SC_SPITXFREE bit in the SCx_SPISTAT register to<br />
get set. When the transmit FIFO empties and the last character has been shifted out, the<br />
SC_SPITXIDLE bit in the SCx_SPISTAT register is set.<br />
79/215 Doc ID 018587 Rev 2