CARME-M4 BSP  V1.5
Initialization and Configuration functions

Initialization and Configuration functions. More...

+ Collaboration diagram for Initialization and Configuration functions:

Functions

void SPI_I2S_DeInit (SPI_TypeDef *SPIx)
 De-initialize the SPIx peripheral registers to their default reset values. More...
 
void SPI_Init (SPI_TypeDef *SPIx, SPI_InitTypeDef *SPI_InitStruct)
 Initializes the SPIx peripheral according to the specified parameters in the SPI_InitStruct. More...
 
void I2S_Init (SPI_TypeDef *SPIx, I2S_InitTypeDef *I2S_InitStruct)
 Initializes the SPIx peripheral according to the specified parameters in the I2S_InitStruct. More...
 
void SPI_StructInit (SPI_InitTypeDef *SPI_InitStruct)
 Fills each SPI_InitStruct member with its default value. More...
 
void I2S_StructInit (I2S_InitTypeDef *I2S_InitStruct)
 Fills each I2S_InitStruct member with its default value. More...
 
void SPI_Cmd (SPI_TypeDef *SPIx, FunctionalState NewState)
 Enables or disables the specified SPI peripheral. More...
 
void I2S_Cmd (SPI_TypeDef *SPIx, FunctionalState NewState)
 Enables or disables the specified SPI peripheral (in I2S mode). More...
 
void SPI_DataSizeConfig (SPI_TypeDef *SPIx, uint16_t SPI_DataSize)
 Configures the data size for the selected SPI. More...
 
void SPI_BiDirectionalLineConfig (SPI_TypeDef *SPIx, uint16_t SPI_Direction)
 Selects the data transfer direction in bidirectional mode for the specified SPI. More...
 
void SPI_NSSInternalSoftwareConfig (SPI_TypeDef *SPIx, uint16_t SPI_NSSInternalSoft)
 Configures internally by software the NSS pin for the selected SPI. More...
 
void SPI_SSOutputCmd (SPI_TypeDef *SPIx, FunctionalState NewState)
 Enables or disables the SS output for the selected SPI. More...
 
void SPI_TIModeCmd (SPI_TypeDef *SPIx, FunctionalState NewState)
 Enables or disables the SPIx/I2Sx DMA interface. More...
 
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. More...
 

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 (RM0090)).

Function Documentation

void I2S_Cmd ( SPI_TypeDef *  SPIx,
FunctionalState  NewState 
)

Enables or disables the specified SPI peripheral (in I2S mode).

Parameters
SPIxwhere x can be 2 or 3 to select the SPI peripheral (or I2Sxext for full duplex mode).
NewStatenew state of the SPIx peripheral. This parameter can be: ENABLE or DISABLE.
Return values
None

Definition at line 562 of file stm32f4xx_spi.c.

+ Here is the caller graph for this function:

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
I2Sxextwhere x can be 2 or 3 to select the I2S peripheral extension block.
I2S_InitStructpointer 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 indepedently of the master configuration.
The I2S full duplex extension can be configured in slave mode only.
Return values
None

Definition at line 727 of file stm32f4xx_spi.c.

+ Here is the caller graph for this function:

void I2S_Init ( SPI_TypeDef *  SPIx,
I2S_InitTypeDef I2S_InitStruct 
)

Initializes the SPIx peripheral according to the specified parameters in the I2S_InitStruct.

Parameters
SPIxwhere x can be 2 or 3 to select the SPI peripheral (configured in I2S mode).
I2S_InitStructpointer 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.
if an external clock is used as source clock for the I2S, then the define I2S_EXTERNAL_CLOCK_VAL in file stm32f4xx_conf.h should be enabled and set to the value of the the source clock frequency (in Hz).
Return values
None

Definition at line 348 of file stm32f4xx_spi.c.

+ Here is the caller graph for this function:

void I2S_StructInit ( I2S_InitTypeDef I2S_InitStruct)

Fills each I2S_InitStruct member with its default value.

Parameters
I2S_InitStructpointer to a I2S_InitTypeDef structure which will be initialized.
Return values
None

