Discussion Forum

Problem with AIC

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

DetailsMessage
Read-Only
Author
Milan Petrzilka
Posted
5-Jul-2009 00:11 GMT
Toolset
ARM
New! Problem with AIC

Hello, I started a project using Advanced interrupt controller. HW is AT91SAM7XC256.

Source code:


void Ext0IrqHandler(void) {
__asm {
NOP
}
  AT91C_BASE_AIC->AIC_EOICR=0;
}


int main(void) {
        /** BOOT SEQUENCE **/

        /* PIO setup */
        AT91F_PIOA_CfgPMC();
        AT91F_PIOB_CfgPMC();

        /* AIC setup */
        AT91F_AIC_CfgPIO();
        AT91F_AIC_CfgPMC();

        // external interrupt 0
        pAIC->AIC_IDCR = (1<<AT91C_ID_IRQ0);   // external interrupt off in AIC
        pAIC->AIC_SVR[AT91C_ID_IRQ0] = (unsigned int)Ext0IrqHandler; // addr set
        pAIC->AIC_SMR[AT91C_ID_IRQ0] = (AT91C_AIC_SRCTYPE_POSITIVE_EDGE | 0x6);
        pAIC->AIC_IECR = (1<<AT91C_ID_IRQ0); // external interrupt on in AIC
        /** END OF BOOT SEQUENCE **/

        while(1) {
        __asm {
                NOP
                NOP
        }
        }

}

The problem is, that the processor enters into IRQ handler only once! It enters it, then goes back to main loop and then it absolutery ignore AIC's NIRQ and Pending flag. When it execute the handler once and it goes back to loop, the processor is still in Interrupt mode.. why? Please help.
Milan P

Read-Only
Author
Per Westermark
Posted
5-Jul-2009 02:06 GMT
Toolset
ARM
New! RE: Problem with AIC

You have an interrupt handler without specifying that it is an interrupt handler with the __irq keyword. Why?

Read-Only
Author
Milan Petrzilka
Posted
5-Jul-2009 08:57 GMT
Toolset
ARM
New! RE: Problem with AIC

IT WORKS NOW!!!
Thank you, so much.

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