I need help at activating the interrupt from EPWM-module. I use the driver library from TI.
First I initialize the EPWM, without enabling the interrupt in EPWM-module and set the output constantly to low, with the follow function:
void InitEPWM8A(void){
EPWM_setClockPrescaler(EPWM8_BASE, EPWM_CLOCK_DIVIDER_16, EPWM_HSCLOCK_DIVIDER_1);
EPWM_setTimeBasePeriod(EPWM8_BASE, (uint16)EPWM8_TAKT);
EPWM_setTimeBaseCounter(EPWM8_BASE, 0x0U);
// possibility for initializing an interrupt at 50 µs before ending of period - using Comp_B
EPWM_setCounterCompareValue(EPWM8_BASE, EPWM_COUNTER_COMPARE_B , EPWM8_COUNT_INTERRUPT);
EPWM_setTimeBaseCounterMode(EPWM8_BASE, EPWM_COUNTER_MODE_DOWN);
EPWM_disablePhaseShiftLoad(EPWM8_BASE);
EPWM_selectPeriodLoadEvent(EPWM8_BASE, EPWM_SHADOW_LOAD_MODE_COUNTER_ZERO);
EPWM_setCounterCompareShadowLoadMode(EPWM8_BASE, EPWM_COUNTER_COMPARE_A , EPWM_COMP_LOAD_ON_CNTR_ZERO);
EPWM_setCounterCompareShadowLoadMode(EPWM8_BASE, EPWM_COUNTER_COMPARE_B , EPWM_COMP_LOAD_ON_CNTR_ZERO);
//Enabling interrupt // no enabling of interrupt Completely yet, this will be done at starting EPWM8
Interrupt_enable(INT_EPWM8);
EPWM_setInterruptSource(EPWM8_BASE, EPWM_INT_TBCTR_ZERO);
//EPWM_setInterruptSource(EPWM8_BASE, EPWM_INT_TBCTR_D_CMPB); // for testing
Interrupt_register(INT_EPWM8, isr_EPWM8); // Re-map EPWM8 interrupt signal to call the ISR function
EPWM_clearEventTriggerInterruptFlag(EPWM8_BASE);
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP3);
EPWM_setActionQualifierActionComplete(EPWM8_BASE, EPWM_AQ_OUTPUT_A , ( EPWM_AQ_OUTPUT_LOW_ZERO | EPWM_AQ_OUTPUT_LOW_DOWN_CMPA ) ); // setting output to endless zero
}
Later, comes the call to start:
void StartEPWM8(void){
EPWM_setCounterCompareValue(EPWM8_BASE, EPWM_COUNTER_COMPARE_A , ( (ACTIVE_DISCHARGE_TAKT/10)*9) );
EPWM_setActionQualifierActionComplete(EPWM8_BASE, EPWM_AQ_OUTPUT_A , (EPWM_AQ_OUTPUT_HIGH_ZERO | EPWM_AQ_OUTPUT_LOW_DOWN_CMPA) );
//Enabling interrupt
EPWM_enableInterrupt(EPWM8_BASE);
}
I have checked configuration of the registers at debugging after activation of the EPWM:
- at EPWM-register ETSEL in INTEN interrupt is enabled
- INTSEL the configuration is 001 (Interrupt at time-base counter equal to zero)
- at PieCtrlRegs the 3.8 (for EPWM8) is activated
- at IER-Register INT3 is activated.
- Also the NMIE is active and other interrupts are working
- PWM is working and I could change the value of the comparator with reaction of the PWM
But no Interrupt will occur. The function isr_EPWM8() will not called.
Now my question: Is there something missing or wrong? the function StartEPWM8() is called by an interrupt. Could this cause an issue?
Thanks for your time and with best regards