Definition at line 508 of file stm32f4xx_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
SPIxwhere x can be 1, 2, 3, 4, 5 or 6 to select the SPI peripheral.
SPI_Directionspecifies 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 609 of file stm32f4xx_spi.c.

void SPI_Cmd ( SPI_TypeDef *  SPIx,
FunctionalState  NewState 
)

Enables or disables the specified SPI peripheral.

Parameters
SPIxwhere x can be 1, 2, 3, 4, 5 or 6 to select the SPI peripheral.
NewStatenew state of the SPIx peripheral. This parameter can be: ENABLE or DISABLE.
Return values
None

Definition at line 537 of file stm32f4xx_spi.c.

+ Here is the caller graph for this function:

void SPI_DataSizeConfig ( SPI_TypeDef *  SPIx,
uint16_t  SPI_DataSize 
)

Configures the data size for the selected SPI.

Parameters
SPIxwhere x can be 1, 2, 3, 4, 5 or 6 to select the SPI peripheral.
SPI_DataSizespecifies the SPI data size. This parameter can be one of the following values:
  • SPI_DataSize_16b: Set data frame format to 16bit
  • SPI_DataSize_8b: Set data frame format to 8bit
Return values
None

Definition at line 589 of file stm32f4xx_spi.c.

void SPI_I2S_DeInit ( SPI_TypeDef *  SPIx)

De-initialize the SPIx peripheral registers to their default reset values.

Parameters
SPIxTo select the SPIx/I2Sx peripheral, where x can be: 1, 2, 3, 4, 5 or 6 in SPI mode or 2 or 3 in I2S mode.
Note
The extended I2S blocks (ie. I2S2ext and I2S3ext blocks) are de-initialized when the relative I2S peripheral is de-initialized (the extended block's clock is managed by the I2S peripheral clock).
Return values
None

Definition at line 224 of file stm32f4xx_spi.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void SPI_Init ( SPI_TypeDef *  SPIx,
SPI_InitTypeDef SPI_InitStruct 
)

Initializes the SPIx peripheral according to the specified parameters in the SPI_InitStruct.

Parameters
SPIxwhere x can be 1, 2, 3, 4, 5 or 6 to select the SPI peripheral.
SPI_InitStructpointer to a SPI_InitTypeDef structure that contains the configuration information for the specified SPI peripheral.
Return values
None

Definition at line 284 of file stm32f4xx_spi.c.

+ Here is the caller graph for this function:

void SPI_NSSInternalSoftwareConfig ( SPI_TypeDef *  SPIx,
uint16_t  SPI_NSSInternalSoft 
)

Configures internally by software the NSS pin for the selected SPI.

Parameters
SPIxwhere x can be 1, 2, 3, 4, 5 or 6 to select the SPI peripheral.
SPI_NSSInternalSoftspecifies 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 635 of file stm32f4xx_spi.c.

void SPI_SSOutputCmd ( SPI_TypeDef *  SPIx,
FunctionalState  NewState 
)

Enables or disables the SS output for the selected SPI.

Parameters
SPIxwhere x can be 1, 2, 3, 4, 5 or 6 to select the SPI peripheral.
NewStatenew state of the SPIx SS output. This parameter can be: ENABLE or DISABLE.
Return values
None

Definition at line 659 of file stm32f4xx_spi.c.

void SPI_StructInit ( SPI_InitTypeDef SPI_InitStruct)

Fills each SPI_InitStruct member with its default value.

Parameters
SPI_InitStructpointer to a SPI_InitTypeDef structure which will be initialized.
Return values
None

Definition at line 480 of file stm32f4xx_spi.c.

+ Here is the caller graph for this function:

void SPI_TIModeCmd ( SPI_TypeDef *  SPIx,
FunctionalState  NewState 
)

Enables or disables the SPIx/I2Sx DMA interface.

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
SPIxwhere x can be 1, 2, 3, 4, 5 or 6
NewStatenew state of the selected SPI TI communication mode. This parameter can be: ENABLE or DISABLE.
Return values
None

Definition at line 690 of file stm32f4xx_spi.c.