STM32F4xx HAL Documentation
Hardware Abstraction Layer for STM32F4 familiy
Loading...
Searching...
No Matches
Extended Peripheral Control functions

Extended Peripheral Control functions. More...

Collaboration diagram for Extended Peripheral Control functions:

Topics

 Extended Clock management functions
 Extended Clock management functions.
 

Functions

HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig (RCC_PeriphCLKInitTypeDef *PeriphClkInit)
 Initializes the RCC extended peripherals clocks according to the specified parameters in the RCC_PeriphCLKInitTypeDef.
 
void HAL_RCCEx_GetPeriphCLKConfig (RCC_PeriphCLKInitTypeDef *PeriphClkInit)
 Get the RCC_PeriphCLKInitTypeDef according to the internal RCC configuration registers.
 
uint32_t HAL_RCCEx_GetPeriphCLKFreq (uint32_t PeriphClk)
 Return the peripheral clock frequency for a given peripheral(SAI..)
 
void HAL_RCCEx_SelectLSEMode (uint8_t Mode)
 Select LSE mode.
 
uint32_t HAL_RCC_GetSysClockFreq (void)
 Returns the SYSCLK frequency.
 

Detailed Description

Extended Peripheral Control functions.

 ===============================================================================
                ##### Extended Peripheral Control functions  #####
 ===============================================================================
    [..]
    This subsection provides a set of functions allowing to control the RCC Clocks
    frequencies.
    [..]
    (@) Important note: Care must be taken when HAL_RCCEx_PeriphCLKConfig() is used to
        select the RTC clock source; in this case the Backup domain will be reset in
        order to modify the RTC Clock source, as consequence RTC registers (including
        the backup registers) and RCC_BDCR register are set to their reset values.

Function Documentation

◆ HAL_RCCEx_PeriphCLKConfig()

HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig ( RCC_PeriphCLKInitTypeDef * PeriphClkInit)

#include <stm32f4xx_hal_rcc_ex.h>

Initializes the RCC extended peripherals clocks according to the specified parameters in the RCC_PeriphCLKInitTypeDef.

Parameters
PeriphClkInitpointer to an RCC_PeriphCLKInitTypeDef structure that contains the configuration information for the Extended Peripherals clocks(I2S, SAI, LTDC RTC and TIM).
Note
Care must be taken when HAL_RCCEx_PeriphCLKConfig() is used to select the RTC clock source; in this case the Backup domain will be reset in order to modify the RTC Clock source, as consequence RTC registers (including the backup registers) and RCC_BDCR register are set to their reset values.
Return values
HALstatus

Definition at line 87 of file stm32f4xx_hal_rcc_ex.c.

