einstein-2014731

调用库函数RCC_GetClocksFreq,该函数可以返回片上的各种时钟的频率

函数原形  

void  RCC_GetClocksFreq(RCC_ClocksTypeDef*  RCC_Clocks)

RCC_ClocksTypeDef定义于文件“stm32f10x_rcc.h”:

typedef struct
{
  uint32_t SYSCLK_Frequency; /*!<  SYSCLK clock frequency expressed in Hz */
  uint32_t HCLK_Frequency;   /*!<  HCLK clock frequency expressed in Hz   */
  uint32_t PCLK1_Frequency;  /*!<  PCLK1 clock frequency expressed in Hz  */
  uint32_t PCLK2_Frequency;  /*!<  PCLK2 clock frequency expressed in Hz  */
}RCC_ClocksTypeDef;

例:
/* Get the frequencies of different on chip clocks  */
RCC_ClocksTypeDef  RCC_Clocks;  
RCC_GetClocksFreq(&RCC_Clocks);

执行完后,直接查看RCC_Clocks,在各成员中取出所需要时钟频率就行了。

分类:

技术点:

相关文章:

  • 2021-05-05
  • 2021-11-27
猜你喜欢
  • 2022-12-23
  • 2021-11-30
  • 2021-11-26
  • 2021-04-21
相关资源
相似解决方案