AnsweredAssumed Answered

PWM Interrupt in ADSP-21469 ezkit using CCES

Question asked by FerCh on Oct 10, 2014
Latest reply on Oct 14, 2014 by Jithul_Janardhanan

Hi to all!

 

I am new to Sharc processors and I am trying to set up a PWM interrupt. I already configured the PWM, set-up the interrupt and the ISR serving but nothing is happening (SEE CODE BELOW).  Is there anything missing? or wrong?. Any advice is appreciated!

 

Thanks in Advance!!

 

//PWM Configuration:

#define PWMPERIOD 567

void initPWM(void) {

 

  *pPWMPERIOD1 = PWMPERIOD;

  *pPWMDT1 = 0;

  *pPWMPOL1 = PWM_POL1AL | PWM_POL1AH | PWM_POL1BL | PWM_POL1BH;

  *pPWMSEG1 = 0;

  *pPWMCTL1 =(PWM_ALIGN|PWM_PAIR|PWM_IRQEN);      //Enable Interrupts

 

  *pSYSCTL |= (PWM1EN);

  *pPWMGCTL |= PWM_EN1 | PWM_DIS0 | PWM_DIS2 | PWM_DIS3;

 

  *pPWMA1 = 0; //%50

  *pPWMB1 = 0; //%50

}




// Set up PWM-Interrupt

    *pPICR0 |= 0x18;

    ADI_INT_STATUS res =adi_int_InstallHandler( ADI_CID_P0I,

                                        isrPWM,        /*handler*/

                                        NULL,        

                                        true            /*do enable*/

      );

 

 

// ISR serving

void isrPWM(void)

{

  *pPWMA1 =(unsigned int) (PWMPERIOD*0.7) - (PWMPERIOD/2);

 

    /*The ISR needs to clear the status bits of the PWMGSTAT register by explicitly writing 1 into the status bit*/

    *pPWMGSTAT |= PWM_STAT0;

}

Outcomes