Variable frequency PWM is limited

liu fred
liu fred New Altair Community Member
edited May 17 in Community Q&A

Variable frequency PWM 

Why the output frequency is limited to 0.25~4 times of the fundamental frequency

image

image

imageimage

My PWM_Base_Frequency is set at 31250,but the output PWM_Frequency is limited to 7812.5Hz~125000Hz ( 31250*0.25~31250*4 )

 

 

Tagged:

Answers

  • Albert_Dunford
    Albert_Dunford
    Altair Employee
    edited May 10

    The reasons we limit PWM variable range from ¼ to 4 times are as follows:

    1. Set a bigger multiplier may affect PWM period accuracy (especially for higher frequency).
    2. 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).

    1. When allowing low frequency in variable frequency, the generated code needs to change multiple registers

    that increases the overhead of frequency change.

  • liu fred
    liu fred New Altair Community Member
    edited May 17

    The reasons we limit PWM variable range from ¼ to 4 times are as follows:

    1. Set a bigger multiplier may affect PWM period accuracy (especially for higher frequency).
    2. 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).

    1. 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.