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
- Select MCU preset (STM32 / AVR / PIC / Custom)
- Select calculation direction (Reverse / Forward)
- Enter timer clock (e.g., 72M). Frequently used clocks can also be selected from buttons
- In reverse calculation, enter target PWM frequency and duty to display optimal PSC/ARR candidates sorted by highest resolution
- 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
JSON Formatter & Validator
Format, minify, and validate JSON
JSON to Spreadsheet Conversion
Convert JSON data to an Excel-style grid, select cell ranges and copy
Base64 Encode/Decode
Base64 conversion of text and files
URL Encode/Decode
URL encoding conversion
Regex Tester
Real-time regex testing and matching
Text Diff Viewer
Compare and display text differences
Base Converter
Convert numbers between any bases such as binary, octal, decimal, and hexadecimal
Bit Operation Simulator
Visually simulate bitwise operations
SLA Uptime Calculator
Calculate downtime from SLA uptime
IP Address/Subnet Calculator
Calculate IPv4/IPv6 subnets, network addresses, and host ranges
Cron Timeline
Visualize crontab execution schedules as timeline, calendar, and Gantt chart
Bloom Filter Simulator
Visually simulate Bloom filter behavior and calculate optimal parameters
systemd Timer Generator
Interactively generate systemd .timer / .service unit files via GUI
UART Baud Rate Calculator
Calculate divisor ratio, error, and register values from clock frequency and target baud rate
Timer Interrupt Period / Clock Divider Calculator
Calculate interrupt period and frequency from clock, prescaler, and count value. Reverse-calculate optimal PSC/ARR from target period
ADC Resolution, LSB, and Voltage Calculator
Calculate LSB voltage, quantization error, dynamic range, code↔voltage conversion, ENOB, and oversampling from resolution and reference voltage