[riot-users] Cortex Kinetis KW2xD Low Power Modes

Joakim Nohlgård joakim.nohlgard at eistec.se
Sat May 19 22:51:15 CEST 2018


My guess is that your board uses xtimer with the PIT timer hardware, try
using the LPTMR instead. See the frdm-kw41z configuration for an example
config (board.h, periph_conf.h). I think Mulle has a config example as well
but it is disabled by default.
You might find the timer refactoring PRs helpful [1], [2], [3] (any help
with testing and reviewing is welcome!)
You might also have the UART RX blocking power modes if you don't configure
the llwu pin in the UART config. Clocking mode will affect the reliability
of the UART in low power mode, some clock modes take too long to recover
from sleep mode so you will miss the first few characters on RX. Use FEI if
unsure.

Best regards,
Joakim

[1]: https://github.com/RIOT-OS/RIOT/pull/8933
[2]: https://github.com/RIOT-OS/RIOT/pull/8814
[3]: https://github.com/RIOT-OS/RIOT/pull/8830

/Joakim

On Sat, May 19, 2018, 22:24 Olivier Fauchon <ofauchon2204 at gmail.com> wrote:

> Joakim, Matthew,
>
> Thanks for your help.
>
> @Joakim: I cloned your repository, I checkout the pr/kinetis-pm branch and
> rebase from master
> Then I turned ENABLE_LEDS 1 in pm.c to facilitate debugging.
>
> I build a sample application with a very simple main() loop:
>
> while (1){
>    printf("*** pause 5s ***\n");
>    xtimer_sleep(5);
> }
>
> With this setup, I could run the above code, but the MCU is  idling
> in KINETIS_PM_WAIT mode
> (Lowest power saving ?).
>
> Maybe I missed something in my Makefiles  or includes (llwu, pm_layered ?)
> to enable the advanced power saving modes ?
>
> Are there changes to make on the board I use (pba-d-01-kw2x) too  ?
>
> Do you have a test application I can use as a reference implementation ?
>
> Thanks
>
> Olivier Fauchon
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> 2018-05-16 20:07 GMT+02:00 Joakim Nohlgård <joakim.nohlgard at eistec.se>:
>
>> Hi Olivier,
>> Welcome to RIOT!
>> There is a pull request to integrate stop modes for the Kinetis CPUs [1].
>> There's no VLPR or VLPW yet, but STOP, VLPS, and LLS are working. It does
>> need a rebase though.
>> We could use some help reviewing this and some other related Kinetis pull
>> requests [2], [3], [4] if you would like to help with this. Feel free to
>> open new PRs for any other improvements you may have.
>>
>> [1]: https://github.com/RIOT-OS/RIOT/pull/7897
>> [2]: https://github.com/RIOT-OS/RIOT/pull/8930
>> [3]: https://github.com/RIOT-OS/RIOT/pull/8933
>> [4]: https://github.com/RIOT-OS/RIOT/pull/8814
>>
>> Best regards,
>> Joakim
>>
>> On Wed, May 16, 2018, 09:01 Matthew Blue <matthew.blue.neuro at gmail.com>
>> wrote:
>>
>>> 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:
>>> sys/include/pm_layered.h
>>> sys/pm_layered/pm.c
>>> drivers/include/periph/pm.h
>>> drivers/periph_common/pm.c
>>>
>>> The PR that introduced power management:
>>> https://github.com/RIOT-OS/RIOT/pull/6160
>>>
>>> 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
>>>
>>> _______________________________________________
>>> users mailing list
>>> users at riot-os.org
>>> https://lists.riot-os.org/mailman/listinfo/users
>>>
>>
>> _______________________________________________
>> users mailing list
>> users at riot-os.org
>> https://lists.riot-os.org/mailman/listinfo/users
>>
>>
> _______________________________________________
> users mailing list
> users at riot-os.org
> https://lists.riot-os.org/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/users/attachments/20180519/622b6606/attachment-0001.html>


More information about the users mailing list