Hello,
I'm using the FRDM-KL25Z board for building up a motocycle alarm system (including the accelerometer).
Using Kinetis Design Studio with SDK 1.x
Not using Processor Expert. Coding all myself.
The problem is that in it's default settings, this board drains my battery empty very fast, so I want to configure a Low Power Mode (LLS).
The manual says:
To make a transition from RUN to LLS the following trigger conditions need to occur:
PMPROT[ALLS]=1, PMCTRL[STOPM]=011, Sleep-now or
sleep-on-exit modes entered with SLEEPDEEP set, which is
controlled in System Control Register in ARM core
So in my code at the beginning, right after setting up clock modes, I put
SMC_PMPROT |= (1<<3);
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
At some point I want to enter the LLS mode with
SMC_PMCTRL |= 0x3U;
The controller however remains in RUN mode.
Reading SMC_PMSTAT delivers 0b00000001 (current power mode is RUN)
and also the Stop Aborted bit in SMC_PMCTRL register remains zero.
What am I doing wrong? Do I have to implement a Wake Up routine first otherwise LLS (or other stop modes) are not allowed? Wrong order when writing the registers?