09.12.2012 Views

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>RM0090</strong> Serial peripheral interface (SPI)<br />

Figure 272. Data clock timing diagram<br />

CPOL = 1<br />

CPOL = 0<br />

MISO<br />

MOSI<br />

NSS<br />

(to slave)<br />

Capture strobe<br />

CPOL = 1<br />

CPOL = 0<br />

MISO<br />

MOSI<br />

NSS<br />

(to slave)<br />

Capture strobe<br />

1. These timings are shown with the LSBFIRST bit reset in the SPI_CR1 register.<br />

Data frame format<br />

Data can be shifted out either MSB-first or LSB-first depending on the value of the<br />

LSBFIRST bit in the SPI_CR1 Register.<br />

Each data frame is 8 or 16 bits long depending on the size of the data programmed using<br />

the DFF bit in the SPI_CR1 register. The selected data frame format is applicable for<br />

transmission and/or reception.<br />

27.3.2 Configuring the SPI in slave mode<br />

MSBit<br />

LSBit<br />

8 or 16 bits depending on the Data frame format bit (see DFF in SPI_CR1)<br />

MSBit<br />

MSBit<br />

CPHA =1<br />

CPHA =0<br />

In the slave configuration, the serial clock is received on the SCK pin from the master<br />

device. The value set in the BR[2:0] bits in the SPI_CR1 register, does not affect the data<br />

transfer rate.<br />

Note: It is recommended to enable the SPI slave before the master sends the clock. If not,<br />

undesired data transmission might occur. The data register of the slave needs to be ready<br />

before the first edge of the communication clock or before the end of the ongoing<br />

communication. It is mandatory to have the polarity of the communication clock set to the<br />

steady state value before the slave and the master are enabled.<br />

Follow the procedure below to configure the SPI in slave mode:<br />

LSBit<br />

LSBit<br />

8 or 16 bits depending on the Data frame format bit (see DFF in SPI_CR1)<br />

MSBit LSBit<br />

ai17154b<br />

Doc ID 018909 Rev 3 796/1416

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!