Greetings,
I am currently using the MK22FN256LVH12 microcontroller with KDS v3.2 and Processor Expert.
I am looking to put the controller in a lower power mode. I currently am able to put it in a STOP mode in which it will wake up from a LPTMR from the code below.
//setup timer
LPTMR_PDD_WriteCompareReg(LPTMR0_DEVICE, 59);
LPTMR0_CSR &= ~1; //disable timer
LPTMR_PDD_EnableInterrupt(LPTMR0_DEVICE);
Later in the code I enable it and sleep. This works for DOM_SLEEP which sets it in STOP mode.
I read in the datasheet that when in VLLS1 or VLLSx that it can only be awaken by Wakeup Reset. Can this only done by hardware? There is a function I use which hard resets the controller by firmware. However, I doesnt seem like my LPTMR event is being achieved in this mode (I turn an LED on in the event where the timer overflows, and it never turns on).
Thoughts?
Solved! Go to Solution.
Hi,
LPTMR can wake up (wakeup reset) system through LLWU. There is an example in SDK package named power_mode_switch. It shows how to recover from VLLSx by LPTMR or IO pin.
Regards,
Jing
Hi Christopher,
No, you do not need to worry about that.
Regards,
Jing
Hi,
Wake up from VLLSx do not need Cpu_SystemReset(). It's a wake up reset, not interrupt. In PE Components Library, please add Init_SMC. It set the VLLS control. But I'd rather copy the code in the power_switch demo directly.
Regards,
Jing
Thank you. Do I need to worry about constantly resetting over time? Like how many times can I rewrite registers?
Hi,
LPTMR can wake up (wakeup reset) system through LLWU. There is an example in SDK package named power_mode_switch. It shows how to recover from VLLSx by LPTMR or IO pin.
Regards,
Jing
I have been able to wake up by using these ISR in my events.c file. However, I have not been able to recover unless I issue the Cpu_SystemReset(); function. That is what I at first expected, but from some readings is it necessary?
PE_ISR(Wakeup_Timer)
{
//HB_LED_ON;
LPTMR_PDD_ClearInterruptFlag(LPTMR0_DEVICE);
Cpu_SystemReset(); //Need to reset to wake back up
}
PE_ISR(LLWU_IRQ)
{
HB_LED_ON;
LPTMR_PDD_ClearInterruptFlag(LPTMR0_DEVICE); //call the LPTMR function
}