LPC2388: Cannot return to main after RTC interrupt

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC2388: Cannot return to main after RTC interrupt

370 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by m2babaey on Mon Jul 15 23:28:25 MST 2013
Hi
I have activated RTC Alarm interrupt in LPC2388 but after entering the first interrupt, it doesn't exit from the interrupt. I used Jlink to watch where is code is going and noticed after finishing interrupt code, the program remain at this line of start up code:

                IMPORT  __main
                LDR     R0, =__main
                BX      R0

So it seems it cannot return to main
__irq void RTC_IRQHandler(void) 
{
SendDailySMS=1;
RTC_AMR = 255;                  // disable alarm interrupt, will be reEnabled in code
RTC_ILR = (1UL<<1);             // Clear RTC alarm interrupt flag / 
VICVectAddr = 0;                // Acknowledge Interrupt /
}

int main(void)
{
  basic coonfiguration

  //init RTC
  PCONP|=1<<9;

  RTC_CCR=0x21;  use 32k crystal

  RTC_AMR &= ~(0x6) ; 
  RTC_AMR |= ~(0x6) ;  //only hour and minute are important for alarm interrupt

  VICVectAddr13 = (unsigned long) RTC_IRQHandler;           // set interrupt vector 13 
  VICVectPriority13 = 15 ; 
  VICIntEnable |= (1UL<<13);                                // Enable RTC Interrupt 

while(1)
{
   //rest of my code
}
}


Could you please help me where I am wrong?
Thanks
Labels (1)
0 Kudos
0 Replies