References __HAL_RCC_BACKUPRESET_FORCE, __HAL_RCC_BACKUPRESET_RELEASE, __HAL_RCC_CEC_CONFIG, __HAL_RCC_CLK48_CONFIG, __HAL_RCC_FMPI2C1_CONFIG, __HAL_RCC_GET_FLAG, __HAL_RCC_I2S_APB1_CONFIG, __HAL_RCC_I2S_APB2_CONFIG, __HAL_RCC_PLLI2S_CONFIG, __HAL_RCC_PLLI2S_DISABLE, __HAL_RCC_PLLI2S_ENABLE, __HAL_RCC_PLLI2S_PLLSAICLKDIVQ_CONFIG, __HAL_RCC_PLLSAI_CONFIG, __HAL_RCC_PLLSAI_DISABLE, __HAL_RCC_PLLSAI_ENABLE, __HAL_RCC_PLLSAI_GET_FLAG, __HAL_RCC_PLLSAI_PLLSAICLKDIVQ_CONFIG, __HAL_RCC_PWR_CLK_ENABLE, __HAL_RCC_RTC_CONFIG, __HAL_RCC_SAI1_CONFIG, __HAL_RCC_SAI2_CONFIG, __HAL_RCC_SDIO_CONFIG, __HAL_RCC_SPDIFRX_CONFIG, __HAL_RCC_TIMCLKPRESCALER, assert_param, RCC_PeriphCLKInitTypeDef::CecClockSelection, RCC_PeriphCLKInitTypeDef::Clk48ClockSelection, RCC_PeriphCLKInitTypeDef::Fmpi2c1ClockSelection, HAL_GetTick(), HAL_IS_BIT_SET, HAL_OK, HAL_TIMEOUT, RCC_PeriphCLKInitTypeDef::I2sApb1ClockSelection, RCC_PeriphCLKInitTypeDef::I2sApb2ClockSelection, IS_RCC_CECCLKSOURCE, IS_RCC_CLK48CLKSOURCE, IS_RCC_FMPI2C1CLKSOURCE, IS_RCC_I2SAPB1CLKSOURCE, IS_RCC_I2SAPB2CLKSOURCE, IS_RCC_PERIPHCLOCK, IS_RCC_PLLI2S_DIVQ_VALUE, IS_RCC_PLLI2SM_VALUE, IS_RCC_PLLI2SN_VALUE, IS_RCC_PLLI2SP_VALUE, IS_RCC_PLLI2SQ_VALUE, IS_RCC_PLLI2SR_VALUE, IS_RCC_PLLSAI_DIVQ_VALUE, IS_RCC_PLLSAIM_VALUE, IS_RCC_PLLSAIN_VALUE, IS_RCC_PLLSAIP_VALUE, IS_RCC_PLLSAIQ_VALUE, IS_RCC_RTCCLKSOURCE, IS_RCC_SAI1CLKSOURCE, IS_RCC_SAI2CLKSOURCE, IS_RCC_SDIOCLKSOURCE, IS_RCC_SPDIFRXCLKSOURCE, RCC_PeriphCLKInitTypeDef::PeriphClockSelection, RCC_PeriphCLKInitTypeDef::PLLI2S, PLLI2S_TIMEOUT_VALUE, RCC_PeriphCLKInitTypeDef::PLLI2SDivQ, RCC_PLLI2SInitTypeDef::PLLI2SM, RCC_PLLI2SInitTypeDef::PLLI2SN, RCC_PLLI2SInitTypeDef::PLLI2SP, RCC_PLLI2SInitTypeDef::PLLI2SQ, RCC_PLLI2SInitTypeDef::PLLI2SR, RCC_PeriphCLKInitTypeDef::PLLSAI, PLLSAI_TIMEOUT_VALUE, RCC_PeriphCLKInitTypeDef::PLLSAIDivQ, RCC_PLLSAIInitTypeDef::PLLSAIM, RCC_PLLSAIInitTypeDef::PLLSAIN, RCC_PLLSAIInitTypeDef::PLLSAIP, RCC_PLLSAIInitTypeDef::PLLSAIQ, RCC_CLK48CLKSOURCE_PLLSAIP, RCC_DBP_TIMEOUT_VALUE, RCC_FLAG_LSERDY, RCC_FLAG_PLLI2SRDY, RCC_I2SAPB1CLKSOURCE_PLLI2S, RCC_I2SAPB2CLKSOURCE_PLLI2S, RCC_LSE_TIMEOUT_VALUE, RCC_PERIPHCLK_CEC, RCC_PERIPHCLK_CLK48, RCC_PERIPHCLK_FMPI2C1, RCC_PERIPHCLK_I2S_APB1, RCC_PERIPHCLK_I2S_APB2, RCC_PERIPHCLK_PLLI2S, RCC_PERIPHCLK_RTC, RCC_PERIPHCLK_SAI1, RCC_PERIPHCLK_SAI2, RCC_PERIPHCLK_SDIO, RCC_PERIPHCLK_SPDIFRX, RCC_PERIPHCLK_TIM, RCC_SAI1CLKSOURCE_PLLI2S, RCC_SAI1CLKSOURCE_PLLSAI, RCC_SAI2CLKSOURCE_PLLI2S, RCC_SAI2CLKSOURCE_PLLSAI, RCC_SPDIFRXCLKSOURCE_PLLI2SP, RCC_PeriphCLKInitTypeDef::RTCClockSelection, RCC_PeriphCLKInitTypeDef::Sai1ClockSelection, RCC_PeriphCLKInitTypeDef::Sai2ClockSelection, RCC_PeriphCLKInitTypeDef::SdioClockSelection, RCC_PeriphCLKInitTypeDef::SpdifClockSelection, and RCC_PeriphCLKInitTypeDef::TIMPresSelection.

Referenced by HAL_InitTick().

◆ HAL_RCCEx_GetPeriphCLKConfig()

void HAL_RCCEx_GetPeriphCLKConfig ( RCC_PeriphCLKInitTypeDef * PeriphClkInit)

#include <stm32f4xx_hal_rcc_ex.h>

Get the RCC_PeriphCLKInitTypeDef according to the internal RCC configuration registers.

Parameters
PeriphClkInitpointer to an RCC_PeriphCLKInitTypeDef structure that will be configured.
Return values
None

Definition at line 500 of file stm32f4xx_hal_rcc_ex.c.

References __HAL_RCC_GET_CEC_SOURCE, __HAL_RCC_GET_CLK48_SOURCE, __HAL_RCC_GET_FMPI2C1_SOURCE, __HAL_RCC_GET_I2S_APB1_SOURCE, __HAL_RCC_GET_I2S_APB2_SOURCE, __HAL_RCC_GET_SAI1_SOURCE, __HAL_RCC_GET_SAI2_SOURCE, __HAL_RCC_GET_SDIO_SOURCE, __HAL_RCC_GET_SPDIFRX_SOURCE, RCC_PeriphCLKInitTypeDef::CecClockSelection, RCC_PeriphCLKInitTypeDef::Clk48ClockSelection, RCC_PeriphCLKInitTypeDef::Fmpi2c1ClockSelection, RCC_PeriphCLKInitTypeDef::I2sApb1ClockSelection, RCC_PeriphCLKInitTypeDef::I2sApb2ClockSelection, RCC_PeriphCLKInitTypeDef::PeriphClockSelection, RCC_PeriphCLKInitTypeDef::PLLI2S, RCC_PeriphCLKInitTypeDef::PLLI2SDivQ, RCC_PLLI2SInitTypeDef::PLLI2SM, RCC_PLLI2SInitTypeDef::PLLI2SN, RCC_PLLI2SInitTypeDef::PLLI2SP, RCC_PLLI2SInitTypeDef::PLLI2SQ, RCC_PLLI2SInitTypeDef::PLLI2SR, RCC_PeriphCLKInitTypeDef::PLLSAI, RCC_PeriphCLKInitTypeDef::PLLSAIDivQ, RCC_PLLSAIInitTypeDef::PLLSAIM, RCC_PLLSAIInitTypeDef::PLLSAIN, RCC_PLLSAIInitTypeDef::PLLSAIP, RCC_PLLSAIInitTypeDef::PLLSAIQ, RCC_PERIPHCLK_CEC, RCC_PERIPHCLK_CLK48, RCC_PERIPHCLK_FMPI2C1, RCC_PERIPHCLK_I2S_APB1, RCC_PERIPHCLK_I2S_APB2, RCC_PERIPHCLK_RTC, RCC_PERIPHCLK_SAI1, RCC_PERIPHCLK_SAI2, RCC_PERIPHCLK_SDIO, RCC_PERIPHCLK_SPDIFRX, RCC_PERIPHCLK_TIM, RCC_TIMPRES_ACTIVATED, RCC_TIMPRES_DESACTIVATED, RCC_PeriphCLKInitTypeDef::RTCClockSelection, RCC_PeriphCLKInitTypeDef::Sai1ClockSelection, RCC_PeriphCLKInitTypeDef::Sai2ClockSelection, RCC_PeriphCLKInitTypeDef::SdioClockSelection, RCC_PeriphCLKInitTypeDef::SpdifClockSelection, and RCC_PeriphCLKInitTypeDef::TIMPresSelection.

◆ HAL_RCCEx_GetPeriphCLKFreq()

uint32_t HAL_RCCEx_GetPeriphCLKFreq ( uint32_t PeriphClk)

#include <stm32f4xx_hal_rcc_ex.h>

Return the peripheral clock frequency for a given peripheral(SAI..)

