Search code examples
stm32stm32l152libopencm3

STM32L0xx: Get the clock speed


For the life of me, I cannot find a way to get the clock speed for STM32L0 chips in libopencm3. There's got to be a way, right?

  • In STM32Cube, there's the SystemCoreClock variable.
  • In ChibiOs, there's the STM32_SYSCLK variable.

Is there no variable or function to get this value in libopencm3?


Solution

  • So far the closest thing I've found to a solution is the rcc_ahb_frequency variable, which is set to the Advanced High-performance Bus frequency. This is usually the same as the clock speed, but can be given a clock divider.

    Also, it looks like this is only defined if the clock is configured via the rcc_clock_setup_pll method.