AnsweredAssumed Answered

how to generate 1 msec interrupt using general purpose timer in ADSP BF548

Question asked by amar26121993 on Apr 14, 2017
Latest reply on Apr 24, 2017 by Jithul_Janardhanan

here is my configuration for generating interrupt for 1 msec

void Init_TIMER1(void)
{

*pTIMER1_CONFIG|=((1<<0)|(1<<2)|(1<<3)|(1<<4));//Timer interrupt enable
*pTIMER_ENABLE0|=(1<<1);//Enable Timer 1
ssync();
asm("ssync;");
*pTIMER1_PERIOD = 0x21598;
*pTIMER1_WIDTH = 0x10ACC;
ssync();

}

void Init_Timer1_Interrupts(void)
{
ssync();

// Register Interrupt Handlers and Enable Core Interrupts
*pSIC_IMASK2 = (*pSIC_IMASK2 | 0x00800000);
register_handler(ik_ivg11, Timer1_ISR); // Timer1 ISR -> IVG 11
ssync();
}

int main()
{
sysconfig();
adi_ssl_Init();

ledblink();
Init_Timer1_Interrupts();
Init_TIMER1();
*pPORTG_CLEAR|=((1<<6)|(1<<8)|(1<<10)|(1<<7)|(1<<9)|(1<<11));
   while(1)
   {
   }
}

EX_INTERRUPT_HANDLER(Timer1_ISR)
{
static int i=0;
   // Clear Timer1 Interrupt
   *pTIMER_STATUS0=(*pTIMER_STATUS0 | 0x0002);

if(i==0)
   {
         *pPORTG_SET|=((1<<6)|(1<<8)|(1<<10)|(1<<7)|(1<<9)|(1<<11));
      i=1;

   }

   else if(i==1)
   {
      *pPORTG_CLEAR|=((1<<6)|(1<<8)|(1<<10)|(1<<7)|(1<<9)|(1<<11));
      i=0;
   }
}

hi iam using ADSP BF 548 series proccesssor, Here the problem is timer interrupt is happening 10-15 seconds after program execution.after that the interrupt is happening for 1 msec continously. iam unable to find the initial delay for interrupt, and also if anyone know the timer calculation for generating 1msec i.e value to put into period register ,scale register and width  register ,please relpy with the calculation.

 

regards

Amar TR. 

Outcomes