[riot-users] Riot OS - Problem with pm_layered API

Alexandre Abadie alexandre.abadie at inria.fr
Wed May 22 09:39:44 CEST 2019


Hi Thibaud, 

Welcome and thanks for your interest in RIOT! 
I also apologize for replying so late. 

STOP and STANDBY low-power modes are supported on STM32F1 so you should be able to make it work. 

I guess you already read the very minimal pm_layered module documentation [1]. 

Calling "pm_set_lowest" won't switch to deep sleep modes because they are all blocked by default [2]. The simplest way is to directly call "pm_set" from your application code to force the switch to STOP (1) or STANDBY (0) low-power modes. 
The other (preferred) way is to globally unblock one (or more) mode by setting CFLAGS += '-DPM_BLOCKER_INITIAL={ .val_u32 = 0x01010001 }' (here it unblocks STOP mode) and to "let" RIOT switch to low-power mode when it switches to the idle thread. 

You also need to think of a way to wakeup the CPU: either via an interrupt, this will work with STOP mode and STANDBY mode (if a wakeup pin is enabled [3]), or using an RTC alarm (not yet supported on F1, but there's a PR for this [4]). 

> Do you have any simple example of how to use pm_layered API (preferably with STM32 core) ? 

You can have a look at [5] where the updated "examples/lorawan" application plays with "pm_unblock"/"pm_block" functions to automatically switch to low-power modes: you'll have to remove the lorawan related parts and integrate the PR adding RTC to make it work on stm32f1. 

Let us know if you still have any problems and we'll try to help. 

Regards, 

Alex 

[1] http://doc.riot-os.org/group__sys__pm__layered.html 
[2] https://github.com/RIOT-OS/RIOT/blob/master/sys/pm_layered/pm.c#L33 
[3] https://github.com/RIOT-OS/RIOT/blob/master/cpu/stm32_common/include/periph_cpu_common.h#L98 
[4] https://github.com/RIOT-OS/RIOT/pull/11258 
[5] https://github.com/RIOT-OS/RIOT/pull/11552 

----- Le 15 Mai 19, à 13:42, Thibaud Vial <thibaudvial69 at gmail.com> a écrit : 



Hi, 

I'm trying to use pm_layered API with Bluepill board (STM32F103). I've wrote a simple code, creating a thread and executing it every minute. The thread just toggle the embedded LED. 

I want the MCU to be in sleep mode when not in used (after changing the LED state, and during a minute). I tried using pm_set_lowest(), but there's no difference : the MCU consumes about 12mA. 

I'm a firmware beginner, so I surely do something wrong. Do you have any simple example of how to use pm_layered API (preferably with STM32 core) ? 

Thank you for your help, 
Thibaud. 


_______________________________________________ 
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/20190522/a17a403a/attachment.html>


More information about the users mailing list