I use SM470R1B1M-HT in my project. I set GIOA0 as falling edge interrupt. The following is the code related to GIOA inetrrupt:
REQMASK =(1 << CIM_COMP1) | (1 << CIM_GIOA); // Enable CMP Interrupt and GIOA Interrupt mask
GIOFLG1 |= 0x0f; //Clear interrupt flag
GIOPOL1 &= 0x00; //Falling edge active
GIODIRA &= 0x00; //GIOA pin as input
GIOPRY1 &= 0x00; //Set as slow interrupt
GIOENA1 |= 0x0f; //Enable interrupt
The following is ISR vector. There are two interrupts: RTI interrupt and GIOA interrupt.
__irq __arm void IRQ_Handler(void)
{
switch((0xff & IRQIVEC)-1)
{
case CIM_COMP1 : COMP1_irq_handler(); break;
case CIM_GIOA : GIOA_irq_handler(); break;
default: break;
}
}
The following code is the GIOA ISR. It is very simple, just set ADCPCR as high.
void GIOA_irq_handler(void )
{
GIOFLG1 |= 0x0f; // interrupt control, clear GIOA
ADCPCR |= 0x04;
}
The code never enters into GIOA ISR. I checked the flag register GIOFLG1, the flag bit was set.
Can someone tell me what is wrong with my code and how to solve this problem?