Post Go back to editing

PWM interrupts on ADSP-21479

Hello,

The fundamental timing of the interrupt controller is Fpclk / 4. In my case that is 133 MHz / 4 = 33.25 MHz. I have a PWM period corresponding to a frequency of 2.5 MHz (checked on an oscilloscope), so the interrupt controller is running fast enough to latch the PWM interrupts. In my PWM ISR I toggle a DPI output pin, so I expect this pin to be toggled every 400 ns. However, the DPI output pin is toggled every 1 us - 1.5 us and is not in sync with the PWM interrupts!!

Here is how I configured my PWM:

SRU2(PWM1_AH_O, DPI_PB07_I  );           /* connect PWM1 to DPI pin 7  */
SRU2(HIGH,      DPI_PBEN07_I);

*pSYSCTL |= (PWMONDPIEN | PWM1EN);       /* Enable PWM1 module         */
 
*pPWMGCTL   = PWM_EN1 | PWM_SYNCEN1;   /* PWM1 enable                */

*pPWMCTL1    = 0;                        /* PWM IRQ disable            */
*pPWMPERIOD1 = PWM_PERIOD_CNTS;          /* PWM period register    = 53    */
*pPWMDT1     = 0;                        /* PWM dead time register     */
*pPWMA1       = 0;                        /* PWM channel A duty control */
*pPWMSEG1  = ~(0x04);               /* PWM output enable          */
*pPWMAL1     = 0;                        /* PWM channel AL duty ctrl   */
 
*pPICR0 &= ~(0x1F << 0);
*pPICR0 |=  (0x18 << 0);
 

*pPWMCTL1 |= PWM_IRQEN;
interrupt(SIG_P0, pwm_isr);

Here is my PWM ISR:

SRU(HIGH, DPI_PB11_I);
 
*pPWMGSTAT |= 0x000F; //acknowledge interrupt

 
SRU(LOW, DPI_PB11_I);

Does anyone have any idea what is causing this behaviour?

Thanks in advance for your support.

Kind regards,

Marc

Parents
  • Hi Marc,

    The interrupt latency will also depend upon which interrupt dispatcher function you are using as it has the code to save/restore various registers for context switching. You may want to use a fast/super fast interrupt dispatcher to reduce the latencies. One disadvantage with these dispatcher is that they may save/restore lesser registers. For more details, please refer the VisualDSP++ C compiler manual.

    Also, when you have very strict timing requirements, usually it is better to use assembly coding to get the most optimum performance.

    Thanks,

    Mitesh

Reply
  • Hi Marc,

    The interrupt latency will also depend upon which interrupt dispatcher function you are using as it has the code to save/restore various registers for context switching. You may want to use a fast/super fast interrupt dispatcher to reduce the latencies. One disadvantage with these dispatcher is that they may save/restore lesser registers. For more details, please refer the VisualDSP++ C compiler manual.

    Also, when you have very strict timing requirements, usually it is better to use assembly coding to get the most optimum performance.

    Thanks,

    Mitesh

Children
No Data