STM32 PWM Calculator
STM32 microcontrollers use timers to generate Pulse Width Modulated (PWM) signals. To configure a timer, you need to calculate the prescaler (PSC) and auto-reload register (ARR) to achieve your desired PWM frequency. This calculator simplifies these calculations, providing you with ready-to-use register values for your firmware.

What this calculator is doing
This calculator computes the correct timer settings for generating PWM signals on STM32 microcontrollers. It uses the standard STM32 timer formula: \[ \text{PWM Frequency} = \frac{\text{SystemCoreClock}}{(\text{PSC} + 1) \times (\text{ARR} + 1)} \] Given your core clock and desired PWM frequency, it calculates optimal PSC and ARR values to get as close as possible to the target frequency. It also computes the Compare Register (CCR) value needed to achieve your desired duty cycle: \[ \text{CCR} = \frac{\text{Duty Cycle (%)}}{100} \times (\text{ARR} + 1) \]
Looking for similar calculators?
Check out the following calculators as well! They provide similar solutions to this one.
Want to reuse this calculator?
You can embed this calculator to your own website using the following endpoint: https://www.nichecalcs.com/embed/stm32_pwm
Find out more about our Services
Disclaimer: These calculators are provided for informational purposes only. Always verify your designs against relevant engineering standards and consult a qualified professional. We do not take responsibility for any errors or damages resulting from the use of these calculations.