| Prescaler (PSC) | Period (ARR) (ARR) | Actual Frequency | Error |
|---|
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 |
|---|
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.
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.