[riot-users] Cortex Kinetis KW2xD Low Power Modes

Matthew Blue matthew.blue.neuro at gmail.com
Wed May 16 08:56:01 CEST 2018

Hi Olivier,

Unfortunately, it seems that low power management hasn't gotten a lot
of love for most platforms yet. The basic API is in place though, if you
wish to implement it on your platform.

Relevant files:

The PR that introduced power management:

This command will let you find a few areas where the API has been used:
grep -r -e 'pm_[un]*block' -e pm_set

In general I think the idea is to number the power modes such that you:
* Start by giving your lowest power mode 0
* Then find the next lowest power mode that supports features that are
  a superset of the features supported by 0, and make that mode 1
* Repeat until you run out of power modes.

You then write a function pm_set in cpu/*/periph/pm.c that implements
switching the power modes. And also you set up anything that can't run
in a certain power mode to pm_block that mode, and then to pm_unblock
when it stops running. I think the kernel then handles the rest.

There may be some details I missed, because I am not super-familiar
with the system, but this should give you a good start.

Good luck!
Matthew Blue

On Wed, 16 May 2018 08:06:45 +0200
Olivier Fauchon <ofauchon2204 at gmail.com> wrote:

> Hello,
> I'm using RIOT with KW2xD Kinetis MCU for Wireless sensors.
> I could observe that the board's current is 10mA when idle which is
> too high for long battery
> operation.
> The application note :
> http://cache.freescale.com/files/32bit/doc/app_note/AN4503.pdf),
> says there are Very Low Power Run / Wait / Stop modes.
> There are at lease these functions to integrate in RIOT Kernel.
> void enter_vlpr(void); => Enter low power run mode
> void exit_vlpr(void);  => Go back in regular power run mode
> void enter_vlps(void); => Go to low power sleep
> What is the correct way to integrate this low power mode in Riot Power
> management?
> Are there existing implementation for these low power modes for other
> MCUs to take in example ?
> Thanks
> Olivier

More information about the users mailing list