Extended Clock management functions.
More...
Extended Clock management functions.
===============================================================================
##### Extended clock management functions #####
===============================================================================
[..]
This subsection provides a set of functions allowing to control the
activation or deactivation of MSI PLL-mode, PLLSAI1, PLLSAI2, LSE CSS,
Low speed clock output and clock after wake-up from STOP mode.
◆ HAL_RCCEx_DisableLSCO()
| void HAL_RCCEx_DisableLSCO |
( |
void |
| ) |
|
Disable the Low Speed clock output.
- Return values
-
Definition at line 2452 of file stm32l4xx_hal_rcc_ex.c.
2454 FlagStatus pwrclkchanged = RESET;
2455 FlagStatus backupchanged = RESET;
2458 if(__HAL_RCC_PWR_IS_CLK_DISABLED())
2460 __HAL_RCC_PWR_CLK_ENABLE();
2461 pwrclkchanged = SET;
2463 if(HAL_IS_BIT_CLR(PWR->CR1, PWR_CR1_DBP))
2467 backupchanged = SET;
2473 if(backupchanged == SET)
2478 if(pwrclkchanged == SET)
2480 __HAL_RCC_PWR_CLK_DISABLE();
void HAL_PWR_DisableBkUpAccess(void)
Disable access to the backup domain (RTC registers, RTC backup data registers).
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)
void HAL_PWR_EnableBkUpAccess(void)
Enable access to the backup domain (RTC registers, RTC backup data registers).
◆ HAL_RCCEx_DisableLSECSS()
| void HAL_RCCEx_DisableLSECSS |
( |
void |
| ) |
|
Disable the LSE Clock Security System.
- Note
- LSE Clock Security System can only be disabled after a LSE failure detection.
- Return values
-
Definition at line 2343 of file stm32l4xx_hal_rcc_ex.c.
2345 CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSECSSON) ;
2348 __HAL_RCC_DISABLE_IT(RCC_IT_LSECSS);
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)
◆ HAL_RCCEx_DisableMSIPLLMode()
| void HAL_RCCEx_DisableMSIPLLMode |
( |
void |
| ) |
|
Disable the PLL-mode of the MSI.
- Note
- PLL-mode of the MSI is automatically reset when LSE oscillator is disabled.
- Return values
-
Definition at line 2500 of file stm32l4xx_hal_rcc_ex.c.
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)
◆ HAL_RCCEx_DisablePLLSAI1()
| HAL_StatusTypeDef HAL_RCCEx_DisablePLLSAI1 |
( |
void |
| ) |
|
Disable PLLSAI1.
- Return values
-
Definition at line 2124 of file stm32l4xx_hal_rcc_ex.c.
2127 HAL_StatusTypeDef status =
HAL_OK;
2130 __HAL_RCC_PLLSAI1_DISABLE();
2136 while(READ_BIT(RCC->CR, RCC_CR_PLLSAI1RDY) != 0U)
2138 if((
HAL_GetTick() - tickstart) > PLLSAI1_TIMEOUT_VALUE)
2140 status = HAL_TIMEOUT;
2146 __HAL_RCC_PLLSAI1CLKOUT_DISABLE(RCC_PLLSAI1CFGR_PLLSAI1PEN|RCC_PLLSAI1CFGR_PLLSAI1QEN|RCC_PLLSAI1CFGR_PLLSAI1REN);
2149 #if defined(RCC_PLLSAI2_SUPPORT) 2150 if(READ_BIT(RCC->CR, (RCC_CR_PLLRDY | RCC_CR_PLLSAI2RDY)) == 0U)
2152 MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC, RCC_PLLSOURCE_NONE);
2155 if(READ_BIT(RCC->CR, RCC_CR_PLLRDY) == 0U)
2157 MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC, RCC_PLLSOURCE_NONE);
uint32_t HAL_GetTick(void)
Provide a tick value in millisecond.
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)
◆ HAL_RCCEx_DisablePLLSAI2()
| HAL_StatusTypeDef HAL_RCCEx_DisablePLLSAI2 |
( |
void |
| ) |
|
Disable PLLISAI2.
- Return values
-
Definition at line 2252 of file stm32l4xx_hal_rcc_ex.c.
2255 HAL_StatusTypeDef status =
HAL_OK;
2258 __HAL_RCC_PLLSAI2_DISABLE();
2264 while(READ_BIT(RCC->CR, RCC_CR_PLLSAI2RDY) != 0U)
2266 if((
HAL_GetTick() - tickstart) > PLLSAI2_TIMEOUT_VALUE)
2268 status = HAL_TIMEOUT;
2274 #if defined(RCC_PLLSAI2Q_DIV_SUPPORT) 2275 __HAL_RCC_PLLSAI2CLKOUT_DISABLE(RCC_PLLSAI2CFGR_PLLSAI2PEN|RCC_PLLSAI2CFGR_PLLSAI2QEN|RCC_PLLSAI2CFGR_PLLSAI2REN);
2277 __HAL_RCC_PLLSAI2CLKOUT_DISABLE(RCC_PLLSAI2CFGR_PLLSAI2PEN|RCC_PLLSAI2CFGR_PLLSAI2REN);
2281 if(READ_BIT(RCC->CR, (RCC_CR_PLLRDY | RCC_CR_PLLSAI1RDY)) == 0U)
2283 MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC, RCC_PLLSOURCE_NONE);
uint32_t HAL_GetTick(void)
Provide a tick value in millisecond.
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)
◆ HAL_RCCEx_EnableLSCO()
| void HAL_RCCEx_EnableLSCO |
( |
uint32_t |
LSCOSource | ) |
|
Select the Low Speed clock source to output on LSCO pin (PA2).
- Parameters
-
| LSCOSource | specifies the Low Speed clock source to output. This parameter can be one of the following values:
- RCC_LSCOSOURCE_LSI LSI clock selected as LSCO source
- RCC_LSCOSOURCE_LSE LSE clock selected as LSCO source
|
- Return values
-
Definition at line 2405 of file stm32l4xx_hal_rcc_ex.c.
2407 GPIO_InitTypeDef GPIO_InitStruct;
2408 FlagStatus pwrclkchanged = RESET;
2409 FlagStatus backupchanged = RESET;
2415 __LSCO_CLK_ENABLE();
2418 GPIO_InitStruct.Pin = LSCO_PIN;
2419 GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
2420 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
2421 GPIO_InitStruct.Pull = GPIO_NOPULL;
2425 if(__HAL_RCC_PWR_IS_CLK_DISABLED())
2427 __HAL_RCC_PWR_CLK_ENABLE();
2428 pwrclkchanged = SET;
2430 if(HAL_IS_BIT_CLR(PWR->CR1, PWR_CR1_DBP))
2433 backupchanged = SET;
2436 MODIFY_REG(RCC->BDCR, RCC_BDCR_LSCOSEL | RCC_BDCR_LSCOEN, LSCOSource | RCC_BDCR_LSCOEN);
2438 if(backupchanged == SET)
2442 if(pwrclkchanged == SET)
2444 __HAL_RCC_PWR_CLK_DISABLE();
void HAL_PWR_DisableBkUpAccess(void)
Disable access to the backup domain (RTC registers, RTC backup data registers).
void HAL_PWR_EnableBkUpAccess(void)
Enable access to the backup domain (RTC registers, RTC backup data registers).
void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init)
Initialize the GPIOx peripheral according to the specified parameters in the GPIO_Init.
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))
◆ HAL_RCCEx_EnableLSECSS()
| void HAL_RCCEx_EnableLSECSS |
( |
void |
| ) |
|
◆ HAL_RCCEx_EnableLSECSS_IT()
| void HAL_RCCEx_EnableLSECSS_IT |
( |
void |
| ) |
|
Enable the LSE Clock Security System Interrupt & corresponding EXTI line.
- Note
- LSE Clock Security System Interrupt is mapped on RTC EXTI line 19
- Return values
-
Definition at line 2356 of file stm32l4xx_hal_rcc_ex.c.
2359 SET_BIT(RCC->BDCR, RCC_BDCR_LSECSSON) ;
2362 __HAL_RCC_ENABLE_IT(RCC_IT_LSECSS);
2365 __HAL_RCC_LSECSS_EXTI_ENABLE_IT();
2366 __HAL_RCC_LSECSS_EXTI_ENABLE_RISING_EDGE();
◆ HAL_RCCEx_EnableMSIPLLMode()
| void HAL_RCCEx_EnableMSIPLLMode |
( |
void |
| ) |
|
Enable the PLL-mode of the MSI.
- Note
- Prior to enable the PLL-mode of the MSI for automatic hardware calibration LSE oscillator is to be enabled with HAL_RCC_OscConfig().
- Return values
-
Definition at line 2490 of file stm32l4xx_hal_rcc_ex.c.
2492 SET_BIT(RCC->CR, RCC_CR_MSIPLLEN) ;
◆ HAL_RCCEx_EnablePLLSAI1()
| HAL_StatusTypeDef HAL_RCCEx_EnablePLLSAI1 |
( |
RCC_PLLSAI1InitTypeDef * |
PLLSAI1Init | ) |
|
Enable PLLSAI1.
- Parameters
-
| PLLSAI1Init | pointer to an RCC_PLLSAI1InitTypeDef structure that contains the configuration information for the PLLSAI1 |
- Return values
-
Definition at line 2056 of file stm32l4xx_hal_rcc_ex.c.
2059 HAL_StatusTypeDef status =
HAL_OK;
2062 assert_param(IS_RCC_PLLSAI1SOURCE(PLLSAI1Init->PLLSAI1Source));
2063 assert_param(IS_RCC_PLLSAI1M_VALUE(PLLSAI1Init->PLLSAI1M));
2064 assert_param(IS_RCC_PLLSAI1N_VALUE(PLLSAI1Init->PLLSAI1N));
2065 assert_param(IS_RCC_PLLSAI1P_VALUE(PLLSAI1Init->PLLSAI1P));
2066 assert_param(IS_RCC_PLLSAI1Q_VALUE(PLLSAI1Init->PLLSAI1Q));
2067 assert_param(IS_RCC_PLLSAI1R_VALUE(PLLSAI1Init->PLLSAI1R));
2068 assert_param(IS_RCC_PLLSAI1CLOCKOUT_VALUE(PLLSAI1Init->PLLSAI1ClockOut));
2071 __HAL_RCC_PLLSAI1_DISABLE();
2077 while(READ_BIT(RCC->CR, RCC_CR_PLLSAI1RDY) != 0U)
2079 if((
HAL_GetTick() - tickstart) > PLLSAI1_TIMEOUT_VALUE)
2081 status = HAL_TIMEOUT;
2088 #if defined(RCC_PLLSAI1M_DIV_1_16_SUPPORT) 2091 __HAL_RCC_PLLSAI1_CONFIG(PLLSAI1Init->PLLSAI1M, PLLSAI1Init->PLLSAI1N, PLLSAI1Init->PLLSAI1P, PLLSAI1Init->PLLSAI1Q, PLLSAI1Init->PLLSAI1R);
2095 __HAL_RCC_PLLSAI1_CONFIG(PLLSAI1Init->PLLSAI1N, PLLSAI1Init->PLLSAI1P, PLLSAI1Init->PLLSAI1Q, PLLSAI1Init->PLLSAI1R);
2098 __HAL_RCC_PLLSAI1CLKOUT_ENABLE(PLLSAI1Init->PLLSAI1ClockOut);
2101 __HAL_RCC_PLLSAI1_ENABLE();
2107 while(READ_BIT(RCC->CR, RCC_CR_PLLSAI1RDY) == 0U)
2109 if((
HAL_GetTick() - tickstart) > PLLSAI1_TIMEOUT_VALUE)
2111 status = HAL_TIMEOUT;
uint32_t HAL_GetTick(void)
Provide a tick value in millisecond.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))
◆ HAL_RCCEx_EnablePLLSAI2()
Enable PLLSAI2.
- Parameters
-
| PLLSAI2Init | pointer to an RCC_PLLSAI2InitTypeDef structure that contains the configuration information for the PLLSAI2 |
- Return values
-
Definition at line 2174 of file stm32l4xx_hal_rcc_ex.c.
2177 HAL_StatusTypeDef status =
HAL_OK;
2184 #if defined(RCC_PLLSAI2Q_DIV_SUPPORT) 2191 __HAL_RCC_PLLSAI2_DISABLE();
2197 while(READ_BIT(RCC->CR, RCC_CR_PLLSAI2RDY) != 0U)
2199 if((
HAL_GetTick() - tickstart) > PLLSAI2_TIMEOUT_VALUE)
2201 status = HAL_TIMEOUT;
2208 #if defined(RCC_PLLSAI2M_DIV_1_16_SUPPORT) && defined(RCC_PLLSAI2Q_DIV_SUPPORT) 2212 #elif defined(RCC_PLLSAI2M_DIV_1_16_SUPPORT) 2216 #elif defined(RCC_PLLSAI2Q_DIV_SUPPORT) 2229 __HAL_RCC_PLLSAI2_ENABLE();
2235 while(READ_BIT(RCC->CR, RCC_CR_PLLSAI2RDY) == 0U)
2237 if((
HAL_GetTick() - tickstart) > PLLSAI2_TIMEOUT_VALUE)
2239 status = HAL_TIMEOUT;
uint32_t HAL_GetTick(void)
Provide a tick value in millisecond.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))
◆ HAL_RCCEx_LSECSS_Callback()
| __weak void HAL_RCCEx_LSECSS_Callback |
( |
void |
| ) |
|
◆ HAL_RCCEx_LSECSS_IRQHandler()
| void HAL_RCCEx_LSECSS_IRQHandler |
( |
void |
| ) |
|
Handle the RCC LSE Clock Security System interrupt request.
- Return values
-
Definition at line 2373 of file stm32l4xx_hal_rcc_ex.c.
2376 if(__HAL_RCC_GET_IT(RCC_IT_LSECSS))
2382 __HAL_RCC_CLEAR_IT(RCC_IT_LSECSS);
void HAL_RCCEx_LSECSS_Callback(void)
RCCEx LSE Clock Security System interrupt callback.
◆ HAL_RCCEx_StandbyMSIRangeConfig()
| void HAL_RCCEx_StandbyMSIRangeConfig |
( |
uint32_t |
MSIRange | ) |
|
Configure the MSI range after standby mode.
- Note
- After Standby its frequency can be selected between 4 possible values (1, 2, 4 or 8 MHz).
- Parameters
-
| MSIRange | MSI range This parameter can be one of the following values:
- RCC_MSIRANGE_4 Range 4 around 1 MHz
- RCC_MSIRANGE_5 Range 5 around 2 MHz
- RCC_MSIRANGE_6 Range 6 around 4 MHz (reset value)
- RCC_MSIRANGE_7 Range 7 around 8 MHz
|
- Return values
-
Definition at line 2319 of file stm32l4xx_hal_rcc_ex.c.
2321 assert_param(IS_RCC_MSI_STANDBY_CLOCK_RANGE(MSIRange));
2323 __HAL_RCC_MSI_STANDBY_RANGE_CONFIG(MSIRange);
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))
◆ HAL_RCCEx_WakeUpStopCLKConfig()
| void HAL_RCCEx_WakeUpStopCLKConfig |
( |
uint32_t |
WakeUpClk | ) |
|
Configure the oscillator clock source for wakeup from Stop and CSS backup clock.
- Parameters
-
| WakeUpClk | Wakeup clock This parameter can be one of the following values:
- RCC_STOP_WAKEUPCLOCK_MSI MSI oscillator selection
- RCC_STOP_WAKEUPCLOCK_HSI HSI oscillator selection
|
- Note
- This function shall not be called after the Clock Security System on HSE has been enabled.
- Return values
-
Definition at line 2301 of file stm32l4xx_hal_rcc_ex.c.
2305 __HAL_RCC_WAKEUPSTOP_CLK_CONFIG(WakeUpClk);
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))