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.
Initialization and de-initialization functions
[RCC Exported Functions]
Initialization and Configuration functions. More...
Functions | |
void | HAL_RCC_DeInit (void) |
Resets the RCC clock configuration to the default reset state. | |
HAL_StatusTypeDef | HAL_RCC_OscConfig (RCC_OscInitTypeDef *RCC_OscInitStruct) |
Initializes the RCC Oscillators according to the specified parameters in the RCC_OscInitTypeDef. | |
HAL_StatusTypeDef | HAL_RCC_ClockConfig (RCC_ClkInitTypeDef *RCC_ClkInitStruct, uint32_t FLatency) |
Initializes the CPU, AHB and APB buses clocks according to the specified parameters in the RCC_ClkInitStruct. |
Detailed Description
Initialization and Configuration functions.
=============================================================================== ##### Initialization and de-initialization functions ##### =============================================================================== [..] This section provides functions allowing to configure the internal/external oscillators (HSE, HSI, LSE, LSI, PLL, CSS and MCO) and the System buses clocks (SYSCLK, AHB, APB1 and APB2). [..] Internal/external clock and PLL configuration (#) HSI (high-speed internal), 8 MHz factory-trimmed RC used directly or through the PLL as System clock source. (#) LSI (low-speed internal), ~40 KHz low consumption RC used as IWDG and/or RTC clock source. (#) HSE (high-speed external), 4 to 24 MHz (STM32F100xx) or 4 to 16 MHz (STM32F101x/STM32F102x/STM32F103x) or 3 to 25 MHz (STM32F105x/STM32F107x) crystal oscillator used directly or through the PLL as System clock source. Can be used also as RTC clock source. (#) LSE (low-speed external), 32 KHz oscillator used as RTC clock source. (#) PLL (clocked by HSI or HSE), featuring different output clocks: (++) The first output is used to generate the high speed system clock (up to 72 MHz for STM32F10xxx or up to 24 MHz for STM32F100xx) (++) The second output is used to generate the clock for the USB OTG FS (48 MHz) (#) CSS (Clock security system), once enable using the macro __HAL_RCC_CSS_ENABLE() and if a HSE clock failure occurs(HSE used directly or through PLL as System clock source), the System clocks automatically switched to HSI and an interrupt is generated if enabled. The interrupt is linked to the Cortex-M3 NMI (Non-Maskable Interrupt) exception vector. (#) MCO1 (microcontroller clock output), used to output SYSCLK, HSI, HSE or PLL clock (divided by 2) on PA8 pin + PLL2CLK, PLL3CLK/2, PLL3CLK and XTI for STM32F105x/STM32F107x [..] System, AHB and APB buses clocks configuration (#) Several clock sources can be used to drive the System clock (SYSCLK): HSI, HSE and PLL. The AHB clock (HCLK) is derived from System clock through configurable prescaler and used to clock the CPU, memory and peripherals mapped on AHB bus (DMA, GPIO...). APB1 (PCLK1) and APB2 (PCLK2) clocks are derived from AHB clock through configurable prescalers and used to clock the peripherals mapped on these buses. You can use "@ref HAL_RCC_GetSysClockFreq()" function to retrieve the frequencies of these clocks. -@- All the peripheral clocks are derived from the System clock (SYSCLK) except: (+@) RTC: RTC clock can be derived either from the LSI, LSE or HSE clock divided by 128. (+@) USB OTG FS and RTC: USB OTG FS require a frequency equal to 48 MHz to work correctly. This clock is derived of the main PLL through PLL Multiplier. (+@) I2S interface on STM32F105x/STM32F107x can be derived from PLL3CLK (+@) IWDG clock which is always the LSI clock. (#) For STM32F10xxx, the maximum frequency of the SYSCLK and HCLK/PCLK2 is 72 MHz, PCLK1 36 MHz. For STM32F100xx, the maximum frequency of the SYSCLK and HCLK/PCLK1/PCLK2 is 24 MHz. Depending on the SYSCLK frequency, the flash latency should be adapted accordingly.
Function Documentation
HAL_StatusTypeDef HAL_RCC_ClockConfig | ( | RCC_ClkInitTypeDef * | RCC_ClkInitStruct, |
uint32_t | FLatency | ||
) |
Initializes the CPU, AHB and APB buses clocks according to the specified parameters in the RCC_ClkInitStruct.
- Parameters:
-
RCC_ClkInitStruct pointer to an RCC_OscInitTypeDef structure that contains the configuration information for the RCC peripheral. FLatency FLASH Latency The value of this parameter depend on device used within the same series
- Note:
- The SystemCoreClock CMSIS variable is used to store System Clock Frequency and updated by HAL_RCC_GetHCLKFreq() function called within this function
- The HSI is used (enabled by hardware) as system clock source after start-up from Reset, wake-up from STOP and STANDBY mode, or in case of failure of the HSE used directly or indirectly as system clock (if the Clock Security System CSS is enabled).
- A switch from one clock source to another occurs only if the target clock source is ready (clock stable after start-up delay or PLL locked). If a clock source which is not yet ready is selected, the switch will occur when the clock source will be ready. You can use HAL_RCC_GetClockConfig() function to know which clock is currently used as system clock source.
- Return values:
-
HAL status
Definition at line 695 of file stm32f1xx_hal_rcc.c.
void HAL_RCC_DeInit | ( | void | ) |
Resets the RCC clock configuration to the default reset state.
- Note:
- The default reset state of the clock configuration is given below:
- HSI ON and used as system clock source
- HSE and PLL OFF
- AHB, APB1 and APB2 prescaler set to 1.
- CSS and MCO1 OFF
- All interrupts disabled
-
This function does not modify the configuration of the
- Peripheral clocks
- LSI, LSE and RTC clocks
- Return values:
-
None
Definition at line 221 of file stm32f1xx_hal_rcc.c.
HAL_StatusTypeDef HAL_RCC_OscConfig | ( | RCC_OscInitTypeDef * | RCC_OscInitStruct ) |
Initializes the RCC Oscillators according to the specified parameters in the RCC_OscInitTypeDef.
- Parameters:
-
RCC_OscInitStruct pointer to an RCC_OscInitTypeDef structure that contains the configuration information for the RCC Oscillators.
- Note:
- The PLL is not disabled when used as system clock.
- The PLL is not disabled when USB OTG FS clock is enabled (specific to devices with USB FS)
- Transitions LSE Bypass to LSE On and LSE On to LSE Bypass are not supported by this macro. User should request a transition to LSE Off first and then LSE On or LSE Bypass.
- Transition HSE Bypass to HSE On and HSE On to HSE Bypass are not supported by this macro. User should request a transition to HSE Off first and then HSE On or HSE Bypass.
- Return values:
-
HAL status
Definition at line 265 of file stm32f1xx_hal_rcc.c.
Generated on Tue Jul 12 2022 15:37:32 by
