This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM263P4: EPWM Duty Cycle Configuration

Part Number: AM263P4

Tool/software:

Hello,

1) I want to set Tpwm to 1kHz and found formula about it. I did some calculation based on formula and I figured out my clock frequency is not match with Syscfg valu. My clock frequency set to 25 MHz but real clock frequency is 200 MHz.Therefore, I made all calculation based on 200MHz. How can I control this value? 


2) How can I set %100 and %0 duty cycle or can I do that? If I set CMPA to 1, I am gettin %99 duty cycle.


Best Regards,
BK

  • Hi Basri,

    I want to set Tpwm to 1kHz and found formula about it. I did some calculation based on formula and I figured out my clock frequency is not match with Syscfg valu. My clock frequency set to 25 MHz but real clock frequency is 200 MHz.Therefore, I made all calculation based on 200MHz. How can I control this value? 

    TBCLK = EPWMCLK / (HSPCLKDIV * CLKDIV)

    Clock Prescaler = HSPCLKDIV * CLKDIV

    EPWMCLK = 200MHz

    Thus, if you want TBCLK to be 25MHz, you need Clock Prescaler to be 8.

    You can set the HSPCLKDIV to 4 and CLKDIV to 2, to achieve this.

    You can refer the EPWM Academy for more information on these calculations along with examples.



    2) How can I set %100 duty cycle or can I do that? If I set CMPA to 1, I am gettin %99 duty cycle.
    
    

    I set CMPA value to 0 in this example,  EXAMPLES_DRIVERS_EPWM_HR_DUTY_CYCLE and got 100% duty cycle.

    Let me know if this helps!

    Regards,
    Akshit

  • Hi Akshit,

    EPWMCLK = 200MHz

    I did not know this information, sorry. I thought that pwm clock frequency is same with clock frequency. Thank you.

    I set CMPA value to 0 in this example,  EXAMPLES_DRIVERS_EPWM_HR_DUTY_CYCLE and got 100% duty cycle.

    While I got the same result with you while pwm module is set to up-down count mode but I did not get the same result for this example EPWM_GLOBAL_LOAD_AND_LINK

    Best Regards,
    BK