cancel
Showing results for 
Search instead for 
Did you mean: 

What is the internal clock CK_INT for the STM32H7 timers?

Intector
Senior

Hey @eBirdman 
I know this is an old question, but I got into the situation to wonder about this too. After some research through the mystical STM documentation and some educated guesses I compiled this document. It might prevent others from the pain to find information in the STM documentation.

STM32H7B0VBT6 Timer Clock Sources

 

TimerAPB BusBase Clock SourceTimer Kernel ClockClock Register
TIM1APB2rcc_pclk2rcc_timy_ker_ckRCC_APB2ENR
TIM8APB2rcc_pclk2rcc_timy_ker_ckRCC_APB2ENR
TIM15APB2rcc_pclk2rcc_timy_ker_ckRCC_APB2ENR
TIM16APB2rcc_pclk2rcc_timy_ker_ckRCC_APB2ENR
TIM17APB2rcc_pclk2rcc_timy_ker_ckRCC_APB2ENR
TIM2APB1rcc_pclk1rcc_timx_ker_ckRCC_APB1LENR
TIM3APB1rcc_pclk1rcc_timx_ker_ckRCC_APB1LENR
TIM4APB1rcc_pclk1rcc_timx_ker_ckRCC_APB1LENR
TIM5APB1rcc_pclk1rcc_timx_ker_ckRCC_APB1LENR
TIM6APB1rcc_pclk1rcc_timx_ker_ckRCC_APB1LENR
TIM7APB1rcc_pclk1rcc_timx_ker_ckRCC_APB1LENR
TIM12APB1rcc_pclk1rcc_timx_ker_ckRCC_APB1LENR
TIM13APB1rcc_pclk1rcc_timx_ker_ckRCC_APB1LENR
TIM14APB1rcc_pclk1rcc_timx_ker_ckRCC_APB1LENR

Timer Clock Calculation

The actual timer kernel clock frequency depends on the APB prescaler and TIMPRE bit setting:

For APB1 Timers (rcc_timx_ker_ck):

  • If CDPPRE1 = 0xx (no division) and TIMPRE = 0: Timer clock = rcc_hclk1
  • If CDPPRE1 = 100 (÷2) and TIMPRE = 0: Timer clock = rcc_hclk1
  • If CDPPRE1 = 101-111 (÷4 to ÷16) and TIMPRE = 0: Timer clock = 2 × rcc_pclk1
  • If CDPPRE1 = 0xx (no division) and TIMPRE = 1: Timer clock = rcc_hclk1
  • If CDPPRE1 = 100 (÷2) and TIMPRE = 1: Timer clock = rcc_hclk1
  • If CDPPRE1 = 101 (÷4) and TIMPRE = 1: Timer clock = rcc_hclk1
  • If CDPPRE1 = 110-111 (÷8 to ÷16) and TIMPRE = 1: Timer clock = 2 × rcc_pclk1

For APB2 Timers (rcc_timy_ker_ck):

  • If CDPPRE2 = 0xx (no division) and TIMPRE = 0: Timer clock = rcc_hclk1
  • If CDPPRE2 = 100 (÷2) and TIMPRE = 0: Timer clock = rcc_hclk1/2
  • If CDPPRE2 = 101-111 (÷4 to ÷16) and TIMPRE = 0: Timer clock = 2 × rcc_pclk2
  • If CDPPRE2 = 0xx (no division) and TIMPRE = 1: Timer clock = rcc_hclk1
  • If CDPPRE2 = 100 (÷2) and TIMPRE = 1: Timer clock = rcc_hclk1/2
  • If CDPPRE2 = 101 (÷4) and TIMPRE = 1: Timer clock = rcc_hclk1/4
  • If CDPPRE2 = 110-111 (÷8 to ÷16) and TIMPRE = 1: Timer clock = 2 × rcc_pclk2

Notes:

  • TIMPRE bit is located in RCC_CFGR register (bit 15)
  • CDPPRE1 and CDPPRE2 are located in RCC_CDCFGR2 register
  • All timers can be individually enabled/disabled via their respective enable bits
  • The timer kernel clock is what feeds the timer prescaler and counter logic

 

1 REPLY 1
eBirdman
Senior II

I have to admit generally the STM documentation is respectively good comparing to most of other MCU manufacturers.

But this absence of information of which internal clock bus feeds which timers was quite puzzling. Too much time I spent in the user manual research for each timer I used. Detail chapter on each timer does not have this information !  Recently I couldn't trust even AIs as different models of the most advanced AIs were given different answers :) 

Your post is quite helpful . Kudos.