Electronic Components Datasheet Search
  British  ▼
ALLDATASHEET.CO.UK

X  

STM8S Datasheet(PDF) 267 Page - STMicroelectronics

Part # STM8S
Description  STM8S Series and STM8AF Series 8-bit microcontrollers
PDF  467 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  STMICROELECTRONICS [STMicroelectronics]
Direct Link  http://www.st.com
Logo STMICROELECTRONICS - STMicroelectronics

STM8S Datasheet(HTML) 267 Page - STMicroelectronics

Back Button STM8S Datasheet HTML 263Page - STMicroelectronics STM8S Datasheet HTML 264Page - STMicroelectronics STM8S Datasheet HTML 265Page - STMicroelectronics STM8S Datasheet HTML 266Page - STMicroelectronics STM8S Datasheet HTML 267Page - STMicroelectronics STM8S Datasheet HTML 268Page - STMicroelectronics STM8S Datasheet HTML 269Page - STMicroelectronics STM8S Datasheet HTML 270Page - STMicroelectronics STM8S Datasheet HTML 271Page - STMicroelectronics Next Button
Zoom Inzoom in Zoom Outzoom out
 267 / 467 page
background image
DocID14587 Rev 14
267/467
RM0016
Serial peripheral interface (SPI)
287
20.3.2
Configuring the SPI in slave mode
In slave configuration, the serial clock is received on the SCK pin from the master device.
The value set in the BR[2:0] bits in the SPI_CR1 register, does not affect the data transfer
rate.
Follow the procedure below to configure the SPI in slave mode:
1.
Select the CPOL and CPHA bits to define one of the four relationships between the
data transfer and the serial clock (see Figure 93). For correct data transfer, the CPOL
and CPHA bits must be configured in the same way in the slave device and the master
device.
2.
The frame format (MSB-first or LSB-first depending on the value of the LSBFIRST bit in
the SPI_CR1 register) must be the same as the master device.
3.
In Hardware mode (refer to Slave select (NSS) pin management on page 264), the
NSS pin must be connected to a low level signal during the complete data transmit
sequence. In NSS Software mode, set the SSM bit and clear the SSI bit in the
SPI_CR2 register.
4.
Clear the MSTR bit and set the SPE bit to assign the pins to alternate functions.
In this configuration the MOSI pin is a data input and the MISO pin is a data output.
Note:
In applications with a parallel multi-slave structure, with separate NSS signals and the slave
MISO outputs connected together, the corresponding GPIO registers must be configured
correctly. The SPI_MISO pin is controlled by the SPI peripheral only when the NSS signal is
active and the device is selected as slave. When the NSS signal is released, the pin is
driven by GPIO register settings only. To function correctly, the GPIO has to be configured in
input pull-up mode with no interrupt. This configuration is done using the GPIO_DDR,
GPIO_CR1 and GPIO_CR2 registers - see Section 11.8.1: Alternate function output.
20.3.3
Configuring the SPI master mode
In a master configuration, the serial clock is generated on the SCK pin.
Follow the procedure below to configure the SPI in master mode:
1.
Select the BR[2:0] bits to define the serial clock baud rate (see SPI_CR1 register).
2.
Select the CPOL and CPHA bits to define one of the four relationships between the
data transfer and the serial clock (see Figure 93).
3.
Configure the LSBFIRST bit in the SPI_CR1 register to define the frame format.
4.
In Hardware mode, connect the NSS pin to a high-level signal during the complete data
transmit sequence. In software mode, set the SSM and SSI bits in the SPI_CR2
register.
5.
Set the MSTR and SPE bits (they remain set only if the NSS pin is connected to a high-
level signal).
In this configuration the MOSI pin is a data output and to the MISO pin is a data input.



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100  ...More


Datasheet Download

Go To PDF Page


Link URL



Does ALLDATASHEET help your business so far?  [ DONATE ] 

About Alldatasheet   |   Advertisement   |   Contact us   |   Privacy Policy   |   Link to Datasheet    |   Link Exchange   |   Manufacturer List
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
Russian : Alldatasheetru.com  |   Korean : Alldatasheet.co.kr  |   Spanish : Alldatasheet.es  |   French : Alldatasheet.fr  |   Italian : Alldatasheetit.com
Portuguese : Alldatasheetpt.com  |   Polish : Alldatasheet.pl  |   Vietnamese : Alldatasheet.vn
Indian : Alldatasheet.in  |   Mexican : Alldatasheet.com.mx  |   British : Alldatasheet.co.uk  |   New Zealand : Alldatasheet.co.nz
Family Site : ic2ic.com  |   icmetro.com