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
PWM Frequency Calculate
-
- Posts: 52
- http://meble-kuchenne.info.pl
- Joined: Wed Jan 12, 2022 8:25 am
- Has thanked: 10 times
- Been thanked: 1 time
PWM Frequency Calculate
- Attachments
-
- MCU Configure Setting
- MCU Configure Setting.png (137.36 KiB) Viewed 398 times
-
- Period 6399
- Period 6399.png (35.13 KiB) Viewed 398 times
-
- Period 7199
- Period 7199.png (28.55 KiB) Viewed 398 times
-
- Posts: 52
- Joined: Wed Jan 12, 2022 8:25 am
- Has thanked: 10 times
- Been thanked: 1 time
Re: PWM Frequency Calculate
Built-in frequency calculation:
- Attachments
-
- 屏幕截图 2025-08-04 151955.png (65.04 KiB) Viewed 386 times