STM32H735xx HAL User Manual
Functions
Peripheral Control functions
RCC Exported Functions

RCC clocks control functions. More...

Functions

void HAL_RCC_MCOConfig (uint32_t RCC_MCOx, uint32_t RCC_MCOSource, uint32_t RCC_MCODiv)
 Selects the clock source to output on MCO1 pin(PA8) or on MCO2 pin(PC9).
void HAL_RCC_EnableCSS (void)
 Enables the Clock Security System.
void HAL_RCC_DisableCSS (void)
 Disables the Clock Security System.
uint32_t HAL_RCC_GetSysClockFreq (void)
 Returns the SYSCLK frequency.
uint32_t HAL_RCC_GetHCLKFreq (void)
 Returns the HCLK frequency.
uint32_t HAL_RCC_GetPCLK1Freq (void)
 Returns the PCLK1 frequency.
uint32_t HAL_RCC_GetPCLK2Freq (void)
 Returns the PCLK2 frequency.
void HAL_RCC_GetOscConfig (RCC_OscInitTypeDef *RCC_OscInitStruct)
 Configures the RCC_OscInitStruct according to the internal RCC configuration registers.
void HAL_RCC_GetClockConfig (RCC_ClkInitTypeDef *RCC_ClkInitStruct, uint32_t *pFLatency)
 Configures the RCC_ClkInitStruct according to the internal RCC configuration registers.
void HAL_RCC_NMI_IRQHandler (void)
 This function handles the RCC CSS interrupt request.
__weak void HAL_RCC_CCSCallback (void)
 RCC Clock Security System interrupt callback.

Detailed Description

RCC clocks control functions.

 ===============================================================================
                      ##### Peripheral Control functions #####
 ===============================================================================
    [..]
    This subsection provides a set of functions allowing to control the RCC Clocks
    frequencies.


Function Documentation

__weak void HAL_RCC_CCSCallback ( void  )

RCC Clock Security System interrupt callback.

Return values:
none

Definition at line 1770 of file stm32h7xx_hal_rcc.c.

Referenced by HAL_RCC_NMI_IRQHandler().

void HAL_RCC_DisableCSS ( void  )

Disables the Clock Security System.

Return values:
None

Definition at line 1328 of file stm32h7xx_hal_rcc.c.

void HAL_RCC_EnableCSS ( void  )

Enables the Clock Security System.

Note:
If a failure is detected on the HSE oscillator clock, this oscillator is automatically disabled and an interrupt is generated to inform the software about the failure (Clock Security System Interrupt, CSSI), allowing the MCU to perform rescue operations. The CSSI is linked to the Cortex-M NMI (Non-Mask-able Interrupt) exception vector.
Return values:
None

Definition at line 1319 of file stm32h7xx_hal_rcc.c.

void HAL_RCC_GetClockConfig ( RCC_ClkInitTypeDef RCC_ClkInitStruct,
uint32_t *  pFLatency 
)

Configures the RCC_ClkInitStruct according to the internal RCC configuration registers.

Parameters:
RCC_ClkInitStruct,:pointer to an RCC_ClkInitTypeDef structure that will be configured.
pFLatency,:Pointer on the Flash Latency.
Return values:
None

Definition at line 1697 of file stm32h7xx_hal_rcc.c.

References RCC_ClkInitTypeDef::AHBCLKDivider, RCC_ClkInitTypeDef::APB1CLKDivider, RCC_ClkInitTypeDef::APB2CLKDivider, RCC_ClkInitTypeDef::APB3CLKDivider, RCC_ClkInitTypeDef::APB4CLKDivider, RCC_ClkInitTypeDef::ClockType, RCC_CLOCKTYPE_D1PCLK1, RCC_CLOCKTYPE_D3PCLK1, RCC_CLOCKTYPE_HCLK, RCC_CLOCKTYPE_PCLK1, RCC_CLOCKTYPE_PCLK2, RCC_CLOCKTYPE_SYSCLK, RCC_ClkInitTypeDef::SYSCLKDivider, and RCC_ClkInitTypeDef::SYSCLKSource.

uint32_t HAL_RCC_GetHCLKFreq ( void  )

Returns the HCLK frequency.

Note:
Each time HCLK changes, this function must be called to update the right HCLK value. Otherwise, any configuration based on this function will be incorrect.
The SystemD2Clock CMSIS variable is used to store System domain2 Clock Frequency and updated within this function
Return values:
HCLKfrequency

Definition at line 1464 of file stm32h7xx_hal_rcc.c.

References HAL_RCC_GetSysClockFreq().

Referenced by ADC_ConfigureBoostMode(), ETH_MAC_MDIO_ClkConfig(), HAL_ETH_Init(), HAL_ETH_SetMDIOClockRange(), HAL_PCD_IRQHandler(), HAL_RCC_GetPCLK1Freq(), HAL_RCC_GetPCLK2Freq(), HAL_RCCEx_GetD1PCLK1Freq(), and HAL_RCCEx_GetD3PCLK1Freq().

void HAL_RCC_GetOscConfig ( RCC_OscInitTypeDef RCC_OscInitStruct)
uint32_t HAL_RCC_GetPCLK1Freq ( void  )

Returns the PCLK1 frequency.

Note:
Each time PCLK1 changes, this function must be called to update the right PCLK1 value. Otherwise, any configuration based on this function will be incorrect.
Return values:
PCLK1frequency

