Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Serial interfaces<br />
<strong>STM32W108C8</strong><br />
Table 41.<br />
SPI master GPIO usage<br />
Parameter MOSI MISO SCLK<br />
Direction Output Input Output<br />
GPIO<br />
configuration<br />
Alternate Output<br />
(push-pull)<br />
Input<br />
Alternate Output (push-pull)<br />
Special SCLK mode<br />
SC1 pin PB1 PB2 PB3<br />
SC2 pin PA0 PA1 PA2<br />
9.3.1 Setup and configuration<br />
Both serial controllers, SC1 and SC2, support SPI master mode. SPI master mode is<br />
enabled by the following register settings:<br />
● The serial controller mode register (SCx_MODE) is ‘2’.<br />
● The SC_SPIMST bit in the SPI configuration register (SCx_SPICFG) is ‘1’.<br />
● The SC_TWIACK bit in the I 2 C control register (SCx_TWICTRL2) is ‘1’.<br />
The SPI serial clock (SCLK) is produced by a programmable clock generator. The serial<br />
clock is produced by dividing down 12 MHz according to this equation:<br />
Rate<br />
=<br />
12MHz<br />
----------------------------------------<br />
( LIN + 1)x2 EXP<br />
Table 42.<br />
EXP is the value written to the SCx_RATEEXP register and LIN is the value written to the<br />
SCx_RATELIN register. The SPI master mode clock may not exceed 6 Mbps, so EXP and<br />
LIN cannot both be zero.<br />
The SPI master controller supports various frame formats depending upon the clock polarity<br />
(SC_SPIPOL), clock phase (SC_SPIPHA), and direction of data (SC_SPIORD) (see SPI<br />
master mode formats on page 75). The bits SC_SPIPOL, SC_SPIPHA, and SC_SPIORD<br />
are defined within the SCx_SPICFG register.<br />
SPI master mode formats<br />
SCx_SPICFG<br />
SC_SPIxxx (1)<br />
Frame formats<br />
MST ORD PHA POL<br />
1 0 0 0<br />
SCLK out<br />
MOSI out<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 />
MISO 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 />
1 0 0 1<br />
SCLK out<br />
MOSI out<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 />
MISO 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 />
75/215 Doc ID 018587 Rev 2