78#ifdef HAL_RCC_MODULE_ENABLED
86#define MCO1_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
87#define MCO1_GPIO_PORT GPIOA
88#define MCO1_PIN GPIO_PIN_8
90#define MCO2_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
91#define MCO2_GPIO_PORT GPIOC
92#define MCO2_PIN GPIO_PIN_9
312#if defined(RCC_D1CFGR_HPRE)
356#if defined(RCC_CR_HSEEXT)
408 uint32_t temp1_pllckcfg, temp2_pllckcfg;
411 if (RCC_OscInitStruct ==
NULL)
425 const uint32_t temp_pllckselr =
RCC->PLLCKSELR;
479 const uint32_t temp_pllckselr =
RCC->PLLCKSELR;
560 const uint32_t temp_pllckselr =
RCC->PLLCKSELR;
858 temp1_pllckcfg =
RCC->PLLCKSELR;
859 temp2_pllckcfg =
RCC->PLL1DIVR;
874 if (RCC_OscInitStruct->
PLL.
PLLFRACN != temp1_pllckcfg)
926 uint32_t common_system_clock;
929 if (RCC_ClkInitStruct ==
NULL)
961#if defined (RCC_D1CFGR_D1PPRE)
979#if defined (RCC_D2CFGR_D2PPRE1)
996#if defined(RCC_D2CFGR_D2PPRE2)
1014#if defined(RCC_D3CFGR_D3PPRE)
1032#if defined (RCC_D1CFGR_HPRE)
1040 if ((RCC_ClkInitStruct->
AHBCLKDivider) > (
RCC->CDCFGR1 & RCC_CDCFGR1_HPRE))
1054#if defined(RCC_D1CFGR_D1CPRE)
1114#if defined(RCC_D1CFGR_HPRE)
1122 if ((RCC_ClkInitStruct->
AHBCLKDivider) < (
RCC->CDCFGR1 & RCC_CDCFGR1_HPRE))
1148#if defined(RCC_D1CFGR_D1PPRE)
1166#if defined(RCC_D2CFGR_D2PPRE1)
1184#if defined (RCC_D2CFGR_D2PPRE2)
1202#if defined(RCC_D3CFGR_D3PPRE)
1218#if defined(RCC_D1CFGR_D1CPRE)
1224#if defined(RCC_D1CFGR_HPRE)
1230#if defined(DUAL_CORE) && defined(CORE_CM4)
1286void HAL_RCC_MCOConfig(uint32_t RCC_MCOx, uint32_t RCC_MCOSource, uint32_t RCC_MCODiv)
1301 GPIO_InitStruct.
Pin = MCO1_PIN;
1319 GPIO_InitStruct.
Pin = MCO2_PIN;
1390 uint32_t pllp, pllsource, pllm, pllfracen, hsivalue;
1391 float_t fracn1, pllvco;
1392 uint32_t sysclockfreq;
1438 pllvco = ((float_t)hsivalue / (float_t)pllm) * ((float_t)(uint32_t)(
RCC->PLL1DIVR &
RCC_PLL1DIVR_N1) + (fracn1 / (float_t)0x2000) + (float_t)1);
1442 pllvco = ((float_t)
HSI_VALUE / (float_t)pllm) * ((float_t)(uint32_t)(
RCC->PLL1DIVR &
RCC_PLL1DIVR_N1) + (fracn1 / (float_t)0x2000) + (float_t)1);
1447 pllvco = ((float_t)
CSI_VALUE / (float_t)pllm) * ((float_t)(uint32_t)(
RCC->PLL1DIVR &
RCC_PLL1DIVR_N1) + (fracn1 / (float_t)0x2000) + (float_t)1);
1451 pllvco = ((float_t)
HSE_VALUE / (float_t)pllm) * ((float_t)(uint32_t)(
RCC->PLL1DIVR &
RCC_PLL1DIVR_N1) + (fracn1 / (float_t)0x2000) + (float_t)1);
1455 pllvco = ((float_t)
CSI_VALUE / (float_t)pllm) * ((float_t)(uint32_t)(
RCC->PLL1DIVR &
RCC_PLL1DIVR_N1) + (fracn1 / (float_t)0x2000) + (float_t)1);
1459 sysclockfreq = (uint32_t)(float_t)(pllvco / (float_t)pllp);
1472 return sysclockfreq;
1487 uint32_t common_system_clock;
1489#if defined(RCC_D1CFGR_D1CPRE)
1495#if defined(RCC_D1CFGR_HPRE)
1501#if defined(DUAL_CORE) && defined(CORE_CM4)
1519#if defined (RCC_D2CFGR_D2PPRE1)
1538#if defined(RCC_D2CFGR_D2PPRE2)
1559#if defined(RCC_CR_HSEEXT)
1566 RCC_OscInitStruct->
HSEState = RCC_HSE_BYPASS_DIGITAL;
1601#if defined(RCC_VER_X)
1624#if defined(RCC_VER_X)
1638#if defined(RCC_BDCR_LSEEXT)
1645 RCC_OscInitStruct->
LSEState = RCC_LSE_BYPASS_DIGITAL;
1727#if defined(RCC_D1CFGR_D1CPRE)
1747 RCC_ClkInitStruct->
SYSCLKDivider = (uint32_t)(
RCC->CDCFGR1 & RCC_CDCFGR1_CDCPRE);
1750 RCC_ClkInitStruct->
AHBCLKDivider = (uint32_t)(
RCC->CDCFGR1 & RCC_CDCFGR1_HPRE);
1753 RCC_ClkInitStruct->
APB3CLKDivider = (uint32_t)(
RCC->CDCFGR1 & RCC_CDCFGR1_CDPPRE);
1756 RCC_ClkInitStruct->
APB1CLKDivider = (uint32_t)(
RCC->CDCFGR2 & RCC_CDCFGR2_CDPPRE1);
1759 RCC_ClkInitStruct->
APB2CLKDivider = (uint32_t)(
RCC->CDCFGR2 & RCC_CDCFGR2_CDPPRE2);
1762 RCC_ClkInitStruct->
APB4CLKDivider = (uint32_t)(
RCC->SRDCFGR & RCC_SRDCFGR_SRDPPRE);
#define CLEAR_BIT(REG, BIT)
#define SET_BIT(REG, BIT)
#define WRITE_REG(REG, VAL)
#define MODIFY_REG(REG, CLEARMASK, SETMASK)
#define READ_BIT(REG, BIT)
#define IS_FLASH_LATENCY(LATENCY)
#define __HAL_FLASH_GET_LATENCY()
Get the FLASH Latency.
#define __HAL_FLASH_SET_LATENCY(__LATENCY__)
Set the FLASH Latency.
void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, const GPIO_InitTypeDef *GPIO_Init)
#define GPIO_MODE_AF_PP
Alternate Function Push Pull Mode.
#define GPIO_NOPULL
No Pull-up or Pull-down activation.
#define GPIO_SPEED_FREQ_VERY_HIGH
High speed.
uint32_t HAL_GetREVID(void)
Returns the device revision identifier.
uint32_t HAL_GetTick(void)
Provides a tick value in millisecond.
#define RCC_CFGR_MCO2
0xE0000000
#define PWR_CR1_DBP
Disable Back-up domain Protection.
#define RCC_PLLCKSELR_DIVM3_5
0x02000000
#define RCC_CFGR_SW
SW[2:0] bits (System clock Switch).
#define RCC_PLL1DIVR_R1_Pos
#define RCC_D1CFGR_D1PPRE
D1PRE[2:0] bits (APB3 prescaler).
#define RCC_CFGR_SWS
SWS[2:0] bits (System Clock Switch Status).
#define RCC_PLLCKSELR_PLLSRC_CSI
CSI source clock selected.
#define RCC_CR_HSIDIV
Internal High Speed clock divider selection.
#define RCC_HSICFGR_HSITRIM_Pos
#define RCC_CFGR_MCO1PRE
0x003C0000
#define RCC_CR_PLL2RDY
System PLL2 clock ready.
#define RCC_CR_PLL2ON
System PLL2 clock enable.
#define RCC_CFGR_MCO1
0x01C00000
#define RCC_D1CFGR_D1CPRE
D1CPRE[2:0] bits (Domain 1 Core prescaler).
#define RCC_CR_PLL1RDY
System PLL1 clock ready.
#define RCC_PLLCKSELR_PLLSRC_HSI
HSI source clock selected.
#define RCC_CR_PLL3RDY
System PLL3 clock ready.
#define RCC_HSICFGR_HSITRIM
HSITRIM[6:0] bits.
#define RCC_PLL1DIVR_P1_Pos
#define RCC_PLL1FRACR_FRACN1_Pos
#define RCC_CR_PLL1ON
System PLL1 clock enable.
#define RCC_PLLCKSELR_PLLSRC
#define RCC_PLLCKSELR_DIVM1
#define RCC_CFGR_SWS_HSI
HSI used as system clock.
#define RCC_PLLCFGR_PLL1VCOSEL
#define RCC_PLLCKSELR_DIVM1_5
0x00000200
#define RCC_CFGR_SWS_PLL1
PLL1 used as system clock.
#define RCC_CR_PLL3ON
System PLL3 clock enable.
#define RCC_CSICFGR_CSITRIM
CSITRIM[5:0] bits.
#define RCC_CR_HSERDY
External High Speed clock ready.
#define RCC_D3CFGR_D3PPRE
D3PPRE1[2:0] bits (APB4 prescaler).
#define FLASH_LATENCY_DEFAULT
#define RCC_PLLCFGR_PLL1FRACEN_Pos
#define RCC_CFGR_SWS_CSI
CSI used as system clock.
#define RCC_D1CFGR_HPRE
HPRE[3:0] bits (AHB3 prescaler).
#define RCC_CSICFGR_CSITRIM_Pos
#define RCC_CR_HSIRDY
Internal High Speed clock ready flag.
#define RCC_CR_HSEBYP
External High Speed clock Bypass.
#define RCC_CR_HSIKERON
Internal High Speed clock enable for some IPs Kernel.
#define RCC_PLLCKSELR_DIVM2_5
0x00020000
#define RCC_D2CFGR_D2PPRE2
D2PPRE2[2:0] bits (APB2 prescaler).
#define RCC_D2CFGR_D2PPRE1_Pos
< D2PPRE1 configuration
#define RCC_PLL1DIVR_N1_Pos
#define RCC_PLL1DIVR_Q1_Pos
#define RCC_PLLCKSELR_PLLSRC_HSE
HSE source clock selected.
#define RCC_CR_CSSHSEON
HSE Clock security System enable.
#define RCC_HSICFGR_HSITRIM_6
0x40000000
#define RCC_CR_HSI48ON
HSI48 clock enable clock enable.
#define RCC_PLLCFGR_PLL1FRACEN
#define RCC_CR_PLLON
System PLL clock enable.
#define RCC_PLLCFGR_PLL1RGE
#define RCC_PLLCKSELR_DIVM1_Pos
#define RCC_CR_HSEON
External High Speed clock enable.
#define RCC_D2CFGR_D2PPRE1
D1PPRE1[2:0] bits (APB1 prescaler).
#define RCC_CFGR_SWS_HSE
HSE used as system clock.
#define RCC_CFGR_MCO2PRE
0x1E000000
#define RCC_CR_CSION
The Internal RC 4MHz oscillator clock enable.
#define RCC_D2CFGR_D2PPRE2_Pos
#define FLASH_ACR_LATENCY
Read Latency.
#define RCC_PLL1FRACR_FRACN1
#define RCC_D1CFGR_D1CPRE_Pos
#define RCC_CR_CSIKERON
Internal RC 4MHz oscillator clock enable for some IPs Kernel.
#define RCC_CR_HSIDIVF
HSI Divider flag.
#define RCC_CR_HSION
Internal High Speed clock enable.
#define RCC_PLLCFGR_PLL1VCOSEL_Pos
#define RCC_D1CFGR_HPRE_Pos
< D1HPRE configuration
HAL_StatusTypeDef HAL_RCC_DeInit(void)
HAL_StatusTypeDef HAL_RCC_OscConfig(const RCC_OscInitTypeDef *RCC_OscInitStruct)
HAL_StatusTypeDef HAL_RCC_ClockConfig(const RCC_ClkInitTypeDef *RCC_ClkInitStruct, uint32_t FLatency)
void HAL_RCC_NMI_IRQHandler(void)
uint32_t HAL_RCC_GetHCLKFreq(void)
uint32_t HAL_RCC_GetSysClockFreq(void)
void HAL_RCC_MCOConfig(uint32_t RCC_MCOx, uint32_t RCC_MCOSource, uint32_t RCC_MCODiv)
void HAL_RCC_CSSCallback(void)
void HAL_RCC_EnableCSS(void)
uint32_t HAL_RCC_GetPCLK1Freq(void)
uint32_t HAL_RCC_GetPCLK2Freq(void)
void HAL_RCC_GetClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, uint32_t *pFLatency)
void HAL_RCC_DisableCSS(void)
void HAL_RCC_GetOscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct)
#define __HAL_RCC_HSI_CONFIG(__STATE__)
Enable or disable peripheral bus clock when D3 domain is in DRUN.
#define __HAL_RCC_HSI_DISABLE()
#define __HAL_RCC_PLL_VCORANGE(__RCC_PLL1VCORange__)
Macro to select the PLL1 reference frequency range.
#define __HAL_RCC_CSI_DISABLE()
#define __HAL_RCC_PLLCLKOUT_ENABLE(__RCC_PLL1ClockOut__)
Enables or disables each clock output (PLL_P_CLK, PLL_Q_CLK, PLL_R_CLK).
#define __HAL_RCC_PLL_VCIRANGE(__RCC_PLL1VCIRange__)
Macro to select the PLL1 reference frequency range.
#define __HAL_RCC_LSI_DISABLE()
#define __HAL_RCC_CSI_CALIBRATIONVALUE_ADJUST(__CSICalibrationValue__)
Macro Adjusts the Internal oscillator (CSI) calibration value.
#define __HAL_RCC_PLLFRACN_ENABLE()
Enables or disables Fractional Part Of The Multiplication Factor of PLL1 VCO.
#define __HAL_RCC_LSI_ENABLE()
Macros to enable or disable the Internal Low Speed oscillator (LSI).
#define __HAL_RCC_PLL_CONFIG(__RCC_PLLSOURCE__, __PLLM1__, __PLLN1__, __PLLP1__, __PLLQ1__, __PLLR1__)
Macro to configures the main PLL clock source, multiplication and division factors.
#define __HAL_RCC_PLL_DISABLE()
#define __HAL_RCC_HSI_CALIBRATIONVALUE_ADJUST(__HSICalibrationValue__)
Macro to adjust the Internal High Speed oscillator (HSI) calibration value.
#define __HAL_RCC_GET_HSI_DIVIDER()
Macro to get the HSI divider.
#define __HAL_RCC_HSI48_ENABLE()
Macro to enable or disable the Internal High Speed oscillator for USB (HSI48).
#define __HAL_RCC_HSI48_DISABLE()
#define __HAL_RCC_HSE_CONFIG(__STATE__)
Macro to configure the External High Speed oscillator (HSE).
#define __HAL_RCC_PLLFRACN_CONFIG(__RCC_PLL1FRACN__)
Macro to configures the main PLL clock Fractional Part Of The Multiplication Factor.
#define __HAL_RCC_CSI_ENABLE()
Macros to enable or disable the Internal oscillator (CSI).
#define __HAL_RCC_PLL_ENABLE()
Macros to enable or disable the main PLL.
#define __HAL_RCC_GET_SYSCLK_SOURCE()
Macro to get the clock source used as system clock.
#define __HAL_RCC_PLLFRACN_DISABLE()
#define RCC_FLAG_HSI48RDY
#define __HAL_RCC_GET_IT(__INTERRUPT__)
Check the RCC's interrupt has occurred or not.
#define __HAL_RCC_CLEAR_IT(__INTERRUPT__)
Clear the RCC's interrupt pending bits.
#define __HAL_RCC_GET_FLAG(__FLAG__)
#define RCC_HSI_ON
HSI clock activation.
#define RCC_HSI_OFF
HSI clock deactivation.
#define IS_RCC_CSICALIBRATION_VALUE(VALUE)
#define IS_RCC_MCO1SOURCE(SOURCE)
#define IS_RCC_SYSCLKSOURCE(SOURCE)
#define IS_RCC_PLLN_VALUE(VALUE)
#define IS_RCC_MCODIV(DIV)
#define IS_RCC_SRDPCLK1(SRDPCLK1)
#define IS_RCC_HSICALIBRATION_VALUE(VALUE)
#define IS_RCC_OSCILLATORTYPE(OSCILLATOR)
#define IS_RCC_PLLFRACN_VALUE(VALUE)
#define IS_RCC_HCLK(HCLK)
#define IS_RCC_PLLR_VALUE(VALUE)
#define IS_RCC_SYSCLK(SYSCLK)
#define IS_RCC_PLLVCO_VALUE(VALUE)
#define IS_RCC_HSI48(HSI48)
#define IS_RCC_PLLM_VALUE(VALUE)
#define IS_RCC_CDPCLK1(CDPCLK1)
#define IS_RCC_PCLK1(PCLK1)
#define IS_RCC_PLLRGE_VALUE(VALUE)
#define IS_RCC_MCO2SOURCE(SOURCE)
#define IS_RCC_PLLQ_VALUE(VALUE)
#define IS_RCC_PLLP_VALUE(VALUE)
#define IS_RCC_PLLSOURCE(SOURCE)
#define IS_RCC_PCLK2(PCLK2)
#define IS_RCC_CLOCKTYPE(CLK)
#define __HAL_RCC_LSE_CONFIG(__STATE__)
Macro to configure the External Low Speed oscillator (LSE).
#define RCC_OSCILLATORTYPE_HSI48
#define RCC_OSCILLATORTYPE_HSE
#define RCC_OSCILLATORTYPE_LSI
#define RCC_OSCILLATORTYPE_CSI
#define RCC_OSCILLATORTYPE_LSE
#define RCC_OSCILLATORTYPE_HSI
#define RCC_PLLSOURCE_HSI
#define RCC_PLLSOURCE_HSE
#define RCC_PLLSOURCE_CSI
#define HSI48_TIMEOUT_VALUE
#define PLL_FRAC_TIMEOUT_VALUE
#define CLOCKSWITCH_TIMEOUT_VALUE
#define HSE_TIMEOUT_VALUE
#define LSI_TIMEOUT_VALUE
#define PLL_TIMEOUT_VALUE
#define HSI_TIMEOUT_VALUE
#define RCC_DBP_TIMEOUT_VALUE
#define CSI_TIMEOUT_VALUE
#define RCC_LSE_TIMEOUT_VALUE
#define RCC_SYSCLKSOURCE_PLLCLK
#define RCC_SYSCLKSOURCE_CSI
#define RCC_SYSCLKSOURCE_HSE
#define RCC_CLOCKTYPE_SYSCLK
#define RCC_CLOCKTYPE_D1PCLK1
#define RCC_CLOCKTYPE_HCLK
#define RCC_CLOCKTYPE_PCLK1
#define RCC_CLOCKTYPE_D3PCLK1
#define RCC_CLOCKTYPE_PCLK2
#define REV_ID_Y
STM32H7 rev.Y.
uint32_t SystemD2Clock
System Domain2 Clock Frequency.
uint32_t SystemCoreClock
System Domain1 Clock Frequency.
const uint8_t D1CorePrescTable[16]
D1CorePrescTable prescalers table values.
This file contains all the functions prototypes for the HAL module driver.
#define CSI_VALUE
Internal oscillator (CSI) default value.
#define assert_param(expr)
Uncomment the line below to expanse the "assert_param" macro in the HAL drivers code.
#define HSI_VALUE
Internal High Speed oscillator (HSI) value.
#define HSE_VALUE
Adjust the value of External High Speed oscillator (HSE) used in your application.
HAL_StatusTypeDef
HAL Status structures definition.
HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
This function configures the TIM6 as a time base source.
GPIO Init structure definition.
uint32_t Mode
Specifies the operating mode for the selected pins.
uint32_t Alternate
Peripheral to be connected to the selected pins.
uint32_t Pull
Specifies the Pull-up or Pull-Down activation for the selected pins.
uint32_t Pin
Specifies the GPIO pins to be configured.
uint32_t Speed
Specifies the speed for the selected pins.
RCC System, AHB and APB busses clock configuration structure definition.
uint32_t APB1CLKDivider
The APB1 clock (PCLK1) divider.
uint32_t APB4CLKDivider
The APB4 clock (D3PCLK1) divider.
uint32_t SYSCLKSource
The clock source (SYSCLKS) used as system clock.
uint32_t ClockType
The clock to be configured.
uint32_t SYSCLKDivider
The system clock divider.
uint32_t APB2CLKDivider
The APB2 clock (PCLK2) divider.
uint32_t APB3CLKDivider
The APB3 clock (D1PCLK1) divider.
uint32_t AHBCLKDivider
The AHB clock (HCLK) divider.
RCC Internal/External Oscillator (HSE, HSI, CSI, LSE and LSI) configuration structure definition.
uint32_t HSIState
The new state of the HSI.
uint32_t LSEState
The new state of the LSE.
uint32_t HSEState
The new state of the HSE.
uint32_t HSI48State
The new state of the HSI48.
uint32_t LSIState
The new state of the LSI.
uint32_t HSICalibrationValue
The calibration trimming value.
uint32_t CSIState
The new state of the CSI.
uint32_t CSICalibrationValue
The calibration trimming value.
RCC_PLLInitTypeDef PLL
PLL structure parameters.
uint32_t OscillatorType
The oscillators to be configured.
uint32_t PLLFRACN
PLLFRACN: Specifies Fractional Part Of The Multiplication Factor for PLL1 VCO It should be a value be...
uint32_t PLLN
PLLN: Multiplication factor for PLL VCO output clock.
uint32_t PLLQ
PLLQ: Division factor for peripheral clocks.
uint32_t PLLVCOSEL
PLLVCOSEL: PLL1 clock Output range This parameter must be a value of RCC PLL1 VCO Range.
uint32_t PLLR
PLLR: Division factor for peripheral clocks.
uint32_t PLLP
PLLP: Division factor for system clock.
uint32_t PLLState
The new state of the PLL.
uint32_t PLLSource
RCC_PLLSource: PLL entry clock source.
uint32_t PLLRGE
PLLRGE: PLL1 clock Input range This parameter must be a value of RCC PLL1 VCI Range.
uint32_t PLLM
PLLM: Division factor for PLL VCO input clock.