Utilities Web

PWM/Timer Configuration Calculator

Calculate and reverse-calculate PWM frequency, duty, resolution, and register settings (PSC/ARR/CCR) from clock and prescaler/counter values

How to Use

  1. Select MCU preset (STM32 / AVR / PIC / Custom)
  2. Select calculation direction (Reverse / Forward)
  3. Enter timer clock (e.g., 72M). Frequently used clocks can also be selected from buttons
  4. In reverse calculation, enter target PWM frequency and duty to display optimal PSC/ARR candidates sorted by highest resolution
  5. In forward mode, enter prescaler and period register to display actual frequency, period, resolution, and compare register values

Use Cases

  • When you want to know PSC/ARR that maximize resolution (duty steps) for a target PWM frequency
  • When you want to verify actual PWM frequency, period, and resolution from configured PSC/ARR
  • When you want to find CCR/OCR values corresponding to specific duty in servo or fan control
  • When you want to compare register settings for the same target frequency across STM32/AVR/PIC

Frequently Asked Questions

How should I decide PSC and ARR? How to maximize resolution? ▼

PWM frequency is determined by f_pwm = Clock ÷ (E × Effective Prescaler × Period Count). For the same frequency, smaller prescaler and larger period count (ARR+1) increase the number of duty steps (resolution). Our tool's reverse calculation presents the combination that maximizes resolution while meeting the target frequency at the top.

What is resolution bit count? What's its relationship with duty steps? ▼

Resolution bit count is log2(total number of duty steps). The number of steps is the count period itself: for STM32/AVR it is ARR+1 (or TOP+1), for PIC it is 4×(PR2+1) because of instruction clock Fosc/4. For example, if ARR=3599, that is 3600 steps ≈ 11.81 bits. Larger bit count allows finer duty setting.

Why are +1 and ×4 different between STM32 and AVR/PIC? ▼

STM32 divides by register value + 1 for PSC and ARR registers (PSC+1, ARR+1). AVR has prescaler as discrete choices {1,8,64,256,1024} with TOP+1 as the period. PIC uses instruction clock Fosc/4 as the reference, so the frequency formula includes ×4, and duty resolution becomes 4×(PR2+1) (max 10 bits). Our tool handles these differences via preset parameters (E, offset, width).

Related Tools