Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Space_Invaders_Demo neopixels gpio_test_stm32f3_discovery gpio_test_systimer ... more
Initialization and Configuration functions
[SPI_Private_Functions]
Initialization and Configuration functions. More...
Functions | |
void | SPI_I2S_DeInit (SPI_TypeDef *SPIx) |
Deinitializes the SPIx peripheral registers to their default reset values. | |
void | SPI_StructInit (SPI_InitTypeDef *SPI_InitStruct) |
Fills each SPI_InitStruct member with its default value. | |
void | SPI_Init (SPI_TypeDef *SPIx, SPI_InitTypeDef *SPI_InitStruct) |
Initializes the SPIx peripheral according to the specified parameters in the SPI_InitStruct. | |
void | I2S_StructInit (I2S_InitTypeDef *I2S_InitStruct) |
Fills each I2S_InitStruct member with its default value. | |
void | I2S_Init (SPI_TypeDef *SPIx, I2S_InitTypeDef *I2S_InitStruct) |
Initializes the SPIx peripheral according to the specified parameters in the I2S_InitStruct. | |
void | SPI_Cmd (SPI_TypeDef *SPIx, FunctionalState NewState) |
Enables or disables the specified SPI peripheral. | |
void | SPI_TIModeCmd (SPI_TypeDef *SPIx, FunctionalState NewState) |
Enables or disables the TI Mode. | |
void | I2S_Cmd (SPI_TypeDef *SPIx, FunctionalState NewState) |
Enables or disables the specified SPI peripheral (in I2S mode). | |
void | SPI_DataSizeConfig (SPI_TypeDef *SPIx, uint16_t SPI_DataSize) |
Configures the data size for the selected SPI. | |
void | SPI_RxFIFOThresholdConfig (SPI_TypeDef *SPIx, uint16_t SPI_RxFIFOThreshold) |
Configures the FIFO reception threshold for the selected SPI. | |
void | SPI_BiDirectionalLineConfig (SPI_TypeDef *SPIx, uint16_t SPI_Direction) |
Selects the data transfer direction in bidirectional mode for the specified SPI. | |
void | SPI_NSSInternalSoftwareConfig (SPI_TypeDef *SPIx, uint16_t SPI_NSSInternalSoft) |
Configures internally by software the NSS pin for the selected SPI. | |
void | I2S_FullDuplexConfig (SPI_TypeDef *I2Sxext, I2S_InitTypeDef *I2S_InitStruct) |
Configures the full duplex mode for the I2Sx peripheral using its extension I2Sxext according to the specified parameters in the I2S_InitStruct. | |
void | SPI_SSOutputCmd (SPI_TypeDef *SPIx, FunctionalState NewState) |
Enables or disables the SS output for the selected SPI. | |
void | SPI_NSSPulseModeCmd (SPI_TypeDef *SPIx, FunctionalState NewState) |
Enables or disables the NSS pulse management mode. |
Detailed Description
Initialization and Configuration functions.
=============================================================================== ##### Initialization and Configuration functions ##### =============================================================================== [..] This section provides a set of functions allowing to initialize the SPI Direction, SPI Mode, SPI Data Size, SPI Polarity, SPI Phase, SPI NSS Management, SPI Baud Rate Prescaler, SPI First Bit and SPI CRC Polynomial. [..] The SPI_Init() function follows the SPI configuration procedures for Master mode and Slave mode (details for these procedures are available in reference manual). [..] When the Software NSS management (SPI_InitStruct->SPI_NSS = SPI_NSS_Soft) is selected, use the following function to manage the NSS bit: void SPI_NSSInternalSoftwareConfig(SPI_TypeDef* SPIx, uint16_t SPI_NSSInternalSoft); [..] In Master mode, when the Hardware NSS management (SPI_InitStruct->SPI_NSS = SPI_NSS_Hard) is selected, use the following function to enable the NSS output feature. void SPI_SSOutputCmd(SPI_TypeDef* SPIx, FunctionalState NewState); [..] The NSS pulse mode can be managed by the SPI TI mode when enabling it using the following function: void SPI_TIModeCmd(SPI_TypeDef* SPIx, FunctionalState NewState); And it can be managed by software in the SPI Motorola mode using this function: void SPI_NSSPulseModeCmd(SPI_TypeDef* SPIx, FunctionalState NewState); [..] This section provides also functions to initialize the I2S Mode, Standard, Data Format, MCLK Output, Audio frequency and Polarity. [..] The I2S_Init() function follows the I2S configuration procedures for Master mode and Slave mode.
Function Documentation
void I2S_Cmd | ( | SPI_TypeDef * | SPIx, |
FunctionalState | NewState | ||
) |
Enables or disables the specified SPI peripheral (in I2S mode).
- Parameters:
-
SPIx:To select the SPIx peripheral, where x can be: 2 or 3 in I2S mode or I2Sxext for I2S full duplex mode. NewState,: new state of the SPIx peripheral. This parameter can be: ENABLE or DISABLE.
- Return values:
-
None
Definition at line 557 of file stm32f30x_spi.c.
void I2S_FullDuplexConfig | ( | SPI_TypeDef * | I2Sxext, |
I2S_InitTypeDef * | I2S_InitStruct | ||
) |
Configures the full duplex mode for the I2Sx peripheral using its extension I2Sxext according to the specified parameters in the I2S_InitStruct.
- Parameters:
-
I2Sxext,: where x can be 2 or 3 to select the I2S peripheral extension block. I2S_InitStruct,: pointer to an I2S_InitTypeDef structure that contains the configuration information for the specified I2S peripheral extension.
- Note:
- The structure pointed by I2S_InitStruct parameter should be the same used for the master I2S peripheral. In this case, if the master is configured as transmitter, the slave will be receiver and vice versa. Or you can force a different mode by modifying the field I2S_Mode to the value I2S_SlaveRx or I2S_SlaveTx independently of the master configuration.
- The I2S full duplex extension can be configured in slave mode only.
- Return values:
-
None
Definition at line 708 of file stm32f30x_spi.c.
void I2S_Init | ( | SPI_TypeDef * | SPIx, |
I2S_InitTypeDef * | I2S_InitStruct | ||
) |
Initializes the SPIx peripheral according to the specified parameters in the I2S_InitStruct.
- Parameters:
-
SPIx:To select the SPIx peripheral, where x can be: 2 or 3 in I2S mode. I2S_InitStruct,: pointer to an I2S_InitTypeDef structure that contains the configuration information for the specified SPI peripheral configured in I2S mode.
- Note:
- The function calculates the optimal prescaler needed to obtain the most accurate audio frequency (depending on the I2S clock source, the PLL values and the product configuration). But in case the prescaler value is greater than 511, the default value (0x02) will be configured instead.
- Return values:
-
None
Definition at line 398 of file stm32f30x_spi.c.
void I2S_StructInit | ( | I2S_InitTypeDef * | I2S_InitStruct ) |
Fills each I2S_InitStruct member with its default value.
- Parameters:
-
I2S_InitStruct : pointer to a I2S_InitTypeDef structure which will be initialized.
- Return values:
-
None
Definition at line 361 of file stm32f30x_spi.c.
void SPI_BiDirectionalLineConfig | ( | SPI_TypeDef * | SPIx, |
uint16_t | SPI_Direction | ||
) |
Selects the data transfer direction in bidirectional mode for the specified SPI.
- Parameters:
-
SPIx,: where x can be 1, 2, 3 or 4 to select the SPI peripheral. SPI_Direction,: specifies the data transfer direction in bidirectional mode. This parameter can be one of the following values: - SPI_Direction_Tx: Selects Tx transmission direction
- SPI_Direction_Rx: Selects Rx receive direction
- Return values:
-
None
Definition at line 643 of file stm32f30x_spi.c.
void SPI_Cmd | ( | SPI_TypeDef * | SPIx, |
FunctionalState | NewState | ||
) |
Enables or disables the specified SPI peripheral.
- Parameters:
-
SPIx,: where x can be 1, 2, 3 or 4 to select the SPI peripheral. NewState,: new state of the SPIx peripheral. This parameter can be: ENABLE or DISABLE.
- Return values:
-
None
Definition at line 501 of file stm32f30x_spi.c.
void SPI_DataSizeConfig | ( | SPI_TypeDef * | SPIx, |
uint16_t | SPI_DataSize | ||
) |
Configures the data size for the selected SPI.
- Parameters:
-
SPIx,: where x can be 1, 2, 3 or 4 to select the SPI peripheral. SPI_DataSize,: specifies the SPI data size. For the SPIx peripheral this parameter can be one of the following values: - SPI_DataSize_4b: Set data size to 4 bits
- SPI_DataSize_5b: Set data size to 5 bits
- SPI_DataSize_6b: Set data size to 6 bits
- SPI_DataSize_7b: Set data size to 7 bits
- SPI_DataSize_8b: Set data size to 8 bits
- SPI_DataSize_9b: Set data size to 9 bits
- SPI_DataSize_10b: Set data size to 10 bits
- SPI_DataSize_11b: Set data size to 11 bits
- SPI_DataSize_12b: Set data size to 12 bits
- SPI_DataSize_13b: Set data size to 13 bits
- SPI_DataSize_14b: Set data size to 14 bits
- SPI_DataSize_15b: Set data size to 15 bits
- SPI_DataSize_16b: Set data size to 16 bits
- Return values:
-
None
Definition at line 594 of file stm32f30x_spi.c.
void SPI_I2S_DeInit | ( | SPI_TypeDef * | SPIx ) |
Deinitializes the SPIx peripheral registers to their default reset values.
- Parameters:
-
SPIx,: To select the SPIx peripheral, where x can be: 1, 2 or 3 in SPI mode.
- Return values:
-
None
Definition at line 190 of file stm32f30x_spi.c.
void SPI_Init | ( | SPI_TypeDef * | SPIx, |
SPI_InitTypeDef * | SPI_InitStruct | ||
) |
Initializes the SPIx peripheral according to the specified parameters in the SPI_InitStruct.
- Parameters:
-
SPIx,: where x can be 1, 2, 3 or 4 to select the SPI peripheral. SPI_InitStruct,: pointer to a SPI_InitTypeDef structure that contains the configuration information for the specified SPI peripheral.
- Return values:
-
None
Definition at line 264 of file stm32f30x_spi.c.
void SPI_NSSInternalSoftwareConfig | ( | SPI_TypeDef * | SPIx, |
uint16_t | SPI_NSSInternalSoft | ||
) |
Configures internally by software the NSS pin for the selected SPI.
- Note:
- This function can be called only after the SPI_Init() function has been called.
- Parameters:
-
SPIx,: where x can be 1, 2, 3 or 4 to select the SPI peripheral. SPI_NSSInternalSoft,: specifies the SPI NSS internal state. This parameter can be one of the following values: - SPI_NSSInternalSoft_Set: Set NSS pin internally
- SPI_NSSInternalSoft_Reset: Reset NSS pin internally
- Return values:
-
None
Definition at line 671 of file stm32f30x_spi.c.
void SPI_NSSPulseModeCmd | ( | SPI_TypeDef * | SPIx, |
FunctionalState | NewState | ||
) |
Enables or disables the NSS pulse management mode.
- Note:
- This function can be called only after the SPI_Init() function has been called.
- When TI mode is selected, the control bits NSSP is not taken into consideration and are configured by hardware respectively to the TI mode requirements.
- Parameters:
-
SPIx,: where x can be 1, 2, 3 or 4 to select the SPI peripheral. NewState,: new state of the NSS pulse management mode. This parameter can be: ENABLE or DISABLE.
- Return values:
-
None
Definition at line 788 of file stm32f30x_spi.c.
void SPI_RxFIFOThresholdConfig | ( | SPI_TypeDef * | SPIx, |
uint16_t | SPI_RxFIFOThreshold | ||
) |
Configures the FIFO reception threshold for the selected SPI.
- Parameters:
-
SPIx,: where x can be 1, 2, 3 or 4 to select the SPI peripheral. SPI_RxFIFOThreshold,: specifies the FIFO reception threshold. This parameter can be one of the following values: - SPI_RxFIFOThreshold_HF: RXNE event is generated if the FIFO level is greater or equal to 1/2.
- SPI_RxFIFOThreshold_QF: RXNE event is generated if the FIFO level is greater or equal to 1/4.
- Return values:
-
None
Definition at line 621 of file stm32f30x_spi.c.
void SPI_SSOutputCmd | ( | SPI_TypeDef * | SPIx, |
FunctionalState | NewState | ||
) |
Enables or disables the SS output for the selected SPI.
- Note:
- This function can be called only after the SPI_Init() function has been called and the NSS hardware management mode is selected.
- Parameters:
-
SPIx,: where x can be 1, 2, 3 or 4 to select the SPI peripheral. NewState,: new state of the SPIx SS output. This parameter can be: ENABLE or DISABLE.
- Return values:
-
None
Definition at line 759 of file stm32f30x_spi.c.
void SPI_StructInit | ( | SPI_InitTypeDef * | SPI_InitStruct ) |
Fills each SPI_InitStruct member with its default value.
- Parameters:
-
SPI_InitStruct,: pointer to a SPI_InitTypeDef structure which will be initialized.
- Return values:
-
None
Definition at line 233 of file stm32f30x_spi.c.
void SPI_TIModeCmd | ( | SPI_TypeDef * | SPIx, |
FunctionalState | NewState | ||
) |
Enables or disables the TI Mode.
- Note:
- This function can be called only after the SPI_Init() function has been called.
- When TI mode is selected, the control bits SSM, SSI, CPOL and CPHA are not taken into consideration and are configured by hardware respectively to the TI mode requirements.
- Parameters:
-
SPIx,: where x can be 1, 2, 3 or 4 to select the SPI peripheral. NewState,: new state of the selected SPI TI communication mode. This parameter can be: ENABLE or DISABLE.
- Return values:
-
None
Definition at line 531 of file stm32f30x_spi.c.
Generated on Tue Jul 12 2022 17:34:46 by
