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.

TMS320F28027: EPWM multiple interrupts

Part Number: TMS320F28027


Dear All,

I need to generate two interrupts one another one from EPWM module (i. CMPA=CTR rising slope, ii. CMPA=CTR falling slope).

I have tested the code for one interrupt it is working fine, when I going for second interrupt its not.

I have shared my interrupt portion below,

EPwm1Regs.ETSEL.bit.INTEN = 1; // Enable INT
EPwm1Regs.ETSEL.bit.INTSEL = ET_CTRD_CMPA; // Select INT on CMPA==CTR event on falling slope
EPwm1Regs.ETPS.bit.INTPRD = ET_1ST; // Generate INT on 1st event

EPwm1Regs.ETSEL.bit.INTEN = 1; // Enable INT
EPwm1Regs.ETSEL.bit.INTSEL = ET_CTRU_CMPA; // Select INT on CMPA==CTR event on rising slope
EPwm1Regs.ETPS.bit.INTPRD = ET_1ST; // Generate INT on 1st event

Please let me know how I can generate multiple pwm interrupts.

Thank you,

  

  • Prakash,

    you when writing: EPwm1Regs.ETSEL.bit.INTSEL = ET_CTRU_CMPA;

    this over writes your previous configuration that you enabled here : EPwm1Regs.ETSEL.bit.INTSEL = ET_CTRD_CMPA;

    There is no option to enable both at the same time on one PWM. This leaves you with a couple options.

    1. Re-configure your intsel everytime you enter your ISR toggeling betwee CTRU and CTRD.
    2. Use your PWM to generate the CTRU pulse and a second PWM to generate your CTRD pulse. 

    Regards,
    Cody