| поискавой системы для электроныых деталей |
|
RM0312 датащи(PDF) 206 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
RM0312 датащи(HTML) 206 Page - STMicroelectronics |
|
206 / 275 page ![]() Serial peripheral interface (SPI) RM0312 206/275 DocID022352 Rev 3 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 74). 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 203), 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 10.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 74). 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. |
|
ссылки URL |
| Вашему бизинису помогли Аллдатащит? [ DONATE ] |
Что такое Аллдатащит | реклама | контакт | Конфиденциальность | Ссылка на техническое описание | обмен ссыками | поиск по производителю All Rights Reserved©Alldatasheet.com |
| 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 |