Processor: K22FN512 64-pin
Board: Custom and FRDM-K22F
IDE: KDS and Processor Expert
ErichS
Problem is I am unable to wake from LPTMR when in STOP MODE.
It works fine if I use the function
Cpu_SetOperationMode(DOM_SLEEP, NULL, NULL);
or
Cpu_SetOperationMode(DOM_WAIT, NULL, NULL);
with DOM_STOP, it never wakes.
Clock source is 32KHz crystal (confirmed it always oscillates, even in stop)
Here are the settings for the CPU

I have set up the LLWU as well, but the interrupt is never called (even in SLEEP or WAIT)

This interrupt function gets called in DOM_SLEEP or DOM_WAIT after the LPTMR0 completes the count.
PE_ISR(Wakeup_Timer)
{
LPTMR_PDD_ClearInterruptFlag(LPTMR0_DEVICE);
}
And here is the main routine that blinks LED 10 times and goes to LP mode.
for(;;){
/*
* blink led 10 times
*/
while(i<10){
HB_LED_ON;
WAIT1_Waitms(200);
HB_LED_OFF;
WAIT1_Waitms(200);
i++;
}
i=0;
/*
* go into low power mode
*/
LPTMR0_CSR |= 1; //enable timer
Cpu_SetOperationMode(DOM_STOP, NULL, NULL);//works if use DOM_WAIT or DOM_SLEEP
LPTMR0_CSR &= ~1; //disable timer
}
Thanks for your help.