Discussion Forum

ARGGHHHH....Interrupt vector keeps getting called...!!!

Next Thread | Thread List | Previous Thread Start a Thread | Settings

DetailsMessage
Read-Only
Author
Marcus Pollard
Posted
22-Aug-2007 17:03 GMT
Toolset
ARM
New! ARGGHHHH....Interrupt vector keeps getting called...!!!

I am using the Atmel At91SAM7S-EK with the 256k micro.

I have set up a simple interrupt vector to an ISR which simply acknowledges the interrupt and then exits. However, when the interrupt is entered, it does its business and then exits, to be called again (from the startup.s code) forever after............

Here is the offending code :

void system_int (void) __irq
{        /* System Interrupt Handler */

    AT91S_AIC * pAIC = AT91C_BASE_AIC;
        AT91S_PITC * pPIT = AT91C_BASE_PITC;

    *AT91C_AIC_EOICR = pPIT->PITC_PIVR;     /* Ack & End of Interrupt */
        //*AT91C_AIC_EOICR = 0;                   /* End of Interrupt */
}


void init_timer (void) {                    /* Setup PIT with Interrupt */
  AT91S_AIC * pAIC = AT91C_BASE_AIC;

  *AT91C_PITC_PIMR = AT91C_PITC_PITIEN | AT91C_PITC_PITEN | PIV;                   /* Periodic Interval Value */

/* Setup System Interrupt Mode and Vector with Priority 7 and Enable it */
  pAIC->AIC_SMR[AT91C_ID_SYS] = AT91C_AIC_SRCTYPE_INT_EDGE_TRIGGERED | 7;
  pAIC->AIC_SVR[AT91C_ID_SYS] = (unsigned int) system_int;
  pAIC->AIC_IECR = (1 << AT91C_ID_SYS);
}

Any ideas,
yours completely lost and fed up
Marcus.

Read-Only
Author
Milorad Cvjetkovic
Posted
27-Aug-2007 13:55 GMT
Toolset
ARM
New! RE: ARGGHHHH....Interrupt vector keeps getting called...!!!

Hello Marcus,

it seems that you did not clear interrupt source so please add this code:
*AT91C_AIC_ICCR = (1 << AT91C_ID_SYS);

in your interrupt handler before line:
*AT91C_AIC_EOICR = pPIT->PITC_PIVR; /*Ack & End of interrupt */

and try then.

Next Thread | Thread List | Previous Thread Start a Thread | Settings