A program to recognize and reward our most engaged community members
Variable frequency PWM
Why the output frequency is limited to 0.25~4 times of the fundamental frequency
My PWM_Base_Frequency is set at 31250,but the output PWM_Frequency is limited to 7812.5Hz~125000Hz ( 31250*0.25~31250*4 )
The reasons we limit PWM variable range from ¼ to 4 times are as follows:
For example, the base PWM frequency is 10KHz, the interrupt routine execution time is 20us.
When PWM frequency is changed to 40KHz, the PWM period becomes 25us. The 20us interrupt routine
is a big burden for the system(only 5us for other tasks).
that increases the overhead of frequency change.
The reasons we limit PWM variable range from ¼ to 4 times are as follows: Set a bigger multiplier may affect PWM period accuracy (especially for higher frequency). When PWM period changes to a small interval, PWM interrupt may become too busy. For example, the base PWM frequency is 10KHz, the interrupt routine execution time is 20us. When PWM frequency is changed to 40KHz, the PWM period becomes 25us. The 20us interrupt routine is a big burden for the system(only 5us for other tasks). When allowing low frequency in variable frequency, the generated code needs to change multiple registers that increases the overhead of frequency change.
Thank you for the good suggestion.