Deep Sleep seems to disable RTC interrupt

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

Deep Sleep seems to disable RTC interrupt

512 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nkarakotas on Fri Jul 12 19:14:55 MST 2013
Hi,

Im using FreeRtos with Tickless enabled. When I try and go into deep sleep the RTC interrupt doesnt seem to fire. When I try it with sleep mode I can see it firing.
Am I missing something?

RTC Code

    RTC_Init(LPC_RTC);
/* Disable RTC interrupt */
NVIC_DisableIRQ(RTC_IRQn);
/* preemption = 1, sub-priority = 1 */
NVIC_SetPriority(RTC_IRQn, configRTC_INTERRUPT_PRIORITY);
/* Enable rtc (starts increase the tick counter and second counter register) */
//RTC_ResetClockTickCounter(LPC_RTC);
RTC_Cmd(LPC_RTC, ENABLE);
RTC_CalibCounterCmd(LPC_RTC, DISABLE);

/* Set the CIIR for second counter interrupt*/
RTC_CntIncrIntConfig (LPC_RTC, RTC_TIMETYPE_SECOND, ENABLE);
RTC_AlarmIntConfig(LPC_RTC,RTC_TIMETYPE_SECOND,ENABLE);
RTC_SetAlarmTime (LPC_RTC, RTC_TIMETYPE_SECOND, 2);

/* Enable RTC interrupt */
NVIC_EnableIRQ(RTC_IRQn);



Sleep mode

void RTC_IRQHandler(void)
{
static uint32_t tick=0;
/* This is increment counter interrupt*/
if (RTC_GetIntPending(LPC_RTC, RTC_INT_COUNTER_INCREASE))
{
// Clear pending interrupt
tick++;
RTC_ClearIntPending(LPC_RTC, RTC_INT_COUNTER_INCREASE);

}

if(RTC_GetIntPending(LPC_RTC,RTC_INT_ALARM)){
RTC_ClearIntPending(LPC_RTC,RTC_INT_ALARM);
WDT_Feed();
if(tick % 2)
GPIO_SetValue(2, 1<<9);
else
GPIO_ClearValue(2, 1<<9);
}

}

void vPreSleepProcessing( unsigned long xExpectedIdleTime ){
deepsleep();

}

void vPostSleepProcessing( unsigned long xExpectedIdleTime ){

//SystemInit();
}




Nick
Labels (1)
0 Kudos
0 Replies