- Notifications
You must be signed in to change notification settings - Fork55
stm32duino/STM32LowPower
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Arduino library to support STM32 Low Power.
- Arduino_Core_STM32 version >= 1.3.0
- STM32RTC
void begin(): configure the Low Powervoid idle(uint32_t ms): enter in idle modeparam ms (optional): number of milliseconds before to exit the mode. The RTC is used in alarm mode to wakeup the chip in ms milliseconds.void sleep(uint32_t ms): enter in sleep modeparam ms (optional): number of milliseconds before to exit the mode. The RTC is used in alarm mode to wakeup the chip in ms milliseconds.void deepSleep(uint32_t ms): enter in deepSleep modeparam ms (optional): number of milliseconds before to exit the mode. The RTC is used in alarm mode to wakeup the chip in ms milliseconds.void shutdown(uint32_t ms): enter in shutdown modeparam ms (optional): number of milliseconds before to exit the mode. The RTC is used in alarm mode to wakeup the board in ms milliseconds.
Note
WithSTM32RTC version lower than 1.1.0, the minimum number of milliseconds is 1000 ms.**
void attachInterruptWakeup(uint32_t pin, voidFuncPtrVoid callback, uint32_t mode, LP_Mode LowPowerMode): Enable GPIO pin in interrupt mode. If the pin is a wakeup pin, it is configured as wakeup source (see board documentation).param pin: pin number
param callback: pointer to callback
param mode: interrupt mode (HIGH, LOW, RISING, FALLING or CHANGE)param LowPowerMode: Low power mode which will be used (IDLE_MODE, SLEEP_MODE, DEEP_SLEEP_MODE or SHUTDOWN_MODE). In case of SHUTDOWN_MODE only, Wakeup pin capability is activated.void enableWakeupFrom(HardwareSerial *serial, voidFuncPtrVoid callback): enable a UART peripheral in low power mode. See board documentation for low power mode compatibility.
param serial: pointer to a UART
param callback: pointer to a callback to call when the board is waked up.void enableWakeupFrom(STM32RTC *rtc, voidFuncPtr callback, void * data)attach a callback to the RTC peripheral.
param rtc: pointer to RTC. Could be NULL as RTC is a Singleton.
param callback: pointer to a callback to call when the board is waked up.
param callback: data: optional pointer to callback data parameters (default NULL).void enableWakeupFrom(TwoWire *wire, voidFuncPtrVoid callback):enable an I2C peripheral in low power mode. See board documentation for low power mode compatibility.Currently not available.
param wire: pointer to I2C
param callback: pointer to a callback to call when the board is waked up.
Begin() function must be called at least once beforeidle(),sleep(),deepSleep() orshutdown() functions.
attachInterruptWakeup() orenableWakeupFrom() functions should be called beforeidle(),sleep(),deepSleep() orshutdown() functions.
Important
HardwareSerial used as Wakeup source will configure it to use HSI clock source even if another peripheral clock is configured.
RTC used as Wakeup source requires to have LSE or LSI as clock source. If one of them is used nothing is changed else it will configure it to use LSI clock source. One exception exists when
SHUTDOWN_MODEis requested andPWR_CR1_LPMSis defined, in that case LSE is required. So, if the board does not have LSE, it will fail.The board will restart when exit shutdown mode.
Important
For STM32WB0x and STM32WL3x:
- board will restart when exit shutdown mode and deep sleep.
- Shutdown wakeup only with reset pin.
- Wakeup from UART not supported.
Idle mode: low wake-up latency (µs range) (e.g. ARM WFI). Memories andvoltage supplies are retained. Minimal power saving mainly on the core itself.
sleep mode: low wake-up latency (µs range) (e.g. ARM WFI), Memories andvoltage supplies are retained. Minimal power saving mainly on the core itself buthigher than idle mode.
deep sleep mode: medium latency (ms range), clocks are gated to reduced. Memoriesand voltage supplies are retained. If supported, Peripherals wake-up is possible (UART, I2C ...).
shutdown mode: high wake-up latency (possible hundereds of ms or secondtimeframe), voltage supplies are cut except always-on domain, memory contentare lost and system basically reboots.
You can find the source files at
https://github.com/stm32duino/STM32LowPower
About
Arduino Low Power library for STM32
Topics
Resources
Code of conduct
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.