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.
Hi der people,
by my application I need to generate two interrupts per ePWM-Period. The one on TBCTR = CMPA, the other on TBCTR = CMPB.
Now, if I understood correctly, when I set
EPwm2Regs.ETSEL.bit.INTSELCMP = 0; // Enable event time-base counter equal to CMPA or to CMPB when the timer is incrementing to INTSEL selection mux.
EPwm1Regs.ETSEL.bit.INTSEL = 100; // 100: Enable event time-base counter equal to CMPA or CMPC when the timer is incrementing
I would get an interrupt on CMPA
This means, if I also want an interrupt on CMPB I need to change the register inside the interrupt routine to this :
EPwm1Regs.ETSEL.bit.INTSEL = 110; // 110: Enable event: time-base counter equal to CMPB or CMPD when the timer is incrementing
And set it back by the next inerrupt to
EPwm1Regs.ETSEL.bit.INTSEL = 100;
Is there another way I am overlooking?
Thanks and best regards!
Gustavo
Unfortunately, the feature you are looking for doesn't exist. There is no register you can set to get both CMPA and CMPB to cause an interrupt. The first solution for this, you have already implemented, which is switching the interrupt source in the ISR, knowing whether CMPA happens first or CMPB.
There is another option, you can sync an unused EPWM, lets say EPWMy to operate exactly as EPWMx (your original EPWM) and have interrupts for it occur at CMPB. This way you have both interrupts.
Nima Eskandari