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?
LLS and Wake-up are now fully functional. However, I damaged the MCU when I was trying to lower the power consumption of the KL25Z-Board, which was extremely high (~20 mA) for battery-powered applications.
I followed these instructions:
https://mcuoneclipse.com/2013/10/20/tutorial-using-the-frdm-kl25z-as-low-power-board/
which worked well until I probably accidentally connected my power supply to the wrong pin.
As my KL25Z was gone, I used the KL43Z instead and repeated all steps. This time I used a direct, unregulated 3.3V input instead of 9V input for power supply.
The KL43Z MCU itself now drains about 2 uA thanks to LLS mode.
The KL43Z-Board however drained about 10,8 mA from the 3.3V input pin, even with openSDA module disabled. At this point my KL25Z-Board was far better with a current drain of < 4 mA (through the 9V_in pin).
I found out that the Magnetometer was consuming 10 mA of current and after removing it from the PCB and some optimizing of the accelerometer usage (fortunately the accelerometer interrupt can wake up the KL43Z MCU), I got a total current drain of ~70 uA now.
Hi @Robin4
I'll look into your questions.
Meanwhile I would like to do some recommendations:
Change your development to MCUXpresso IDE instead of kinetis design studio.
Please read this application notes
Power Management for Kinetis MCUs
Power Management for Kinetis L Family
Using Low Power Modes on Kinetis Family
Best Regards, Miguel.
Thanks, I will consider using that IDE.
Solved the problem. Found an example code showing that it is also necessary to use an assembler command
__asm("WFI")
to enter LLS mode.
Now it works. Just have to figure out now how to activate the Low Power Timer LPTMR0 and use it as wake up interrupt.
Wanted to use one of the 2 Accelerometer interrupt signals but unfortunately they are not connected to any LLWU Pins.