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.
Tool/software: Code Composer Studio
Hello
I imported project from C:\ti\controlSUITE\development_kits\C2000_LaunchPad\f2802x_examples\epwm_updown_aq
which has these codes:
#define EPWM1_TIMER_TBPRD 2000 // Period register // Setup the PLL for x10 /2 which will yield 50Mhz = 10Mhz * 10 / 2 PLL_setup(myPll, PLL_Multiplier_10, PLL_DivideSelect_ClkIn_by_2); CLK_enablePwmClock(myClk, PWM_Number_1); // Setup TBCLK PWM_setPeriod(myPwm1, EPWM1_TIMER_TBPRD); // Set timer period 801 TBCLKs PWM_setPhase(myPwm1, 0x0000); // Phase is 0 PWM_setCount(myPwm1, 0x0000); // Clear counter // Set Compare values PWM_setCmpA(myPwm1, EPWM1_MIN_CMPA); // Set compare A value PWM_setCmpB(myPwm1, EPWM1_MIN_CMPB); // Set Compare B value // Setup counter mode PWM_setCounterMode(myPwm1, PWM_CounterMode_UpDown); // Count up PWM_disableCounterLoad(myPwm1); // Disable phase loading PWM_setHighSpeedClkDiv(myPwm1, PWM_HspClkDiv_by_1); // Clock ratio to SYSCLKOUT PWM_setClkDiv(myPwm1, PWM_ClkDiv_by_1); // Setup shadowing PWM_setShadowMode_CmpA(myPwm1, PWM_ShadowMode_Shadow); PWM_setShadowMode_CmpB(myPwm1, PWM_ShadowMode_Shadow); PWM_setLoadMode_CmpA(myPwm1, PWM_LoadMode_Zero); PWM_setLoadMode_CmpB(myPwm1, PWM_LoadMode_Zero);
Should the period or freq be 25kHz? But from my scope it is showing 12.5kHz
or should
PWM_setClkDiv(myPwm1, PWM_ClkDiv_by_1);
doing the division?
OK I got it.
It is due to
PWM_setCounterMode(myPwm1, PWM_CounterMode_UpDown); // Count up
halving the freq