Hello,
I want to configure a timer interrupt with the PWM mode of adsp21489, but no matter how I modify the value of pwmperiod, the time when it enters the interrupt remains unchanged. I don't know why. Can you answer my doubts? Below is my code and the instructions in the official hardware manual.
1.Below is my code(Time difference measured by clock function):
//Peripheral Timer interrupt service routine
void timer_isr (int sig)
{
*pTM0STAT = TIM0IRQ; //clear flagit
EndTime = clock();
printf("float operations cost:%u Cycles\n", (EndTime - StartTime));
printf("timer0 interrupt!\n");
}
void main()
{
initPLL_SDRAM();
Init_SRU();
interrupts (SIG_P2, timer_isr);
Init_Timer0();
StartTime = clock();
while(1)
{;}
}
void Init_SRU()
{
SRU(HIGH,DPI_PBEN01_I);
SRU(TIMER0_O,DPI_PB01_I);
}
void Init_Timer0()
{
int TimEn;
*pTM0CTL=PULSE|IRQEN|PRDCNT|TIMODEPWM;
*pTM0PRD=0x1B7;
*pTM0W=0x112;
*pTM0CNT=0x1;
TimEn=*pTMSTAT;
TimEn |= TIM0EN;
*pTMSTAT=TimEn;
}
2.Below is the hardware manual: