PWM Frequency Calculate

Any bugs you encounter with Flowcode should be discussed here.
Post Reply
liudeqiang_2008
Posts: 52
http://meble-kuchenne.info.pl
Joined: Wed Jan 12, 2022 8:25 am
Has thanked: 10 times
Been thanked: 1 time

Flowcode v10 PWM Frequency Calculate

Post 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
Attachments
MCU Configure Setting
MCU Configure Setting
MCU Configure Setting.png (137.36 KiB) Viewed 399 times
Period 6399
Period 6399
Period 6399.png (35.13 KiB) Viewed 399 times
Period 7199
Period 7199
Period 7199.png (28.55 KiB) Viewed 399 times

liudeqiang_2008
Posts: 52
Joined: Wed Jan 12, 2022 8:25 am
Has thanked: 10 times
Been thanked: 1 time

Flowcode v10 Re: PWM Frequency Calculate

Post by liudeqiang_2008 »

Built-in frequency calculation:
Attachments
屏幕截图 2025-08-04 151955.png
屏幕截图 2025-08-04 151955.png (65.04 KiB) Viewed 387 times

Post Reply