How-to guide

STM32 Timer Prescaler and ARR Guide

Understand the off-by-one register math and APB timer clock behavior before setting PSC and ARR.

Quick path

Use the STM32 Timer Calculator to find PSC and ARR values. Set APB prescaler correctly before copying the result into firmware.

Frequency formula

Timer update frequency is timer_clock / ((PSC + 1) * (ARR + 1)). A register value of zero still divides by one, so direct PSC * ARR math is wrong.

APB timer clock

On many STM32 families, if the APB prescaler is greater than 1, timer peripherals receive twice the APB clock. Always confirm the rule in the exact reference manual for the part family.

Register limits

Many general-purpose timers use 16-bit PSC and ARR registers. Some timers support a wider ARR register. Set the calculator limits to the exact timer instance, not just the MCU family name.

Why exact frequency may not fit

PSC and ARR must be integers. If the target tick count cannot be factored into valid register values, the closest result has a small frequency error. Use the reported actual frequency and error before committing the values.

Firmware checklist

  • Confirm the APB clock after PLL and bus prescaler configuration.
  • Check whether the selected timer is 16-bit or 32-bit.
  • Remember that changing ARR may require an update event before the new period takes effect.
  • Measure the output pin or interrupt interval when the timer drives a critical timing path.

Next step

Open the STM32 Timer Calculator, enter the timer clock and register limits, then copy the reported PSC, ARR, actual frequency, and error into your firmware review notes.