Timer Prescaler Calculator

Find the best prescaler (PSC) and auto-reload (ARR) values for your MCU timer to achieve a target frequency with minimal error.

Prescaler (PSC) Period (ARR) (ARR) Actual Frequency Error

Timer Prescaler Formula (PSC and ARR)

ftimer = fclk / (PSC + 1) / (ARR + 1)
Where:
fclk = Timer peripheral clock frequency
PSC = Prescaler register value (0–max)
ARR = Auto-reload register value (0–max)

Common Presets

How Timer Prescaling Works

An MCU timer counts clock pulses. The prescaler divides the input clock before it reaches the counter, and the auto-reload (ARR) value determines when the counter overflows. Together, PSC and ARR control the timer's output frequency: f_timer = f_clk / (PSC+1) / (ARR+1). Choosing values that produce zero error means the timer hits the target frequency exactly.

Tips for Choosing Values

Prefer smaller prescaler values when you need finer frequency resolution. For PWM, a larger ARR gives more duty-cycle steps. When exact frequency isn't possible, check whether the error percentage is acceptable for your application — under 0.1% is usually fine for most use cases. Some MCUs (e.g. STM32) multiply the APB bus clock before it reaches the timer, so verify f_clk in your reference manual.

FAQ

What is a timer prescaler?

A prescaler is a clock divider that reduces the counting frequency of an MCU timer. Setting PSC to N means the timer increments once every N+1 clock cycles, slowing down the effective count rate.

How do I find exact PSC and ARR values?

Compute f_clk / f_target to get the total divisor. Then factorize it into (PSC+1) × (ARR+1) where both values fit in the counter width. If the total divisor is prime or too large, an exact match may not exist and you'll need to accept a small error.

Related Tools