STM32L4xx_HAL_Driver  1.14.0
Get system and peripherals clocks frequency functions

Return the frequencies of different on chip clocks; System, AHB, APB1 and APB2 buses clocks and different peripheral clocks available on the device. More...

Functions

void LL_RCC_GetSystemClocksFreq (LL_RCC_ClocksTypeDef *RCC_Clocks)
 Return the frequencies of different on chip clocks; System, AHB, APB1 and APB2 buses clocks. More...
 
uint32_t LL_RCC_GetUSARTClockFreq (uint32_t USARTxSource)
 Return USARTx clock frequency. More...
 
uint32_t LL_RCC_GetUARTClockFreq (uint32_t UARTxSource)
 Return UARTx clock frequency. More...
 
uint32_t LL_RCC_GetI2CClockFreq (uint32_t I2CxSource)
 Return I2Cx clock frequency. More...
 
uint32_t LL_RCC_GetLPUARTClockFreq (uint32_t LPUARTxSource)
 Return LPUARTx clock frequency. More...
 
uint32_t LL_RCC_GetLPTIMClockFreq (uint32_t LPTIMxSource)
 Return LPTIMx clock frequency. More...
 
uint32_t LL_RCC_GetSAIClockFreq (uint32_t SAIxSource)
 Return SAIx clock frequency. More...
 
uint32_t LL_RCC_GetSDMMCKernelClockFreq (uint32_t SDMMCxSource)
 Return SDMMCx kernel clock frequency. More...
 
uint32_t LL_RCC_GetSDMMCClockFreq (uint32_t SDMMCxSource)
 Return SDMMCx clock frequency. More...
 
uint32_t LL_RCC_GetRNGClockFreq (uint32_t RNGxSource)
 Return RNGx clock frequency. More...
 
uint32_t LL_RCC_GetUSBClockFreq (uint32_t USBxSource)
 Return USBx clock frequency. More...
 
uint32_t LL_RCC_GetADCClockFreq (uint32_t ADCxSource)
 Return ADCx clock frequency. More...
 
uint32_t LL_RCC_GetSWPMIClockFreq (uint32_t SWPMIxSource)
 Return SWPMIx clock frequency. More...
 
uint32_t LL_RCC_GetDFSDMClockFreq (uint32_t DFSDMxSource)
 Return DFSDMx clock frequency. More...
 
uint32_t LL_RCC_GetDFSDMAudioClockFreq (uint32_t DFSDMxSource)
 Return DFSDMx Audio clock frequency. More...
 
uint32_t LL_RCC_GetLTDCClockFreq (uint32_t LTDCxSource)
 Return LTDC clock frequency. More...
 
uint32_t LL_RCC_GetDSIClockFreq (uint32_t DSIxSource)
 Return DSI clock frequency. More...
 
uint32_t LL_RCC_GetOCTOSPIClockFreq (uint32_t OCTOSPIxSource)
 Return OCTOSPI clock frequency. More...
 

Detailed Description

Return the frequencies of different on chip clocks; System, AHB, APB1 and APB2 buses clocks and different peripheral clocks available on the device.

