Content originally posted in LPCWare by artk on Wed Apr 20 16:34:48 MST 2011
Hello all, I've been trying for a couple of days now to get my LPC1769 board running FreeRTOS to either go into sleep or into deep power down without much success. Some advise would be much appreciated.
I'm using the RTC to schedule a waking interrupt.
The code in question:
Quote:
RTC_Init( LPC_RTC );
RTC_CntIncrIntConfig( LPC_RTC, RTC_TIMETYPE_SECOND, DISABLE );
RTC_AlarmIntConfig( LPC_RTC, RTC_TIMETYPE_SECOND, ENABLE );
RTC_ClearIntPending( LPC_RTC, RTC_INT_ALARM );
while(1){
RTC_SetTime( LPC_RTC, RTC_TIMETYPE_SECOND, 0 );
RTC_SetAlarmTime( LPC_RTC, RTC_TIMETYPE_SECOND, 5 );
RTC_ResetClockTickCounter( LPC_RTC );
RTC_Cmd( LPC_RTC, ENABLE );
NVIC_EnableIRQ( RTC_IRQn );
consoleprint("Good night 3O...\n");
CLKPWR_Sleep();
consoleprint(";O Good morning...\n");
}
void RTC_IRQHandler( void ) {
if ( RTC_GetIntPending( LPC_RTC, RTC_INT_ALARM ) ) {
RTC_ClearIntPending( LPC_RTC, RTC_INT_ALARM );
RTC_Cmd( LPC_RTC, DISABLE );
NVIC_DisableIRQ( RTC_IRQn );
}
}
The problem:
When I run my code in main, it works as expected: every 5 seconds I manage to print to the console. I then create a task/thread and cut and paste the same code into this new task. Now, there is no 5 second wait.
I've determined that if I replace CLKPWR_Sleep(); with a while(1) and place a breakpoint in the IRQ handler, the interrupt is indeed occuring. With CLKPWR_Sleep(), the IRQ handler is never entered.
Suggestions? Thank you very much!