Other Parts Discussed in Thread: C2000WARE, SYSCONFIG
Hello Experts ,
I have a implemented independant modulation on epwm8 (EPWM8A & EPWMB).
I have some confusion on the action qualifier settings and interrupt settings.
Here is the function:
void HAL_setupBrCpPWMs(HAL_MTR_Handle handle)
{
HAL_MTR_Obj *obj = (HAL_MTR_Obj*) handle;
//obj->pwmHandle[3] contains the base address of ePWM8
EPWM_setClockPrescaler(obj->pwmHandle[3],
EPWM_CLOCK_DIVIDER_1,
EPWM_HSCLOCK_DIVIDER_2);
EPWM_setTimeBaseCounterMode(obj->pwmHandle[3], EPWM_COUNTER_MODE_UP);
//Switching frequency 5Khz
EPWM_setTimeBasePeriod(obj->pwmHandle[3], 10000U);
EPWM_setPhaseShift(obj->pwmHandle[3], 0U);
EPWM_setCounterCompareShadowLoadMode(obj->pwmHandle[3],
EPWM_COUNTER_COMPARE_A,
EPWM_COMP_LOAD_ON_CNTR_ZERO);
EPWM_setCounterCompareShadowLoadMode(obj->pwmHandle[3],
EPWM_COUNTER_COMPARE_B,
EPWM_COMP_LOAD_ON_CNTR_ZERO);
EPWM_setCounterCompareValue(obj->pwmHandle[3], EPWM_COUNTER_COMPARE_A, 0);
EPWM_setCounterCompareValue(obj->pwmHandle[3], EPWM_COUNTER_COMPARE_B, 0);
EPWM_setActionQualifierAction(obj->pwmHandle[3],
EPWM_AQ_OUTPUT_A,
EPWM_AQ_OUTPUT_HIGH,
EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
EPWM_setActionQualifierAction(obj->pwmHandle[3],
EPWM_AQ_OUTPUT_A,
EPWM_AQ_OUTPUT_LOW,
EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
EPWM_setActionQualifierAction(obj->pwmHandle[3],
EPWM_AQ_OUTPUT_B,
EPWM_AQ_OUTPUT_HIGH,
EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
EPWM_setActionQualifierAction(obj->pwmHandle[3],
EPWM_AQ_OUTPUT_B,
EPWM_AQ_OUTPUT_LOW,
EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPB);
// configure sync
EPWM_setSyncOutPulseMode(obj->pwmHandle[3],
EPWM_SYNC_OUT_PULSE_ON_EPWMxSYNCIN);
EPWM_setInterruptSource(obj->pwmHandle[3], EPWM_INT_TBCTR_ZERO);
EPWM_enableInterrupt(obj->pwmHandle[3]);
EPWM_setInterruptEventCount(obj->pwmHandle[3], 1);
EPWM_disableInterrupt(obj->pwmHandle[3]); //Enabled in interrupt_enable() along with all other interrupts
}
I was looking at the example in C2000Ware_4_01_00_00\device_support\f2837xd\examples\cpu1\epwm_up_aq
In InitEPwm1Example(), the interrupt, it says generate interrupt on the third event, does this mean that the interrupt will be generated after 3 pwm cycles?
Im ny initilialization function, i am trying to generate an interrupt on every pwm cycle.
1. Is it possible to have 2 interrupts separately and mapped to different functions? (__interrupt void epwm8A() & __interrupt void epwm8B()
2. I am trying to log the active pwm cycles, so that i know exactly how many cycles the PWM is active. I am currently doing somthing like this:
__interrupt void BrCP_ISR(void)
{
if(BrCpVars[0].dutyCycle > 0)
{
BrCpVars[0].BrCpActiveCycles++;
}
if(BrCpVars[1].dutyCycle > 0)
{
BrCpVars[1].BrCpActiveCycles++;
}
EPWM_clearEventTriggerInterruptFlag(EPWM8_BASE);
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP3);
}
But the above does not match with the real data(pwm pulses), which i am measuring on a scope, Pls Help!