Note
If SYSCLK source is MSI, function returns values based on MSI_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 HSE_VALUE(***) or HSI_VALUE(**) or MSI_VALUE(*) multiplied/divided by the PLL factors.
(*) MSI_VALUE is a constant defined in this 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 this 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 this file (default value 8 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 incorrect 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.

Function Documentation

◆ LL_RCC_GetADCClockFreq()

uint32_t LL_RCC_GetADCClockFreq ( uint32_t  ADCxSource)

Return ADCx clock frequency.

Parameters
ADCxSourceThis parameter can be one of the following values:
  • LL_RCC_ADC_CLKSOURCE
Return values
ADCclock frequency (in Hz)
  • LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator (MSI) or PLL is not ready
  • LL_RCC_PERIPH_FREQUENCY_NA indicates that no clock source selected

Definition at line 1178 of file stm32l4xx_ll_rcc.c.

1179 {
1180  uint32_t adc_frequency = LL_RCC_PERIPH_FREQUENCY_NO;
1181 
1182  /* Check parameter */
1183  assert_param(IS_LL_RCC_ADC_CLKSOURCE(ADCxSource));
1184 
1185  /* ADCCLK clock frequency */
1186  switch (LL_RCC_GetADCClockSource(ADCxSource))
1187  {
1188 #if defined(RCC_PLLSAI1_SUPPORT)
1189  case LL_RCC_ADC_CLKSOURCE_PLLSAI1: /* PLLSAI1 clock used as ADC clock source */
1190  if (LL_RCC_PLLSAI1_IsReady() != 0U)
1191  {
1192  adc_frequency = RCC_PLLSAI1_GetFreqDomain_ADC();
1193  }
1194  break;
1195 #endif /* RCC_PLLSAI1_SUPPORT */
1196 
1197 #if defined(RCC_PLLSAI2_SUPPORT) && defined(LL_RCC_ADC_CLKSOURCE_PLLSAI2)
1198  case LL_RCC_ADC_CLKSOURCE_PLLSAI2: /* PLLSAI2 clock used as ADC clock source */
1199  if (LL_RCC_PLLSAI2_IsReady() != 0U)
1200  {
1201  adc_frequency = RCC_PLLSAI2_GetFreqDomain_ADC();
1202  }
1203  break;
1204 #endif /* RCC_PLLSAI2_SUPPORT && LL_RCC_ADC_CLKSOURCE_PLLSAI2 */
1205 
1206  case LL_RCC_ADC_CLKSOURCE_SYSCLK: /* SYSCLK clock used as ADC clock source */
1207  adc_frequency = RCC_GetSystemClockFreq();
1208  break;
1209 
1210  case LL_RCC_ADC_CLKSOURCE_NONE: /* No clock used as ADC clock source */
1211  default:
1212  adc_frequency = LL_RCC_PERIPH_FREQUENCY_NA;
1213  break;
1214  }
1215 
1216  return adc_frequency;
1217 }
__STATIC_INLINE uint32_t LL_RCC_PLLSAI2_IsReady(void)
Check if PLLSAI2 Ready CR PLLSAI2RDY LL_RCC_PLLSAI2_IsReady.
__STATIC_INLINE uint32_t LL_RCC_GetADCClockSource(uint32_t ADCx)
Get ADCx clock source CCIPR ADCSEL LL_RCC_GetADCClockSource.
__STATIC_INLINE uint32_t LL_RCC_PLLSAI1_IsReady(void)
Check if PLLSAI1 Ready CR PLLSAI1RDY LL_RCC_PLLSAI1_IsReady.
uint32_t RCC_GetSystemClockFreq(void)
Return SYSTEM clock frequency.
uint32_t RCC_PLLSAI1_GetFreqDomain_ADC(void)
Return PLLSAI1 clock frequency used for ADC domain.
uint32_t RCC_PLLSAI2_GetFreqDomain_ADC(void)
Return PLLSAI2 clock frequency used for ADC domain.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ LL_RCC_GetDFSDMAudioClockFreq()

uint32_t LL_RCC_GetDFSDMAudioClockFreq ( uint32_t  DFSDMxSource)

Return DFSDMx Audio clock frequency.

Parameters
DFSDMxSourceThis parameter can be one of the following values:
  • LL_RCC_DFSDM1_AUDIO_CLKSOURCE
Return values
DFSDMclock frequency (in Hz)
  • LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator is not ready

Definition at line 1296 of file stm32l4xx_ll_rcc.c.

1297 {
1298  uint32_t dfsdm_frequency = LL_RCC_PERIPH_FREQUENCY_NO;
1299 
1300  /* Check parameter */
1301  assert_param(IS_LL_RCC_DFSDM_AUDIO_CLKSOURCE(DFSDMxSource));
1302 
1303  /* DFSDM1CLK clock frequency */
1304  switch (LL_RCC_GetDFSDMAudioClockSource(DFSDMxSource))
1305  {
1306  case LL_RCC_DFSDM1_AUDIO_CLKSOURCE_SAI1: /* SAI1 clock used as DFSDM1 audio clock */
1307  dfsdm_frequency = LL_RCC_GetSAIClockFreq(LL_RCC_SAI1_CLKSOURCE);
1308  break;
1309 
1310  case LL_RCC_DFSDM1_AUDIO_CLKSOURCE_MSI: /* MSI clock used as DFSDM1 audio clock */
1311  if (LL_RCC_MSI_IsReady() != 0U)
1312  {
1313  dfsdm_frequency = __LL_RCC_CALC_MSI_FREQ(LL_RCC_MSI_IsEnabledRangeSelect(),
1314  ((LL_RCC_MSI_IsEnabledRangeSelect() != 0U) ?
1317  }
1318  break;
1319 
1320  case LL_RCC_DFSDM1_AUDIO_CLKSOURCE_HSI: /* HSI clock used as DFSDM1 audio clock */
1321  default:
1322  if (LL_RCC_HSI_IsReady() != 0U)
1323  {
1324  dfsdm_frequency = HSI_VALUE;
1325  }
1326  break;
1327  }
1328 
1329  return dfsdm_frequency;
1330 }
uint32_t LL_RCC_GetSAIClockFreq(uint32_t SAIxSource)
Return SAIx clock frequency.
__STATIC_INLINE uint32_t LL_RCC_HSI_IsReady(void)
Check if HSI clock is ready CR HSIRDY LL_RCC_HSI_IsReady.
__STATIC_INLINE uint32_t LL_RCC_MSI_GetRangeAfterStandby(void)
Get MSI range used after standby CSR MSISRANGE LL_RCC_MSI_GetRangeAfterStandby.
__STATIC_INLINE uint32_t LL_RCC_MSI_IsReady(void)
Check if MSI oscillator Ready CR MSIRDY LL_RCC_MSI_IsReady.
__STATIC_INLINE uint32_t LL_RCC_MSI_IsEnabledRangeSelect(void)
Check if MSI clock range is selected with MSIRANGE register CR MSIRGSEL LL_RCC_MSI_IsEnabledRangeSel...
__STATIC_INLINE uint32_t LL_RCC_MSI_GetRange(void)
Get the Internal Multi Speed oscillator (MSI) clock range in run mode. CR MSIRANGE LL_RCC_MSI_GetRan...
__STATIC_INLINE uint32_t LL_RCC_GetDFSDMAudioClockSource(uint32_t DFSDMx)
Get DFSDM Audio Clock Source CCIPR2 ADFSDM1SEL LL_RCC_GetDFSDMAudioClockSource.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ LL_RCC_GetDFSDMClockFreq()

uint32_t LL_RCC_GetDFSDMClockFreq ( uint32_t  DFSDMxSource)

Return DFSDMx clock frequency.

Parameters
DFSDMxSourceThis parameter can be one of the following values:
  • LL_RCC_DFSDM1_CLKSOURCE
Return values
DFSDMclock frequency (in Hz)

Definition at line 1263 of file stm32l4xx_ll_rcc.c.

1264 {
1265  uint32_t dfsdm_frequency = LL_RCC_PERIPH_FREQUENCY_NO;
1266 
1267  /* Check parameter */
1268  assert_param(IS_LL_RCC_DFSDM_CLKSOURCE(DFSDMxSource));
1269 
1270  /* DFSDM1CLK clock frequency */
1271  switch (LL_RCC_GetDFSDMClockSource(DFSDMxSource))
1272  {
1273  case LL_RCC_DFSDM1_CLKSOURCE_SYSCLK: /* DFSDM1 Clock is SYSCLK */
1274  dfsdm_frequency = RCC_GetSystemClockFreq();
1275  break;
1276 
1277  case LL_RCC_DFSDM1_CLKSOURCE_PCLK2: /* DFSDM1 Clock is PCLK2 */
1279  break;
1280 
1281  default:
1282  break;
1283  }
1284 
1285  return dfsdm_frequency;
1286 }
uint32_t RCC_GetHCLKClockFreq(uint32_t SYSCLK_Frequency)
Return HCLK clock frequency.
__STATIC_INLINE uint32_t LL_RCC_GetDFSDMClockSource(uint32_t DFSDMx)
Get DFSDMx Kernel clock source CCIPR DFSDM1SEL LL_RCC_GetDFSDMClockSource.
uint32_t RCC_GetSystemClockFreq(void)
Return SYSTEM clock frequency.
uint32_t RCC_GetPCLK2ClockFreq(uint32_t HCLK_Frequency)
Return PCLK2 clock frequency.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ LL_RCC_GetDSIClockFreq()

uint32_t LL_RCC_GetDSIClockFreq ( uint32_t  DSIxSource)

Return DSI clock frequency.

Parameters
DSIxSourceThis parameter can be one of the following values:
  • LL_RCC_DSI_CLKSOURCE
Return values
DSIclock frequency (in Hz)
  • LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator is not ready
  • LL_RCC_PERIPH_FREQUENCY_NA indicates that external clock is used

Definition at line 1343 of file stm32l4xx_ll_rcc.c.

1344 {
1345  uint32_t dsi_frequency = LL_RCC_PERIPH_FREQUENCY_NO;
1346 
1347  /* Check parameter */
1348  assert_param(IS_LL_RCC_DSI_CLKSOURCE(DSIxSource));
1349 
1350  /* DSICLK clock frequency */
1351  switch (LL_RCC_GetDSIClockSource(DSIxSource))
1352  {
1353  case LL_RCC_DSI_CLKSOURCE_PLL: /* DSI Clock is PLLSAI2 Osc. */
1354  if (LL_RCC_PLLSAI2_IsReady() != 0U)
1355  {
1356  dsi_frequency = RCC_PLLSAI2_GetFreqDomain_DSI();
1357  }
1358  break;
1359 
1360  case LL_RCC_DSI_CLKSOURCE_PHY: /* DSI Clock is DSI physical clock. */
1361  default:
1362  dsi_frequency = LL_RCC_PERIPH_FREQUENCY_NA;
1363  break;
1364  }
1365 
1366  return dsi_frequency;
1367 }
__STATIC_INLINE uint32_t LL_RCC_PLLSAI2_IsReady(void)
Check if PLLSAI2 Ready CR PLLSAI2RDY LL_RCC_PLLSAI2_IsReady.
__STATIC_INLINE uint32_t LL_RCC_GetDSIClockSource(uint32_t DSIx)
Get DSI Clock Source CCIPR2 DSISEL LL_RCC_GetDSIClockSource.
uint32_t RCC_PLLSAI2_GetFreqDomain_DSI(void)
Return PLL clock frequency used for DSI clock.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ LL_RCC_GetI2CClockFreq()

uint32_t LL_RCC_GetI2CClockFreq ( uint32_t  I2CxSource)

Return I2Cx clock frequency.

Parameters
I2CxSourceThis parameter can be one of the following values:
  • LL_RCC_I2C1_CLKSOURCE
  • LL_RCC_I2C2_CLKSOURCE (*)
  • LL_RCC_I2C3_CLKSOURCE
  • LL_RCC_I2C4_CLKSOURCE (*)
(*) value not defined in all devices.
Return values
I2Cclock frequency (in Hz)
  • LL_RCC_PERIPH_FREQUENCY_NO indicates that HSI oscillator is not ready

Definition at line 563 of file stm32l4xx_ll_rcc.c.

564 {
565  uint32_t i2c_frequency = LL_RCC_PERIPH_FREQUENCY_NO;
566 
567  /* Check parameter */
568  assert_param(IS_LL_RCC_I2C_CLKSOURCE(I2CxSource));
569 
570  if (I2CxSource == LL_RCC_I2C1_CLKSOURCE)
571  {
572  /* I2C1 CLK clock frequency */
573  switch (LL_RCC_GetI2CClockSource(I2CxSource))
574  {
575  case LL_RCC_I2C1_CLKSOURCE_SYSCLK: /* I2C1 Clock is System Clock */
576  i2c_frequency = RCC_GetSystemClockFreq();
577  break;
578 
579  case LL_RCC_I2C1_CLKSOURCE_HSI: /* I2C1 Clock is HSI Osc. */
580  if (LL_RCC_HSI_IsReady() != 0U)
581  {
582  i2c_frequency = HSI_VALUE;
583  }
584  break;
585 
586  case LL_RCC_I2C1_CLKSOURCE_PCLK1: /* I2C1 Clock is PCLK1 */
588  break;
589 
590  default:
591  break;
592  }
593  }
594 #if defined(RCC_CCIPR_I2C2SEL)
595  else if (I2CxSource == LL_RCC_I2C2_CLKSOURCE)
596  {
597  /* I2C2 CLK clock frequency */
598  switch (LL_RCC_GetI2CClockSource(I2CxSource))
599  {
600  case LL_RCC_I2C2_CLKSOURCE_SYSCLK: /* I2C2 Clock is System Clock */
601  i2c_frequency = RCC_GetSystemClockFreq();
602  break;
603 
604  case LL_RCC_I2C2_CLKSOURCE_HSI: /* I2C2 Clock is HSI Osc. */
605  if (LL_RCC_HSI_IsReady() != 0U)
606  {
607  i2c_frequency = HSI_VALUE;
608  }
609  break;
610 
611  case LL_RCC_I2C2_CLKSOURCE_PCLK1: /* I2C2 Clock is PCLK1 */
613  break;
614 
615  default:
616  break;
617  }
618  }
619 #endif /*RCC_CCIPR_I2C2SEL*/
620  else
621  {
622  if (I2CxSource == LL_RCC_I2C3_CLKSOURCE)
623  {
624  /* I2C3 CLK clock frequency */
625  switch (LL_RCC_GetI2CClockSource(I2CxSource))
626  {
627  case LL_RCC_I2C3_CLKSOURCE_SYSCLK: /* I2C3 Clock is System Clock */
628  i2c_frequency = RCC_GetSystemClockFreq();
629  break;
630 
631  case LL_RCC_I2C3_CLKSOURCE_HSI: /* I2C3 Clock is HSI Osc. */
632  if (LL_RCC_HSI_IsReady() != 0U)
633  {
634  i2c_frequency = HSI_VALUE;
635  }
636  break;
637 
638  case LL_RCC_I2C3_CLKSOURCE_PCLK1: /* I2C3 Clock is PCLK1 */
640  break;
641 
642  default:
643  break;
644  }
645  }
646 #if defined(RCC_CCIPR2_I2C4SEL)
647  else
648  {
649  if (I2CxSource == LL_RCC_I2C4_CLKSOURCE)
650  {
651  /* I2C4 CLK clock frequency */
652  switch (LL_RCC_GetI2CClockSource(I2CxSource))
653  {
654  case LL_RCC_I2C4_CLKSOURCE_SYSCLK: /* I2C4 Clock is System Clock */
655  i2c_frequency = RCC_GetSystemClockFreq();
656  break;
657 
658  case LL_RCC_I2C4_CLKSOURCE_HSI: /* I2C4 Clock is HSI Osc. */
659  if (LL_RCC_HSI_IsReady() != 0U)
660  {
661  i2c_frequency = HSI_VALUE;
662  }
663  break;
664 
665  case LL_RCC_I2C4_CLKSOURCE_PCLK1: /* I2C4 Clock is PCLK1 */
667  break;
668 
669  default:
670  break;
671  }
672  }
673  }
674 #endif /*RCC_CCIPR2_I2C4SEL*/
675  }
676 
677  return i2c_frequency;
678 }
uint32_t RCC_GetHCLKClockFreq(uint32_t SYSCLK_Frequency)
Return HCLK clock frequency.
__STATIC_INLINE uint32_t LL_RCC_HSI_IsReady(void)
Check if HSI clock is ready CR HSIRDY LL_RCC_HSI_IsReady.
__STATIC_INLINE uint32_t LL_RCC_GetI2CClockSource(uint32_t I2Cx)
Get I2Cx clock source CCIPR I2CxSEL LL_RCC_GetI2CClockSource.
uint32_t RCC_GetSystemClockFreq(void)
Return SYSTEM clock frequency.
uint32_t RCC_GetPCLK1ClockFreq(uint32_t HCLK_Frequency)
Return PCLK1 clock frequency.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ LL_RCC_GetLPTIMClockFreq()

uint32_t LL_RCC_GetLPTIMClockFreq ( uint32_t  LPTIMxSource)

Return LPTIMx clock frequency.

Parameters
LPTIMxSourceThis parameter can be one of the following values:
  • LL_RCC_LPTIM1_CLKSOURCE
  • LL_RCC_LPTIM2_CLKSOURCE
Return values
LPTIMclock frequency (in Hz)
  • LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator (HSI, LSI or LSE) is not ready

Definition at line 735 of file stm32l4xx_ll_rcc.c.

736 {
737  uint32_t lptim_frequency = LL_RCC_PERIPH_FREQUENCY_NO;
738 
739  /* Check parameter */
740  assert_param(IS_LL_RCC_LPTIM_CLKSOURCE(LPTIMxSource));
741 
742  if (LPTIMxSource == LL_RCC_LPTIM1_CLKSOURCE)
743  {
744  /* LPTIM1CLK clock frequency */
745  switch (LL_RCC_GetLPTIMClockSource(LPTIMxSource))
746  {
747  case LL_RCC_LPTIM1_CLKSOURCE_LSI: /* LPTIM1 Clock is LSI Osc. */
748  if (LL_RCC_LSI_IsReady() != 0U)
749  {
750 #if defined(RCC_CSR_LSIPREDIV)
751  if (LL_RCC_LSI_GetPrediv() == LL_RCC_LSI_PREDIV_128)
752  {
753  lptim_frequency = LSI_VALUE / 128U;
754  }
755  else
756 #endif /* RCC_CSR_LSIPREDIV */
757  {
758  lptim_frequency = LSI_VALUE;
759  }
760  }
761  break;
762 
763  case LL_RCC_LPTIM1_CLKSOURCE_HSI: /* LPTIM1 Clock is HSI Osc. */
764  if (LL_RCC_HSI_IsReady() != 0U)
765  {
766  lptim_frequency = HSI_VALUE;
767  }
768  break;
769 
770  case LL_RCC_LPTIM1_CLKSOURCE_LSE: /* LPTIM1 Clock is LSE Osc. */
771  if (LL_RCC_LSE_IsReady() != 0U)
772  {
773  lptim_frequency = LSE_VALUE;
774  }
775  break;
776 
777  case LL_RCC_LPTIM1_CLKSOURCE_PCLK1: /* LPTIM1 Clock is PCLK1 */
779  break;
780 
781  default:
782  break;
783  }
784  }
785  else
786  {
787  if (LPTIMxSource == LL_RCC_LPTIM2_CLKSOURCE)
788  {
789  /* LPTIM2CLK clock frequency */
790  switch (LL_RCC_GetLPTIMClockSource(LPTIMxSource))
791  {
792  case LL_RCC_LPTIM2_CLKSOURCE_LSI: /* LPTIM2 Clock is LSI Osc. */
793  if (LL_RCC_LSI_IsReady() != 0U)
794  {
795 #if defined(RCC_CSR_LSIPREDIV)
796  if (LL_RCC_LSI_GetPrediv() == LL_RCC_LSI_PREDIV_128)
797  {
798  lptim_frequency = LSI_VALUE / 128U;
799  }
800  else
801 #endif /* RCC_CSR_LSIPREDIV */
802  {
803  lptim_frequency = LSI_VALUE;
804  }
805  }
806  break;
807 
808  case LL_RCC_LPTIM2_CLKSOURCE_HSI: /* LPTIM2 Clock is HSI Osc. */
809  if (LL_RCC_HSI_IsReady() != 0U)
810  {
811  lptim_frequency = HSI_VALUE;
812  }
813  break;
814 
815  case LL_RCC_LPTIM2_CLKSOURCE_LSE: /* LPTIM2 Clock is LSE Osc. */
816  if (LL_RCC_LSE_IsReady() != 0U)
817  {
818  lptim_frequency = LSE_VALUE;
819  }
820  break;
821 
822  case LL_RCC_LPTIM2_CLKSOURCE_PCLK1: /* LPTIM2 Clock is PCLK1 */
824  break;
825 
826  default:
827  break;
828  }
829  }
830  }
831 
832  return lptim_frequency;
833 }
uint32_t RCC_GetHCLKClockFreq(uint32_t SYSCLK_Frequency)
Return HCLK clock frequency.
__STATIC_INLINE uint32_t LL_RCC_HSI_IsReady(void)
Check if HSI clock is ready CR HSIRDY LL_RCC_HSI_IsReady.
__STATIC_INLINE uint32_t LL_RCC_LSI_IsReady(void)
Check if LSI is Ready CSR LSIRDY LL_RCC_LSI_IsReady.
__STATIC_INLINE uint32_t LL_RCC_LSI_GetPrediv(void)
Get LSI division factor CSR LSIPREDIV LL_RCC_LSI_GetPrediv.
__STATIC_INLINE uint32_t LL_RCC_LSE_IsReady(void)
Check if LSE oscillator Ready BDCR LSERDY LL_RCC_LSE_IsReady.
uint32_t RCC_GetSystemClockFreq(void)
Return SYSTEM clock frequency.
uint32_t RCC_GetPCLK1ClockFreq(uint32_t HCLK_Frequency)
Return PCLK1 clock frequency.
__STATIC_INLINE uint32_t LL_RCC_GetLPTIMClockSource(uint32_t LPTIMx)
Get LPTIMx clock source CCIPR LPTIMxSEL LL_RCC_GetLPTIMClockSource.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ LL_RCC_GetLPUARTClockFreq()

uint32_t LL_RCC_GetLPUARTClockFreq ( uint32_t  LPUARTxSource)

Return LPUARTx clock frequency.

Parameters
LPUARTxSourceThis parameter can be one of the following values:
  • LL_RCC_LPUART1_CLKSOURCE
Return values
LPUARTclock frequency (in Hz)
  • LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator (HSI or LSE) is not ready

Definition at line 688 of file stm32l4xx_ll_rcc.c.

689 {
690  uint32_t lpuart_frequency = LL_RCC_PERIPH_FREQUENCY_NO;
691 
692  /* Check parameter */
693  assert_param(IS_LL_RCC_LPUART_CLKSOURCE(LPUARTxSource));
694 
695  /* LPUART1CLK clock frequency */
696  switch (LL_RCC_GetLPUARTClockSource(LPUARTxSource))
697  {
698  case LL_RCC_LPUART1_CLKSOURCE_SYSCLK: /* LPUART1 Clock is System Clock */
699  lpuart_frequency = RCC_GetSystemClockFreq();
700  break;
701 
702  case LL_RCC_LPUART1_CLKSOURCE_HSI: /* LPUART1 Clock is HSI Osc. */
703  if (LL_RCC_HSI_IsReady() != 0U)
704  {
705  lpuart_frequency = HSI_VALUE;
706  }
707  break;
708 
709  case LL_RCC_LPUART1_CLKSOURCE_LSE: /* LPUART1 Clock is LSE Osc. */
710  if (LL_RCC_LSE_IsReady() != 0U)
711  {
712  lpuart_frequency = LSE_VALUE;
713  }
714  break;
715 
716  case LL_RCC_LPUART1_CLKSOURCE_PCLK1: /* LPUART1 Clock is PCLK1 */
718  break;
719 
720  default:
721  break;
722  }
723 
724  return lpuart_frequency;
725 }
uint32_t RCC_GetHCLKClockFreq(uint32_t SYSCLK_Frequency)
Return HCLK clock frequency.
__STATIC_INLINE uint32_t LL_RCC_HSI_IsReady(void)
Check if HSI clock is ready CR HSIRDY LL_RCC_HSI_IsReady.
__STATIC_INLINE uint32_t LL_RCC_LSE_IsReady(void)
Check if LSE oscillator Ready BDCR LSERDY LL_RCC_LSE_IsReady.
uint32_t RCC_GetSystemClockFreq(void)
Return SYSTEM clock frequency.
uint32_t RCC_GetPCLK1ClockFreq(uint32_t HCLK_Frequency)
Return PCLK1 clock frequency.
__STATIC_INLINE uint32_t LL_RCC_GetLPUARTClockSource(uint32_t LPUARTx)
Get LPUARTx clock source CCIPR LPUART1SEL LL_RCC_GetLPUARTClockSource.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ LL_RCC_GetLTDCClockFreq()

uint32_t LL_RCC_GetLTDCClockFreq ( uint32_t  LTDCxSource)

Return LTDC clock frequency.

Parameters
LTDCxSourceThis parameter can be one of the following values:
  • LL_RCC_LTDC_CLKSOURCE
Return values
LTDCclock frequency (in Hz)
  • LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator PLLSAI is not ready

Definition at line 1378 of file stm32l4xx_ll_rcc.c.

1379 {
1380  uint32_t ltdc_frequency = LL_RCC_PERIPH_FREQUENCY_NO;
1381 
1382  /* Check parameter */
1383  assert_param(IS_LL_RCC_LTDC_CLKSOURCE(LTDCxSource));
1384 
1385  if (LL_RCC_PLLSAI2_IsReady() != 0U)
1386  {
1387  ltdc_frequency = RCC_PLLSAI2_GetFreqDomain_LTDC();
1388  }
1389 
1390  return ltdc_frequency;
1391 }
__STATIC_INLINE uint32_t LL_RCC_PLLSAI2_IsReady(void)
Check if PLLSAI2 Ready CR PLLSAI2RDY LL_RCC_PLLSAI2_IsReady.
uint32_t RCC_PLLSAI2_GetFreqDomain_LTDC(void)
Return PLLSAI2 clock frequency used for LTDC domain.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ LL_RCC_GetOCTOSPIClockFreq()

uint32_t LL_RCC_GetOCTOSPIClockFreq ( uint32_t  OCTOSPIxSource)

Return OCTOSPI clock frequency.

Parameters
OCTOSPIxSourceThis parameter can be one of the following values:
  • LL_RCC_OCTOSPI_CLKSOURCE
Return values
OCTOSPIclock frequency (in Hz)
  • LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator PLLSAI is not ready

Definition at line 1402 of file stm32l4xx_ll_rcc.c.

1403 {
1404  uint32_t octospi_frequency = LL_RCC_PERIPH_FREQUENCY_NO;
1405 
1406  /* Check parameter */
1407  assert_param(IS_LL_RCC_OCTOSPI_CLKSOURCE(OCTOSPIxSource));
1408 
1409  /* OCTOSPI clock frequency */
1410  switch (LL_RCC_GetOCTOSPIClockSource(OCTOSPIxSource))
1411  {
1412  case LL_RCC_OCTOSPI_CLKSOURCE_SYSCLK: /* OCTOSPI clock is SYSCLK */
1413  octospi_frequency = RCC_GetSystemClockFreq();
1414  break;
1415 
1416  case LL_RCC_OCTOSPI_CLKSOURCE_MSI: /* MSI clock used as OCTOSPI clock */
1417  if (LL_RCC_MSI_IsReady() != 0U)
1418  {
1419  octospi_frequency = __LL_RCC_CALC_MSI_FREQ(LL_RCC_MSI_IsEnabledRangeSelect(),
1420  ((LL_RCC_MSI_IsEnabledRangeSelect() != 0U) ?
1423  }
1424  break;
1425 
1426  case LL_RCC_OCTOSPI_CLKSOURCE_PLL: /* PLL clock used as OCTOSPI source */
1427  if (LL_RCC_PLL_IsReady() != 0U)
1428  {
1429  octospi_frequency = RCC_PLL_GetFreqDomain_48M();
1430  }
1431  break;
1432 
1433  default:
1434  octospi_frequency = LL_RCC_PERIPH_FREQUENCY_NO;
1435  break;
1436  }
1437 
1438  return octospi_frequency;
1439 }
__STATIC_INLINE uint32_t LL_RCC_MSI_GetRangeAfterStandby(void)
Get MSI range used after standby CSR MSISRANGE LL_RCC_MSI_GetRangeAfterStandby.
uint32_t RCC_PLL_GetFreqDomain_48M(void)
Return PLL clock frequency used for 48 MHz domain.
__STATIC_INLINE uint32_t LL_RCC_GetOCTOSPIClockSource(uint32_t OCTOSPIx)
Get OCTOSPI clock source CCIPR2 OSPISEL LL_RCC_GetOCTOSPIClockSource.
__STATIC_INLINE uint32_t LL_RCC_PLL_IsReady(void)
Check if PLL Ready CR PLLRDY LL_RCC_PLL_IsReady.
__STATIC_INLINE uint32_t LL_RCC_MSI_IsReady(void)
Check if MSI oscillator Ready CR MSIRDY LL_RCC_MSI_IsReady.
__STATIC_INLINE uint32_t LL_RCC_MSI_IsEnabledRangeSelect(void)
Check if MSI clock range is selected with MSIRANGE register CR MSIRGSEL LL_RCC_MSI_IsEnabledRangeSel...
uint32_t RCC_GetSystemClockFreq(void)
Return SYSTEM clock frequency.
__STATIC_INLINE uint32_t LL_RCC_MSI_GetRange(void)
Get the Internal Multi Speed oscillator (MSI) clock range in run mode. CR MSIRANGE LL_RCC_MSI_GetRan...
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ LL_RCC_GetRNGClockFreq()

uint32_t LL_RCC_GetRNGClockFreq ( uint32_t  RNGxSource)

Return RNGx clock frequency.

Parameters
RNGxSourceThis parameter can be one of the following values:
  • LL_RCC_RNG_CLKSOURCE
Return values
RNGclock frequency (in Hz)
  • LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator (MSI) or PLL is not ready
  • LL_RCC_PERIPH_FREQUENCY_NA indicates that no clock source selected

Definition at line 1049 of file stm32l4xx_ll_rcc.c.

1050 {
1051  uint32_t rng_frequency = LL_RCC_PERIPH_FREQUENCY_NO;
1052 
1053  /* Check parameter */
1054  assert_param(IS_LL_RCC_RNG_CLKSOURCE(RNGxSource));
1055 
1056  /* RNGCLK clock frequency */
1057  switch (LL_RCC_GetRNGClockSource(RNGxSource))
1058  {
1059 #if defined(RCC_PLLSAI1_SUPPORT)
1060  case LL_RCC_RNG_CLKSOURCE_PLLSAI1: /* PLLSAI1 clock used as RNG clock source */
1061  if (LL_RCC_PLLSAI1_IsReady() != 0U)
1062  {
1063  rng_frequency = RCC_PLLSAI1_GetFreqDomain_48M();
1064  }
1065  break;
1066 #endif /* RCC_PLLSAI1_SUPPORT */
1067 
1068  case LL_RCC_RNG_CLKSOURCE_PLL: /* PLL clock used as RNG clock source */
1069  if (LL_RCC_PLL_IsReady() != 0U)
1070  {
1071  rng_frequency = RCC_PLL_GetFreqDomain_48M();
1072  }
1073  break;
1074 
1075  case LL_RCC_RNG_CLKSOURCE_MSI: /* MSI clock used as RNG clock source */
1076  if (LL_RCC_MSI_IsReady() != 0U)
1077  {
1078  rng_frequency = __LL_RCC_CALC_MSI_FREQ(LL_RCC_MSI_IsEnabledRangeSelect(),
1079  ((LL_RCC_MSI_IsEnabledRangeSelect() != 0U) ?
1082  }
1083  break;
1084 
1085 
1086 #if defined(RCC_HSI48_SUPPORT)
1087  case LL_RCC_RNG_CLKSOURCE_HSI48: /* HSI48 used as RNG clock source */
1088  if (LL_RCC_HSI48_IsReady() != 0U)
1089  {
1090  rng_frequency = HSI48_VALUE;
1091  }
1092  break;
1093 #else
1094  case LL_RCC_RNG_CLKSOURCE_NONE: /* No clock used as RNG clock source */
1095 #endif
1096  default:
1097  rng_frequency = LL_RCC_PERIPH_FREQUENCY_NA;
1098  break;
1099 
1100  }
1101 
1102  return rng_frequency;
1103 }
__STATIC_INLINE uint32_t LL_RCC_HSI48_IsReady(void)
Check if HSI48 oscillator Ready CRRCR HSI48RDY LL_RCC_HSI48_IsReady.
__STATIC_INLINE uint32_t LL_RCC_MSI_GetRangeAfterStandby(void)
Get MSI range used after standby CSR MSISRANGE LL_RCC_MSI_GetRangeAfterStandby.
uint32_t RCC_PLL_GetFreqDomain_48M(void)
Return PLL clock frequency used for 48 MHz domain.
__STATIC_INLINE uint32_t LL_RCC_PLL_IsReady(void)
Check if PLL Ready CR PLLRDY LL_RCC_PLL_IsReady.
__STATIC_INLINE uint32_t LL_RCC_MSI_IsReady(void)
Check if MSI oscillator Ready CR MSIRDY LL_RCC_MSI_IsReady.
__STATIC_INLINE uint32_t LL_RCC_MSI_IsEnabledRangeSelect(void)
Check if MSI clock range is selected with MSIRANGE register CR MSIRGSEL LL_RCC_MSI_IsEnabledRangeSel...
uint32_t RCC_PLLSAI1_GetFreqDomain_48M(void)
Return PLLSAI1 clock frequency used for 48Mhz domain.
__STATIC_INLINE uint32_t LL_RCC_PLLSAI1_IsReady(void)
Check if PLLSAI1 Ready CR PLLSAI1RDY LL_RCC_PLLSAI1_IsReady.
__STATIC_INLINE uint32_t LL_RCC_MSI_GetRange(void)
Get the Internal Multi Speed oscillator (MSI) clock range in run mode. CR MSIRANGE LL_RCC_MSI_GetRan...
__STATIC_INLINE uint32_t LL_RCC_GetRNGClockSource(uint32_t RNGx)
Get RNGx clock source CCIPR CLK48SEL LL_RCC_GetRNGClockSource.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ LL_RCC_GetSAIClockFreq()

uint32_t LL_RCC_GetSAIClockFreq ( uint32_t  SAIxSource)

Return SAIx clock frequency.

Parameters
SAIxSourceThis parameter can be one of the following values:
  • LL_RCC_SAI1_CLKSOURCE
  • LL_RCC_SAI2_CLKSOURCE (*)
(*) value not defined in all devices.
Return values
SAIclock frequency (in Hz)
  • LL_RCC_PERIPH_FREQUENCY_NO indicates that PLL is not ready

Definition at line 847 of file stm32l4xx_ll_rcc.c.

848 {
849  uint32_t sai_frequency = LL_RCC_PERIPH_FREQUENCY_NO;
850 
851  /* Check parameter */
852  assert_param(IS_LL_RCC_SAI_CLKSOURCE(SAIxSource));
853 
854  if (SAIxSource == LL_RCC_SAI1_CLKSOURCE)
855  {
856  /* SAI1CLK clock frequency */
857  switch (LL_RCC_GetSAIClockSource(SAIxSource))
858  {
859  case LL_RCC_SAI1_CLKSOURCE_PLLSAI1: /* PLLSAI1 clock used as SAI1 clock source */
860  if (LL_RCC_PLLSAI1_IsReady() != 0U)
861  {
862  sai_frequency = RCC_PLLSAI1_GetFreqDomain_SAI();
863  }
864  break;
865 
866 #if defined(RCC_PLLSAI2_SUPPORT)
867  case LL_RCC_SAI1_CLKSOURCE_PLLSAI2: /* PLLSAI2 clock used as SAI1 clock source */
868  if (LL_RCC_PLLSAI2_IsReady() != 0U)
869  {
870  sai_frequency = RCC_PLLSAI2_GetFreqDomain_SAI();
871  }
872  break;
873 
874 #endif /* RCC_PLLSAI2_SUPPORT */
875  case LL_RCC_SAI1_CLKSOURCE_PLL: /* PLL clock used as SAI1 clock source */
876  if (LL_RCC_PLL_IsReady() != 0U)
877  {
878  sai_frequency = RCC_PLL_GetFreqDomain_SAI();
879  }
880  break;
881 
882  case LL_RCC_SAI1_CLKSOURCE_PIN: /* External input clock used as SAI1 clock source */
883  sai_frequency = EXTERNAL_SAI1_CLOCK_VALUE;
884  break;
885 
886  default:
887  break;
888  }
889  }
890  else
891  {
892 #if defined(RCC_CCIPR_SAI2SEL) || defined(RCC_CCIPR2_SAI2SEL)
893  if (SAIxSource == LL_RCC_SAI2_CLKSOURCE)
894  {
895  /* SAI2CLK clock frequency */
896  switch (LL_RCC_GetSAIClockSource(SAIxSource))
897  {
898  case LL_RCC_SAI2_CLKSOURCE_PLLSAI1: /* PLLSAI1 clock used as SAI2 clock source */
899  if (LL_RCC_PLLSAI1_IsReady() != 0U)
900  {
901  sai_frequency = RCC_PLLSAI1_GetFreqDomain_SAI();
902  }
903  break;
904 
905 #if defined(RCC_PLLSAI2_SUPPORT)
906  case LL_RCC_SAI2_CLKSOURCE_PLLSAI2: /* PLLSAI2 clock used as SAI2 clock source */
907  if (LL_RCC_PLLSAI2_IsReady() != 0U)
908  {
909  sai_frequency = RCC_PLLSAI2_GetFreqDomain_SAI();
910  }
911  break;
912 
913 #endif /* RCC_PLLSAI2_SUPPORT */
914  case LL_RCC_SAI2_CLKSOURCE_PLL: /* PLL clock used as SAI2 clock source */
915  if (LL_RCC_PLL_IsReady() != 0U)
916  {
917  sai_frequency = RCC_PLL_GetFreqDomain_SAI();
918  }
919  break;
920 
921  case LL_RCC_SAI2_CLKSOURCE_PIN: /* External input clock used as SAI2 clock source */
922  sai_frequency = EXTERNAL_SAI2_CLOCK_VALUE;
923  break;
924 
925  default:
926  break;
927  }
928  }
929 #endif /* RCC_CCIPR_SAI2SEL || RCC_CCIPR2_SAI2SEL */
930  }
931 
932  return sai_frequency;
933 }
__STATIC_INLINE uint32_t LL_RCC_PLLSAI2_IsReady(void)
Check if PLLSAI2 Ready CR PLLSAI2RDY LL_RCC_PLLSAI2_IsReady.
uint32_t RCC_PLL_GetFreqDomain_SAI(void)
Return PLL clock frequency used for SAI domain.
__STATIC_INLINE uint32_t LL_RCC_PLL_IsReady(void)
Check if PLL Ready CR PLLRDY LL_RCC_PLL_IsReady.
uint32_t RCC_PLLSAI1_GetFreqDomain_SAI(void)
Return PLLSAI1 clock frequency used for SAI domain.
__STATIC_INLINE uint32_t LL_RCC_PLLSAI1_IsReady(void)
Check if PLLSAI1 Ready CR PLLSAI1RDY LL_RCC_PLLSAI1_IsReady.
uint32_t RCC_PLLSAI2_GetFreqDomain_SAI(void)
Return PLLSAI2 clock frequency used for SAI domain.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))
__STATIC_INLINE uint32_t LL_RCC_GetSAIClockSource(uint32_t SAIx)
Get SAIx clock source CCIPR SAIxSEL LL_RCC_GetSAIClockSource.

◆ LL_RCC_GetSDMMCClockFreq()

uint32_t LL_RCC_GetSDMMCClockFreq ( uint32_t  SDMMCxSource)

Return SDMMCx clock frequency.

Parameters
SDMMCxSourceThis parameter can be one of the following values:
  • LL_RCC_SDMMC1_CLKSOURCE
Return values
SDMMCclock frequency (in Hz)
  • LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator (MSI) or PLL is not ready
  • LL_RCC_PERIPH_FREQUENCY_NA indicates that no clock source selected

Definition at line 984 of file stm32l4xx_ll_rcc.c.

985 {
986  uint32_t sdmmc_frequency = LL_RCC_PERIPH_FREQUENCY_NO;
987 
988  /* Check parameter */
989  assert_param(IS_LL_RCC_SDMMC_CLKSOURCE(SDMMCxSource));
990 
991  /* SDMMC1CLK clock frequency */
992  switch (LL_RCC_GetSDMMCClockSource(SDMMCxSource))
993  {
994 #if defined(LL_RCC_SDMMC1_CLKSOURCE_PLLSAI1)
995  case LL_RCC_SDMMC1_CLKSOURCE_PLLSAI1: /* PLLSAI1 clock used as SDMMC1 clock source */
996  if (LL_RCC_PLLSAI1_IsReady() != 0U)
997  {
998  sdmmc_frequency = RCC_PLLSAI1_GetFreqDomain_48M();
999  }
1000  break;
1001 #endif
1002 
1003  case LL_RCC_SDMMC1_CLKSOURCE_PLL: /* PLL clock used as SDMMC1 clock source */
1004  if (LL_RCC_PLL_IsReady() != 0U)
1005  {
1006  sdmmc_frequency = RCC_PLL_GetFreqDomain_48M();
1007  }
1008  break;
1009 
1010 #if defined(LL_RCC_SDMMC1_CLKSOURCE_MSI)
1011  case LL_RCC_SDMMC1_CLKSOURCE_MSI: /* MSI clock used as SDMMC1 clock source */
1012  if (LL_RCC_MSI_IsReady() != 0U)
1013  {
1014  sdmmc_frequency = __LL_RCC_CALC_MSI_FREQ(LL_RCC_MSI_IsEnabledRangeSelect(),
1015  ((LL_RCC_MSI_IsEnabledRangeSelect() != 0U) ?
1018  }
1019  break;
1020 #endif
1021 
1022 #if defined(RCC_HSI48_SUPPORT)
1023  case LL_RCC_SDMMC1_CLKSOURCE_HSI48: /* HSI48 used as SDMMC1 clock source */
1024  if (LL_RCC_HSI48_IsReady() != 0U)
1025  {
1026  sdmmc_frequency = HSI48_VALUE;
1027  }
1028  break;
1029 #else
1030  case LL_RCC_SDMMC1_CLKSOURCE_NONE: /* No clock used as SDMMC1 clock source */
1031 #endif
1032  default:
1033  sdmmc_frequency = LL_RCC_PERIPH_FREQUENCY_NA;
1034  break;
1035  }
1036 
1037  return sdmmc_frequency;
1038 }
__STATIC_INLINE uint32_t LL_RCC_HSI48_IsReady(void)
Check if HSI48 oscillator Ready CRRCR HSI48RDY LL_RCC_HSI48_IsReady.
__STATIC_INLINE uint32_t LL_RCC_MSI_GetRangeAfterStandby(void)
Get MSI range used after standby CSR MSISRANGE LL_RCC_MSI_GetRangeAfterStandby.
uint32_t RCC_PLL_GetFreqDomain_48M(void)
Return PLL clock frequency used for 48 MHz domain.
__STATIC_INLINE uint32_t LL_RCC_GetSDMMCClockSource(uint32_t SDMMCx)
Get SDMMCx clock source CCIPR CLK48SEL LL_RCC_GetSDMMCClockSource.
__STATIC_INLINE uint32_t LL_RCC_PLL_IsReady(void)
Check if PLL Ready CR PLLRDY LL_RCC_PLL_IsReady.
__STATIC_INLINE uint32_t LL_RCC_MSI_IsReady(void)
Check if MSI oscillator Ready CR MSIRDY LL_RCC_MSI_IsReady.
__STATIC_INLINE uint32_t LL_RCC_MSI_IsEnabledRangeSelect(void)
Check if MSI clock range is selected with MSIRANGE register CR MSIRGSEL LL_RCC_MSI_IsEnabledRangeSel...
uint32_t RCC_PLLSAI1_GetFreqDomain_48M(void)
Return PLLSAI1 clock frequency used for 48Mhz domain.
__STATIC_INLINE uint32_t LL_RCC_PLLSAI1_IsReady(void)
Check if PLLSAI1 Ready CR PLLSAI1RDY LL_RCC_PLLSAI1_IsReady.
__STATIC_INLINE uint32_t LL_RCC_MSI_GetRange(void)
Get the Internal Multi Speed oscillator (MSI) clock range in run mode. CR MSIRANGE LL_RCC_MSI_GetRan...
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ LL_RCC_GetSDMMCKernelClockFreq()

uint32_t LL_RCC_GetSDMMCKernelClockFreq ( uint32_t  SDMMCxSource)

Return SDMMCx kernel clock frequency.

Parameters
SDMMCxSourceThis parameter can be one of the following values:
  • LL_RCC_SDMMC1_KERNELCLKSOURCE
Return values
SDMMCclock frequency (in Hz)
  • LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator (MSI) or PLL is not ready
  • LL_RCC_PERIPH_FREQUENCY_NA indicates that no clock source selected

Definition at line 946 of file stm32l4xx_ll_rcc.c.

947 {
948  uint32_t sdmmc_frequency = LL_RCC_PERIPH_FREQUENCY_NO;
949 
950  /* Check parameter */
951  assert_param(IS_LL_RCC_SDMMC_KERNELCLKSOURCE(SDMMCxSource));
952 
953  /* SDMMC1CLK kernel clock frequency */
954  switch (LL_RCC_GetSDMMCKernelClockSource(SDMMCxSource))
955  {
956  case LL_RCC_SDMMC1_KERNELCLKSOURCE_48CLK: /* 48MHz clock from internal multiplexor used as SDMMC1 clock source */
957  sdmmc_frequency = LL_RCC_GetSDMMCClockFreq(LL_RCC_SDMMC1_CLKSOURCE);
958  break;
959 
960  case LL_RCC_SDMMC1_KERNELCLKSOURCE_PLLP: /* PLL "P" output (PLLSAI3CLK) clock used as SDMMC1 clock source */
961  if (LL_RCC_PLL_IsReady() != 0U)
962  {
963  sdmmc_frequency = RCC_PLL_GetFreqDomain_SAI();
964  }
965  break;
966 
967  default:
968  sdmmc_frequency = LL_RCC_PERIPH_FREQUENCY_NA;
969  break;
970  }
971 
972  return sdmmc_frequency;
973 }
uint32_t RCC_PLL_GetFreqDomain_SAI(void)
Return PLL clock frequency used for SAI domain.
__STATIC_INLINE uint32_t LL_RCC_PLL_IsReady(void)
Check if PLL Ready CR PLLRDY LL_RCC_PLL_IsReady.
__STATIC_INLINE uint32_t LL_RCC_GetSDMMCKernelClockSource(uint32_t SDMMCx)
Get SDMMCx kernel clock source CCIPR2 SDMMCSEL LL_RCC_GetSDMMCKernelClockSource. ...
uint32_t LL_RCC_GetSDMMCClockFreq(uint32_t SDMMCxSource)
Return SDMMCx clock frequency.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ LL_RCC_GetSWPMIClockFreq()

uint32_t LL_RCC_GetSWPMIClockFreq ( uint32_t  SWPMIxSource)

Return SWPMIx clock frequency.

Parameters
SWPMIxSourceThis parameter can be one of the following values:
  • LL_RCC_SWPMI1_CLKSOURCE
Return values
SWPMIclock frequency (in Hz)
  • LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator (HSI) is not ready

Definition at line 1227 of file stm32l4xx_ll_rcc.c.

1228 {
1229  uint32_t swpmi_frequency = LL_RCC_PERIPH_FREQUENCY_NO;
1230 
1231  /* Check parameter */
1232  assert_param(IS_LL_RCC_SWPMI_CLKSOURCE(SWPMIxSource));
1233 
1234  /* SWPMI1CLK clock frequency */
1235  switch (LL_RCC_GetSWPMIClockSource(SWPMIxSource))
1236  {
1237  case LL_RCC_SWPMI1_CLKSOURCE_HSI: /* SWPMI1 Clock is HSI Osc. */
1238  if (LL_RCC_HSI_IsReady())
1239  {
1240  swpmi_frequency = HSI_VALUE;
1241  }
1242  break;
1243 
1244  case LL_RCC_SWPMI1_CLKSOURCE_PCLK1: /* SWPMI1 Clock is PCLK1 */
1246  break;
1247 
1248  default:
1249  break;
1250  }
1251 
1252  return swpmi_frequency;
1253 }
uint32_t RCC_GetHCLKClockFreq(uint32_t SYSCLK_Frequency)
Return HCLK clock frequency.
__STATIC_INLINE uint32_t LL_RCC_HSI_IsReady(void)
Check if HSI clock is ready CR HSIRDY LL_RCC_HSI_IsReady.
uint32_t RCC_GetSystemClockFreq(void)
Return SYSTEM clock frequency.
uint32_t RCC_GetPCLK1ClockFreq(uint32_t HCLK_Frequency)
Return PCLK1 clock frequency.
__STATIC_INLINE uint32_t LL_RCC_GetSWPMIClockSource(uint32_t SPWMIx)
Get SWPMIx clock source CCIPR SWPMI1SEL LL_RCC_GetSWPMIClockSource.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ LL_RCC_GetSystemClocksFreq()

void LL_RCC_GetSystemClocksFreq ( LL_RCC_ClocksTypeDef RCC_Clocks)

Return the frequencies of different on chip clocks; System, AHB, APB1 and APB2 buses clocks.

Note
Each time SYSCLK, HCLK, PCLK1 and/or PCLK2 clock changes, this function must be called to update structure fields. Otherwise, any configuration based on this function will be incorrect.
Parameters
RCC_Clockspointer to a LL_RCC_ClocksTypeDef structure which will hold the clocks frequencies
Return values
None

Definition at line 329 of file stm32l4xx_ll_rcc.c.

330 {
331  /* Get SYSCLK frequency */
333 
334  /* HCLK clock frequency */
335  RCC_Clocks->HCLK_Frequency = RCC_GetHCLKClockFreq(RCC_Clocks->SYSCLK_Frequency);
336 
337  /* PCLK1 clock frequency */
338  RCC_Clocks->PCLK1_Frequency = RCC_GetPCLK1ClockFreq(RCC_Clocks->HCLK_Frequency);
339 
340  /* PCLK2 clock frequency */
341  RCC_Clocks->PCLK2_Frequency = RCC_GetPCLK2ClockFreq(RCC_Clocks->HCLK_Frequency);
342 }
uint32_t RCC_GetHCLKClockFreq(uint32_t SYSCLK_Frequency)
Return HCLK clock frequency.
uint32_t RCC_GetSystemClockFreq(void)
Return SYSTEM clock frequency.
uint32_t RCC_GetPCLK1ClockFreq(uint32_t HCLK_Frequency)
Return PCLK1 clock frequency.
uint32_t RCC_GetPCLK2ClockFreq(uint32_t HCLK_Frequency)
Return PCLK2 clock frequency.

◆ LL_RCC_GetUARTClockFreq()

uint32_t LL_RCC_GetUARTClockFreq ( uint32_t  UARTxSource)

Return UARTx clock frequency.

Parameters
UARTxSourceThis parameter can be one of the following values:
  • LL_RCC_UART4_CLKSOURCE
  • LL_RCC_UART5_CLKSOURCE
Return values
UARTclock frequency (in Hz)
  • LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator (HSI or LSE) is not ready

Definition at line 472 of file stm32l4xx_ll_rcc.c.

473 {
474  uint32_t uart_frequency = LL_RCC_PERIPH_FREQUENCY_NO;
475 
476  /* Check parameter */
477  assert_param(IS_LL_RCC_UART_CLKSOURCE(UARTxSource));
478 
479 #if defined(RCC_CCIPR_UART4SEL)
480  if (UARTxSource == LL_RCC_UART4_CLKSOURCE)
481  {
482  /* UART4CLK clock frequency */
483  switch (LL_RCC_GetUARTClockSource(UARTxSource))
484  {
485  case LL_RCC_UART4_CLKSOURCE_SYSCLK: /* UART4 Clock is System Clock */
486  uart_frequency = RCC_GetSystemClockFreq();
487  break;
488 
489  case LL_RCC_UART4_CLKSOURCE_HSI: /* UART4 Clock is HSI Osc. */
490  if (LL_RCC_HSI_IsReady() != 0U)
491  {
492  uart_frequency = HSI_VALUE;
493  }
494  break;
495 
496  case LL_RCC_UART4_CLKSOURCE_LSE: /* UART4 Clock is LSE Osc. */
497  if (LL_RCC_LSE_IsReady() != 0U)
498  {
499  uart_frequency = LSE_VALUE;
500  }
501  break;
502 
503  case LL_RCC_UART4_CLKSOURCE_PCLK1: /* UART4 Clock is PCLK1 */
505  break;
506 
507  default:
508  break;
509  }
510  }
511 #endif /* RCC_CCIPR_UART4SEL */
512 
513 #if defined(RCC_CCIPR_UART5SEL)
514  if (UARTxSource == LL_RCC_UART5_CLKSOURCE)
515  {
516  /* UART5CLK clock frequency */
517  switch (LL_RCC_GetUARTClockSource(UARTxSource))
518  {
519  case LL_RCC_UART5_CLKSOURCE_SYSCLK: /* UART5 Clock is System Clock */
520  uart_frequency = RCC_GetSystemClockFreq();
521  break;
522 
523  case LL_RCC_UART5_CLKSOURCE_HSI: /* UART5 Clock is HSI Osc. */
524  if (LL_RCC_HSI_IsReady() != 0U)
525  {
526  uart_frequency = HSI_VALUE;
527  }
528  break;
529 
530  case LL_RCC_UART5_CLKSOURCE_LSE: /* UART5 Clock is LSE Osc. */
531  if (LL_RCC_LSE_IsReady() != 0U)
532  {
533  uart_frequency = LSE_VALUE;
534  }
535  break;
536 
537  case LL_RCC_UART5_CLKSOURCE_PCLK1: /* UART5 Clock is PCLK1 */
539  break;
540 
541  default:
542  break;
543  }
544  }
545 #endif /* RCC_CCIPR_UART5SEL */
546 
547  return uart_frequency;
548 }
uint32_t RCC_GetHCLKClockFreq(uint32_t SYSCLK_Frequency)
Return HCLK clock frequency.
__STATIC_INLINE uint32_t LL_RCC_HSI_IsReady(void)
Check if HSI clock is ready CR HSIRDY LL_RCC_HSI_IsReady.
__STATIC_INLINE uint32_t LL_RCC_GetUARTClockSource(uint32_t UARTx)
Get UARTx clock source CCIPR UARTxSEL LL_RCC_GetUARTClockSource.
__STATIC_INLINE uint32_t LL_RCC_LSE_IsReady(void)
Check if LSE oscillator Ready BDCR LSERDY LL_RCC_LSE_IsReady.
uint32_t RCC_GetSystemClockFreq(void)
Return SYSTEM clock frequency.
uint32_t RCC_GetPCLK1ClockFreq(uint32_t HCLK_Frequency)
Return PCLK1 clock frequency.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ LL_RCC_GetUSARTClockFreq()

uint32_t LL_RCC_GetUSARTClockFreq ( uint32_t  USARTxSource)

Return USARTx clock frequency.

Parameters
USARTxSourceThis parameter can be one of the following values:
  • LL_RCC_USART1_CLKSOURCE
  • LL_RCC_USART2_CLKSOURCE
  • LL_RCC_USART3_CLKSOURCE (*)
(*) value not defined in all devices.
Return values
USARTclock frequency (in Hz)
  • LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator (HSI or LSE) is not ready

Definition at line 355 of file stm32l4xx_ll_rcc.c.

356 {
357  uint32_t usart_frequency = LL_RCC_PERIPH_FREQUENCY_NO;
358 
359  /* Check parameter */
360  assert_param(IS_LL_RCC_USART_CLKSOURCE(USARTxSource));
361 
362  if (USARTxSource == LL_RCC_USART1_CLKSOURCE)
363  {
364  /* USART1CLK clock frequency */
365  switch (LL_RCC_GetUSARTClockSource(USARTxSource))
366  {
367  case LL_RCC_USART1_CLKSOURCE_SYSCLK: /* USART1 Clock is System Clock */
368  usart_frequency = RCC_GetSystemClockFreq();
369  break;
370 
371  case LL_RCC_USART1_CLKSOURCE_HSI: /* USART1 Clock is HSI Osc. */
372  if (LL_RCC_HSI_IsReady() != 0U)
373  {
374  usart_frequency = HSI_VALUE;
375  }
376  break;
377 
378  case LL_RCC_USART1_CLKSOURCE_LSE: /* USART1 Clock is LSE Osc. */
379  if (LL_RCC_LSE_IsReady() != 0U)
380  {
381  usart_frequency = LSE_VALUE;
382  }
383  break;
384 
385  case LL_RCC_USART1_CLKSOURCE_PCLK2: /* USART1 Clock is PCLK2 */
387  break;
388 
389  default:
390  break;
391  }
392  }
393  else if (USARTxSource == LL_RCC_USART2_CLKSOURCE)
394  {
395  /* USART2CLK clock frequency */
396  switch (LL_RCC_GetUSARTClockSource(USARTxSource))
397  {
398  case LL_RCC_USART2_CLKSOURCE_SYSCLK: /* USART2 Clock is System Clock */
399  usart_frequency = RCC_GetSystemClockFreq();
400  break;
401 
402  case LL_RCC_USART2_CLKSOURCE_HSI: /* USART2 Clock is HSI Osc. */
403  if (LL_RCC_HSI_IsReady() != 0U)
404  {
405  usart_frequency = HSI_VALUE;
406  }
407  break;
408 
409  case LL_RCC_USART2_CLKSOURCE_LSE: /* USART2 Clock is LSE Osc. */
410  if (LL_RCC_LSE_IsReady() != 0U)
411  {
412  usart_frequency = LSE_VALUE;
413  }
414  break;
415 
416  case LL_RCC_USART2_CLKSOURCE_PCLK1: /* USART2 Clock is PCLK1 */
418  break;
419 
420  default:
421  break;
422  }
423  }
424  else
425  {
426 #if defined(RCC_CCIPR_USART3SEL)
427  if (USARTxSource == LL_RCC_USART3_CLKSOURCE)
428  {
429  /* USART3CLK clock frequency */
430  switch (LL_RCC_GetUSARTClockSource(USARTxSource))
431  {
432  case LL_RCC_USART3_CLKSOURCE_SYSCLK: /* USART3 Clock is System Clock */
433  usart_frequency = RCC_GetSystemClockFreq();
434  break;
435 
436  case LL_RCC_USART3_CLKSOURCE_HSI: /* USART3 Clock is HSI Osc. */
437  if (LL_RCC_HSI_IsReady() != 0U)
438  {
439  usart_frequency = HSI_VALUE;
440  }
441  break;
442 
443  case LL_RCC_USART3_CLKSOURCE_LSE: /* USART3 Clock is LSE Osc. */
444  if (LL_RCC_LSE_IsReady() != 0U)
445  {
446  usart_frequency = LSE_VALUE;
447  }
448  break;
449 
450  case LL_RCC_USART3_CLKSOURCE_PCLK1: /* USART3 Clock is PCLK1 */
452  break;
453 
454  default:
455  break;
456  }
457  }
458 #endif /* RCC_CCIPR_USART3SEL */
459  }
460  return usart_frequency;
461 }
uint32_t RCC_GetHCLKClockFreq(uint32_t SYSCLK_Frequency)
Return HCLK clock frequency.
__STATIC_INLINE uint32_t LL_RCC_HSI_IsReady(void)
Check if HSI clock is ready CR HSIRDY LL_RCC_HSI_IsReady.
__STATIC_INLINE uint32_t LL_RCC_LSE_IsReady(void)
Check if LSE oscillator Ready BDCR LSERDY LL_RCC_LSE_IsReady.
__STATIC_INLINE uint32_t LL_RCC_GetUSARTClockSource(uint32_t USARTx)
Get USARTx clock source CCIPR USARTxSEL LL_RCC_GetUSARTClockSource.
uint32_t RCC_GetSystemClockFreq(void)
Return SYSTEM clock frequency.
uint32_t RCC_GetPCLK1ClockFreq(uint32_t HCLK_Frequency)
Return PCLK1 clock frequency.
uint32_t RCC_GetPCLK2ClockFreq(uint32_t HCLK_Frequency)
Return PCLK2 clock frequency.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ LL_RCC_GetUSBClockFreq()

uint32_t LL_RCC_GetUSBClockFreq ( uint32_t  USBxSource)

Return USBx clock frequency.

Parameters
USBxSourceThis parameter can be one of the following values:
  • LL_RCC_USB_CLKSOURCE
Return values
USBclock frequency (in Hz)
  • LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator (MSI) or PLL is not ready
  • LL_RCC_PERIPH_FREQUENCY_NA indicates that no clock source selected

Definition at line 1115 of file stm32l4xx_ll_rcc.c.

1116 {
1117  uint32_t usb_frequency = LL_RCC_PERIPH_FREQUENCY_NO;
1118 
1119  /* Check parameter */
1120  assert_param(IS_LL_RCC_USB_CLKSOURCE(USBxSource));
1121 
1122  /* USBCLK clock frequency */
1123  switch (LL_RCC_GetUSBClockSource(USBxSource))
1124  {
1125 #if defined(RCC_PLLSAI1_SUPPORT)
1126  case LL_RCC_USB_CLKSOURCE_PLLSAI1: /* PLLSAI1 clock used as USB clock source */
1127  if (LL_RCC_PLLSAI1_IsReady() != 0U)
1128  {
1129  usb_frequency = RCC_PLLSAI1_GetFreqDomain_48M();
1130  }
1131  break;
1132 #endif /* RCC_PLLSAI1_SUPPORT */
1133 
1134  case LL_RCC_USB_CLKSOURCE_PLL: /* PLL clock used as USB clock source */
1135  if (LL_RCC_PLL_IsReady() != 0U)
1136  {
1137  usb_frequency = RCC_PLL_GetFreqDomain_48M();
1138  }
1139  break;
1140 
1141  case LL_RCC_USB_CLKSOURCE_MSI: /* MSI clock used as USB clock source */
1142  if (LL_RCC_MSI_IsReady() != 0U)
1143  {
1144  usb_frequency = __LL_RCC_CALC_MSI_FREQ(LL_RCC_MSI_IsEnabledRangeSelect(),
1145  ((LL_RCC_MSI_IsEnabledRangeSelect() != 0U) ?
1148  }
1149  break;
1150 
1151 #if defined(RCC_HSI48_SUPPORT)
1152  case LL_RCC_USB_CLKSOURCE_HSI48: /* HSI48 used as USB clock source */
1153  if (LL_RCC_HSI48_IsReady() != 0U)
1154  {
1155  usb_frequency = HSI48_VALUE;
1156  }
1157  break;
1158 #else
1159  case LL_RCC_USB_CLKSOURCE_NONE: /* No clock used as USB clock source */
1160 #endif
1161  default:
1162  usb_frequency = LL_RCC_PERIPH_FREQUENCY_NA;
1163  break;
1164  }
1165 
1166  return usb_frequency;
1167 }
__STATIC_INLINE uint32_t LL_RCC_HSI48_IsReady(void)
Check if HSI48 oscillator Ready CRRCR HSI48RDY LL_RCC_HSI48_IsReady.
__STATIC_INLINE uint32_t LL_RCC_MSI_GetRangeAfterStandby(void)
Get MSI range used after standby CSR MSISRANGE LL_RCC_MSI_GetRangeAfterStandby.
uint32_t RCC_PLL_GetFreqDomain_48M(void)
Return PLL clock frequency used for 48 MHz domain.
__STATIC_INLINE uint32_t LL_RCC_PLL_IsReady(void)
Check if PLL Ready CR PLLRDY LL_RCC_PLL_IsReady.
__STATIC_INLINE uint32_t LL_RCC_MSI_IsReady(void)
Check if MSI oscillator Ready CR MSIRDY LL_RCC_MSI_IsReady.
__STATIC_INLINE uint32_t LL_RCC_MSI_IsEnabledRangeSelect(void)
Check if MSI clock range is selected with MSIRANGE register CR MSIRGSEL LL_RCC_MSI_IsEnabledRangeSel...
uint32_t RCC_PLLSAI1_GetFreqDomain_48M(void)
Return PLLSAI1 clock frequency used for 48Mhz domain.
__STATIC_INLINE uint32_t LL_RCC_PLLSAI1_IsReady(void)
Check if PLLSAI1 Ready CR PLLSAI1RDY LL_RCC_PLLSAI1_IsReady.
__STATIC_INLINE uint32_t LL_RCC_MSI_GetRange(void)
Get the Internal Multi Speed oscillator (MSI) clock range in run mode. CR MSIRANGE LL_RCC_MSI_GetRan...
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))
__STATIC_INLINE uint32_t LL_RCC_GetUSBClockSource(uint32_t USBx)
Get USBx clock source CCIPR CLK48SEL LL_RCC_GetUSBClockSource.