STM32 查看系统工作主频

文章目录

  • SystemCoreClock全局变量

SystemCoreClock全局变量

通过打印 SystemCoreClock全局变量的值,就能观察系统当前主频。

/** @addtogroup STM32L4xx_System_Private_Variables
  * @{
  */
  /* The SystemCoreClock variable is updated in three ways:
      1) by calling CMSIS function SystemCoreClockUpdate()
      2) by calling HAL API function HAL_RCC_GetHCLKFreq()
      3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
         Note: If you use this function to configure the system clock; then there
               is no need to call the 2 first functions listed above, since SystemCoreClock
               variable is updated automatically.
  */
uint32_t SystemCoreClock = 4000000U;

你可能感兴趣的:(STM32)