LPC17xx sleep modes and software reset error when invoked in interrupt

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

LPC17xx sleep modes and software reset error when invoked in interrupt

907 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wlamers on Mon Aug 27 12:48:59 MST 2012
Hello All,

I have a problem with both the sleepmodes and NVIC_reset(), aka software reset.

The problem is present on two totally distinct boards, both with a LPC1769 uC.

If I enter the sleepmode within main() or another function, except an interrupt routine, the sleep mode is working perfecly. The uC wakes also with an external interrupt on EINT0. The reset function does its job also well in the main function.

But when a sleepmode or reset request is invoked inside an interrupt routine trouble starts. The sleep mode lookes to be entered but the uC does not wake up anymore.

E.g. enter a sleep mode with EINT1 and wake with EINT0:

void EINT0_IRQHandler(void)
{
  EXTI_ClearEXTIFlag(0);
}

void EINT1_IRQHandler(void)
{
    EXTI_ClearEXTIFlag(1);
    CLKPWR_Sleep();
}

Anybody a clue why this does not work properly?
Labels (1)
0 Kudos
3 Replies

574 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Lien.Nguyen on Tue Aug 28 19:40:00 MST 2012
I dont think entering sleep mode in interrupt routine is a good idea. In this routine, you should do short tasks. You can just update some flag for example and then the main will do all remaining tasks.

Best Regards,
Lien
0 Kudos

574 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wlamers on Tue Aug 28 01:56:08 MST 2012
This should be the case when using the default priority list (18 is higher then 19). But only when I change the priority manually the interrupt works while sleeping.

The problem is somewhat more complicated. The thing I want to accomplish is to make an on/off button which first puts the uC in sleep mode and when pressed for a second time (same button same interrupt) resets the uC using a watchdog timer. This works well when using two buttons with two distinct interrupt routines. But when using only one interrupt routine (EINT0) I end up in the with the same problem that the uC does not wake anymore due to the fact that when the uC has entered sleep mode it is still in the interrupt routine with the same priority. Changing the priority to a lower (higher prio) value before entering sleep does not help either.

You would think that this kind of functionality is required very often, but I do not have seen anybody doing it. At least on the web.

This is the code:

void EINT0_IRQHandler(void)
{
    EXTI_ClearEXTIFlag(0);
    CLKPWR_Sleep();
    WDT_Init(WDT_CLKSRC_IRC, WDT_MODE_RESET);
    WDT_Start(1);
}

Does someone knows a way of accomplishing such a functionality?
0 Kudos

574 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Karl on Mon Aug 27 13:23:48 MST 2012
Does the EINT0 interrupt have a higher priority than EINT1?
0 Kudos