⏱️ STM32 Timer Calculator

Find PSC / ARR (and CCR) register values to hit a target timer frequency or period.

Timer input clock (TIMxCLK), e.g. 16 MHz.
Desired update / interrupt frequency.
Register width of PSC & ARR.
0 = only exact matches.
For PWM: computes the CCR value.
-1 to show every solution.

How it works

An STM32 hardware timer counts pulses from its input clock through a prescaler. The update (overflow) event frequency is:

fupdate = ftimer ÷ ((PSC + 1) × (ARR + 1))

The tool sweeps every valid PSC value, solves for the matching ARR, and keeps combinations whose resulting frequency is within your accepted error. For PWM, the compare value is CCR = round((ARR + 1) × duty / 100).

Both PSC and ARR are stored as value − 1 in the STM32 registers, which is why the formula adds 1 to each.