Timer prescaler and PWM calculator
PSC and ARR for a frequency or period, error, PWM resolution and CCR for a duty cycle.
- Free
- No sign-up
- Nothing uploaded: files are read in your browser
- Works offline after the first visit
How to use it
- Enter the timer clock and the frequency or period you need.
- Pick a prescaler (PSC) and auto-reload (ARR) pair.
- Set a duty cycle to get the compare value (CCR) and see the PWM resolution.
Questions
Why add 1 to PSC and ARR?
On STM32 and similar timers the counter divides by PSC + 1 and counts ARR + 1 steps, so the registers hold one less than the divisor.
How fine can the duty cycle be?
One step in ARR + 1, that is log₂(ARR + 1) bits. A faster timer clock or a lower PWM frequency gives more steps.
Related tools
- UART baud rate calculator: BRR/UBRR divisor, actual baud rate and error for STM32, AVR and generic UARTs.
- Electronics calculators: Divider/ADC, NTC, pull-ups, RC/PWM filter, wire drop, power and heat, CAN bus length.
- CAN bit timing calculator: Prescaler, time quanta, sample point and register values for a clock and bit rate.
- Fixed point (Q format) and IEEE 754 inspector: Q15/Q31 and any Qm.n; float16/32/64 bits, exact value, rounding error and ULP.
Also useful for: psc, arr, ccr, auto-reload, period, duty cycle, interrupt rate, center aligned.