What is the Cerbuino Bee internal clock speed and clock frequency for TIM1 timer?

I am trying to determine the clock frequency for the TIM1 timer.

From the registry, I can see that the system clock is driven by PLL, which in turn is driven by an HSE (External High Speed Oscillator).

Similarly, I can find the PLL multiplication and division factors from the Register, but need to know the frequency of the HSE, which is not marked on the schematics posted for this board, but without knowing the HSE frequency I have hit a brick wall.

Is there an easier way to determin the clock frequency for the TIM1 timer?

I gave up too soon, and posted before finding the answer. Since them I’ve found the answer, and will post some calculations here, in case somebody else wants to verify what turned out to be obvious, i.e. The system clock runs at 168MHz. This is what the STM23F405 is rated at, but it is good to confirm the board implementation for Cerbuino Bee holds to that.

The value of the oscillator used for the HSE is 12Mhz. I found this in the platform_selector.h file of the Cerbuino OSHW source code.

I then used this value, and applied the calculations specified in the STM32F40x Technical Reference manual, subsituted the values read from the registry, and came up with the following results …

Used Register Class to get “0000 0111 0100 0000 0101 0100 0000 1100” as the binary contents of the RCC_PLLCFGR register.
This translates to the following values …

  • PLL Division Factor (Main and Audio) PLLM[5:0] = 12
  • PLL Multiplication Factor (VCO) PLLN[14:6] = 336
  • PLL Division Factor (Main System Clock) PLLP[17:16] = Divide by 2
  • PLLSRC [22]= HSE Oscillator at 12MHz (as per platform_selector.h from Cerbuino OSHW source)

Thus:

  • VCO input frequency = PLL input clock frequency / PLLM = 12MHz / 12 = 1MHz
  • VCO output frequency = VCO input frequency × PLLN = 1MHz * 336 = 336MHz
  • -PLL output clock frequency = VCO frequency / PLLP = 336MHz / 2 = 168MHz

From there, the TIM1 (and other TIMx) clock speeds can be derived based on pre-scaler values for the bus they are connected to (TIM1 is on APB2)

  • AHB is not prescaled, thus same as VCO or System Clock Speed
  • APB1 = AHB / 4 = 42MHz
  • APB2 = AHB / 2 = 84MHz
1 Like

Good. Now you can unmark this thread as a question :wink:

@ Architect - Done … tx. I was just sitting here pondering what the right protocol was for this kind of thing, and now I know :slight_smile: