Dragos Adrian Musoiu

MKW2xD Low Power considerations

Discussion created by Dragos Adrian Musoiu Employee on Oct 3, 2014

System considerations

 

The MKW2xD family incorporates a complete low power 2.4GHz
radio frequency transceiver and a Kinetis family low power ARM Cortex M4 based
MCU into a single package. Therefore a low power mode for this SiP is a
combination between a transceiver low power mode and a MCU low power mode. Out
of reset the MCG is in its default FEI mode. Initialization software configures
the transceiver to provide a 4MHz clock to the MCU and then switch the MCG mode
from FEI to PEE. There are two types of low power modes defined: sleep modes (based
on the ARM sleep mode) and deep sleep modes (based on the ARM deep sleep modes).

 

When/How to enter low power

 

The system should enter low power when the entire system is
idle and all software layers agree on that. So, the system enters low power on
idle task, which runs only when there are no events for other tasks. The user
shall place a call to the function PWR_EnterLowPower in its idle task through a
construction like bellow:

  if (PWR_CheckIfDeviceCanGoToSleep())

    {

        wakeupReason = PWR_EnterLowPower();

    }

Each software layer/entity running on the system can prevent it from entering low power by
calling PWR_DisallowDeviceToSleep(). The system will stay awake until all software
layers that called PWR_DisallowDeviceToSleep() call back PWR_AllowDeviceToSleep() and
the system reaches idle task. The system will enter either sleep or deep sleep
depending on the type of the timers started. Low power timers are the only
timers that do not prevent the system from entering deep sleep. If any other
timers are started the system will enter in sleep instead of deep sleep. So, if
you want the system to enter deep sleep, stop all timers other then low power
ones. Be aware that functions like LED_StartFlash starts timers which will
prevent the system from entering deep sleep.

 

Deep sleep modes

 

The user can choose one out of fifteen low power modes at
compile time by setting the value of cPWR_DeepSleepMode define in the
PWR_Configuration.h register. They are combinations of MCU deep sleep modes (VLPS,
LLS or VLLS), transceiver low power modes (doze or hibernate), and wakeup sources
(LPTMR, RTC, GPIO, transceiver timer, UART) and are extensively described in PWR_Configuration.h
header file.

 

Entering deep sleep mechanism

 

Let’s take deep sleep mode 10(default deep sleep mode) as
example. MCU should put transceiver to hibernate and then enter LLS itself.
Since MCU is clocked by the transceiver, the first thing to do is to switch the
clock configuration from PEE to FEI. Now the MCU is clocked by its slow internal
reference clock and it continues the procedure by putting the transceiver to
hibernate. Next the LPTMR is configured and started to clock the wakeup timeout
and MCU enters LLS. When deep sleep ends, the MCU updates wakeup reason, stops LPTMR
clock, gets the transceiver out of hibernate, configures it to output the 4MHz
clock and switches the clock configuration back to PEE. Last thing to do is to
synchronize low power timers with the timeout value (clocked by LPTMR) and the
system is ready to start.

Outcomes