Page 1 of 1

PWM Frequency Calculate

Posted: Mon Aug 04, 2025 9:07 am
by liudeqiang_2008
Hello,

MCU: STM32F303CBT6

Step 1: I have set the Configure to have 72MHz clock speed.
Step 2: Using a PWM Channel to generate a 10 KHz pwm signal.
Step 3: In the Properties -- Calculations -- Required Frequency(HZ), I type in 10000, and get Calculated Period with 6399.
Step 4: Put 6399 in PWM Frequency -- Period Overflow
Step 5: Set 3200 in Component Macro -- SetDutyCycle10Bit

I have measured the output pin, and get a 11.25KHz signal, not 10 KHz. The DutyCycle 50% is correct.

Then I try to use 7199(Manually calculating Base on 72MHz) in Period Overflow and 3600 in SetDutyCycle10Bit, then I measured it, the output is perfect 10 KHz and 50% CutyCycle.

Perhaps this is a calculate issue in this component, or need to show out the final clock frequency after the MCU Configure Setting.
In this case, if we can set or select 72MHz in the Calculations Properties, the calculate showing out should be coreect.

Maybe there already is a solutions for it, please let me know.
Thanks.

Br, Deqiang

Re: PWM Frequency Calculate

Posted: Mon Aug 04, 2025 10:31 am
by liudeqiang_2008
Built-in frequency calculation: