cancel
Showing results for 
Search instead for 
Did you mean: 

APB1PeriphClock

John Hite
Associate III
Posted on March 15, 2017 at 17:38

Is there a function or macro for determining the frequency of APB1PeriphClock and APB2PeriphClock?

Thanks,

jh

#apb1periphclock
1 ACCEPTED SOLUTION

Accepted Solutions
Posted on March 15, 2017 at 18:07

  RCC_ClocksTypeDef RCC_Clocks;

  /* SysTick end of count event each 1ms */

  RCC_GetClocksFreq(&RCC_Clocks);

  printf('SYS:%d H:%d, P1:%d, P2:%d\r\n',

                      RCC_Clocks.SYSCLK_Frequency,

                      RCC_Clocks.HCLK_Frequency,   // AHB

                      RCC_Clocks.PCLK1_Frequency,  // APB1

                      RCC_Clocks.PCLK2_Frequency); // APB2
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

3 REPLIES 3
Posted on March 15, 2017 at 18:07

  RCC_ClocksTypeDef RCC_Clocks;

  /* SysTick end of count event each 1ms */

  RCC_GetClocksFreq(&RCC_Clocks);

  printf('SYS:%d H:%d, P1:%d, P2:%d\r\n',

                      RCC_Clocks.SYSCLK_Frequency,

                      RCC_Clocks.HCLK_Frequency,   // AHB

                      RCC_Clocks.PCLK1_Frequency,  // APB1

                      RCC_Clocks.PCLK2_Frequency); // APB2
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Khouloud GARSI
Lead II
Posted on March 15, 2017 at 18:51

Hi

Hite.John

,

  • In SPL you can use 'RCC_GetClocksFreq' which returns the frequencies of different on chip clocks: SYSCLK, HCLK, PCLK1 and PCLK2.

void RCC_GetClocksFreq(RCC_ClocksTypeDef* RCC_Clocks)

  • In cube, there is:

uint32_t HAL_RCC_GetPCLK1Freq(void) : Returns the PCLK1 frequency

uint32_t HAL_RCC_GetPCLK2Freq(void) : Returns the PCLK2 frequency

Khouloud

John Hite
Associate III
Posted on March 15, 2017 at 18:59

I thank you both.

John