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: One PWM, two interruptions

Part Number: TMS320F28027
Other Parts Discussed in Thread: C2000WARE

Hello,

I want to use one PWM to make two interruptions, but I'm not sure if I'm doing it right.

I detect the rising edge of my ePWM1A at Zero to make the first interruption:

    EPwm1Regs.ETSEL.bit.SOCAEN  = 1;            // Enable INT for ePWM1A
    EPwm1Regs.ETSEL.bit.SOCASEL = ET_CTR_ZERO;  // Select INT on Zero
    EPwm1Regs.ETPS.bit.SOCAPRD  = ET_1ST;       // Generate INT on 1st event

Then I detect the falling edge of my ePWM1B (CNT=CMPB) to make the second interruption:

    EPwm1Regs.ETSEL.bit.SOCBEN  = 1;            // Enable INT for ePWM1B
    EPwm1Regs.ETSEL.bit.SOCBSEL = ET_CTRU_CMPB; // Select INT when CNT = CMPB, up count
    EPwm1Regs.ETPS.bit.SOCBPRD  = ET_1ST;       // Generate INT on 1st event

To link each trigger to the right interruption, I did this in my main function:

    PieVectTable.EPWM1_INT = &epwm1_isr;
    PieVectTable.EPWM1_INT = &adc_isr;

Is it enough ? I feel like something is missing...

Thank you

  • Hi Caio,

    Please take a look at the following example for a reference on using the interrupts.

    C:\ti\c2000\C2000Ware_version\device_support\f2802x\examples\structs\epwm_timer_interrupts

      EPwm1Regs.ETSEL.bit.SOCAEN  = 1;            // Enable INT for ePWM1A

    Doing this will only enable the trigger on SOCA it doesnt actually configure an interrupt. Instead of these bits you should look at the INTSEL and INTEN bits within the ETSEL register. 

    Best Regards,

    Marlyn