Note
Return 0 if peripheral clock identifier not managed by this API
Parameters
PeriphClkPeripheral clock identifier This parameter can be one of the following values:
  • RCC_PERIPHCLK_SAI1: SAI1 peripheral clock
  • RCC_PERIPHCLK_SAI2: SAI2 peripheral clock
  • RCC_PERIPHCLK_I2S_APB1: I2S APB1 peripheral clock
  • RCC_PERIPHCLK_I2S_APB2: I2S APB2 peripheral clock
Return values
Frequencyin KHz

Definition at line 580 of file stm32f4xx_hal_rcc_ex.c.

References __HAL_RCC_GET_I2S_APB1_SOURCE, __HAL_RCC_GET_I2S_APB2_SOURCE, EXTERNAL_CLOCK_VALUE, HSE_VALUE, HSI_VALUE, RCC_I2SAPB1CLKSOURCE_EXT, RCC_I2SAPB1CLKSOURCE_PLLI2S, RCC_I2SAPB1CLKSOURCE_PLLR, RCC_I2SAPB1CLKSOURCE_PLLSRC, RCC_I2SAPB2CLKSOURCE_EXT, RCC_I2SAPB2CLKSOURCE_PLLI2S, RCC_I2SAPB2CLKSOURCE_PLLR, RCC_I2SAPB2CLKSOURCE_PLLSRC, RCC_PERIPHCLK_I2S_APB1, RCC_PERIPHCLK_I2S_APB2, RCC_PERIPHCLK_SAI1, RCC_PERIPHCLK_SAI2, RCC_PLLSOURCE_HSE, and RCC_PLLSOURCE_HSI.

Referenced by HAL_I2S_Init(), and SAI_GetInputClock().

◆ HAL_RCCEx_SelectLSEMode()

void HAL_RCCEx_SelectLSEMode ( uint8_t Mode)

#include <stm32f4xx_hal_rcc_ex.h>

Select LSE mode.

Note
This mode is only available for STM32F410xx/STM32F411xx/STM32F446xx/STM32F469xx/STM32F479xx/STM32F412Zx/STM32F412Vx/STM32F412Rx/STM32F412Cx devices.
Parameters
Modespecifies the LSE mode. This parameter can be one of the following values:
  • RCC_LSE_LOWPOWER_MODE: LSE oscillator in low power mode selection
  • RCC_LSE_HIGHDRIVE_MODE: LSE oscillator in High Drive mode selection
Return values
None

Definition at line 2809 of file stm32f4xx_hal_rcc_ex.c.

References assert_param, IS_RCC_LSE_MODE, and RCC_LSE_HIGHDRIVE_MODE.

◆ HAL_RCC_GetSysClockFreq()

uint32_t HAL_RCC_GetSysClockFreq ( void )

#include <stm32f4xx_hal_rcc_ex.c>

Returns the SYSCLK frequency.

Note
This function implementation is valid only for STM32F446xx devices.
This function add the PLL/PLLR System clock source
The system frequency computed by this function is not the real frequency in the chip. It is calculated based on the predefined constant and the selected clock source:
If SYSCLK source is HSI, function returns values based on HSI_VALUE(*)
If SYSCLK source is HSE, function returns values based on HSE_VALUE(**)
If SYSCLK source is PLL or PLLR, function returns values based on HSE_VALUE(**) or HSI_VALUE(*) multiplied/divided by the PLL factors.
(*) HSI_VALUE is a constant defined in stm32f4xx_hal_conf.h file (default value 16 MHz) but the real value may vary depending on the variations in voltage and temperature.
(**) HSE_VALUE is a constant defined in stm32f4xx_hal_conf.h file (default value 25 MHz), user has to ensure that HSE_VALUE is same as the real frequency of the crystal used. Otherwise, this function may have wrong result.
The result of this function could be not correct when using fractional value for HSE crystal.
This function can be used by the user application to compute the baudrate for the communication peripherals or configure other parameters.
Each time SYSCLK changes, this function must be called to update the right SYSCLK value. Otherwise, any configuration based on this function will be incorrect.
Return values
SYSCLKfrequency

Definition at line 3094 of file stm32f4xx_hal_rcc_ex.c.

References __HAL_RCC_GET_PLL_OSCSOURCE, HSE_VALUE, HSI_VALUE, and RCC_PLLSOURCE_HSI.