Definition at line 1496 of file stm32h7xx_hal_rcc.c.

References HAL_RCC_GetHCLKFreq().

Referenced by IRDA_SetConfig(), SMARTCARD_SetConfig(), UART_SetConfig(), and USART_SetConfig().

uint32_t HAL_RCC_GetPCLK2Freq ( void  )

Returns the PCLK2 frequency.

Note:
Each time PCLK2 changes, this function must be called to update the right PCLK2 value. Otherwise, any configuration based on this function will be incorrect.
Return values:
PCLK1frequency

Definition at line 1514 of file stm32h7xx_hal_rcc.c.

References HAL_RCC_GetHCLKFreq().

Referenced by IRDA_SetConfig(), SMARTCARD_SetConfig(), UART_SetConfig(), and USART_SetConfig().

uint32_t HAL_RCC_GetSysClockFreq ( void  )

Returns the SYSCLK frequency.

Note:
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 CSI, function returns values based on CSI_VALUE(*)
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, function returns values based on CSI_VALUE(*), HSI_VALUE(**) or HSE_VALUE(***) multiplied/divided by the PLL factors.
(*) CSI_VALUE is a constant defined in stm32h7xx_hal_conf.h file (default value 4 MHz) but the real value may vary depending on the variations in voltage and temperature.
(**) HSI_VALUE is a constant defined in stm32h7xx_hal_conf.h file (default value 64 MHz) but the real value may vary depending on the variations in voltage and temperature.
(***) HSE_VALUE is a constant defined in stm32h7xx_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 baud rate 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 1367 of file stm32h7xx_hal_rcc.c.

References __HAL_RCC_GET_FLAG, __HAL_RCC_GET_HSI_DIVIDER, CSI_VALUE, HSE_VALUE, HSI_VALUE, RCC_FLAG_HSIDIV, RCC_PLLSOURCE_CSI, RCC_PLLSOURCE_HSE, and RCC_PLLSOURCE_HSI.

Referenced by HAL_Init(), HAL_RCC_ClockConfig(), HAL_RCC_GetHCLKFreq(), and HAL_RCCEx_GetD1SysClockFreq().

void HAL_RCC_MCOConfig ( uint32_t  RCC_MCOx,
uint32_t  RCC_MCOSource,
uint32_t  RCC_MCODiv 
)

Selects the clock source to output on MCO1 pin(PA8) or on MCO2 pin(PC9).

Note:
PA8/PC9 should be configured in alternate function mode.
Parameters:
RCC_MCOx,:specifies the output direction for the clock source. This parameter can be one of the following values:
  • RCC_MCO1: Clock source to output on MCO1 pin(PA8).
  • RCC_MCO2: Clock source to output on MCO2 pin(PC9).
RCC_MCOSource,:specifies the clock source to output. This parameter can be one of the following values:
  • RCC_MCO1SOURCE_HSI: HSI clock selected as MCO1 source
  • RCC_MCO1SOURCE_LSE: LSE clock selected as MCO1 source
  • RCC_MCO1SOURCE_HSE: HSE clock selected as MCO1 source
  • RCC_MCO1SOURCE_PLL1QCLK: PLL1Q clock selected as MCO1 source
  • RCC_MCO1SOURCE_HSI48: HSI48 (48MHZ) selected as MCO1 source
  • RCC_MCO2SOURCE_SYSCLK: System clock (SYSCLK) selected as MCO2 source
  • RCC_MCO2SOURCE_PLL2PCLK: PLL2P clock selected as MCO2 source
  • RCC_MCO2SOURCE_HSE: HSE clock selected as MCO2 source
  • RCC_MCO2SOURCE_PLLCLK: PLL1P clock selected as MCO2 source
  • RCC_MCO2SOURCE_CSICLK: CSI clock selected as MCO2 source
  • RCC_MCO2SOURCE_LSICLK: LSI clock selected as MCO2 source
RCC_MCODiv,:specifies the MCOx pre-scaler. This parameter can be one of the following values:
  • RCC_MCODIV_1 up to RCC_MCODIV_15 : divider applied to MCOx clock
Return values:
None

Definition at line 1265 of file stm32h7xx_hal_rcc.c.

References GPIO_InitTypeDef::Alternate, assert_param, GPIO_AF0_MCO, GPIO_MODE_AF_PP, GPIO_NOPULL, GPIO_SPEED_FREQ_VERY_HIGH, HAL_GPIO_Init(), IS_RCC_MCO, IS_RCC_MCO1SOURCE, IS_RCC_MCO2SOURCE, IS_RCC_MCODIV, MCO1_CLK_ENABLE, MCO1_GPIO_PORT, MCO1_PIN, MCO2_CLK_ENABLE, MCO2_GPIO_PORT, MCO2_PIN, GPIO_InitTypeDef::Mode, GPIO_InitTypeDef::Pin, GPIO_InitTypeDef::Pull, RCC_MCO1, and GPIO_InitTypeDef::Speed.

void HAL_RCC_NMI_IRQHandler ( void  )

This function handles the RCC CSS interrupt request.

Note:
This API should be called under the NMI_Handler().
Return values:
None

Definition at line 1753 of file stm32h7xx_hal_rcc.c.

References __HAL_RCC_CLEAR_IT, __HAL_RCC_GET_IT, HAL_RCC_CCSCallback(), and RCC_IT_CSS.