This class provides an API to assist with low power behaviour on an STM32F437 micro, as used on the u-blox C030 board. If you need to operate from battery for any significant period, or are mains powered and don't want to take the planet down with you, you should design your code with this in mind. This library uses the https://developer.mbed.org/users/Sissors/code/WakeUp/ library and so could be extended to support all of the MCUs that library supports.
Dependencies: WakeUp
Dependents: example-low-power-sleep aconnoCellularGnss
readme.txt@3:442c9afc0229, 2017-04-11 (annotated)
- Committer:
- RobMeades
- Date:
- Tue Apr 11 09:57:37 2017 +0000
- Revision:
- 3:442c9afc0229
- Parent:
- 1:4f2c412dc013
- Child:
- 4:691e6b38fc54
Change Doxygen comment format to match mbed on-line IDE's somewhat restrictive expectations.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
RobMeades | 3:442c9afc0229 | 1 | This class provides an API to assist with low power behaviour on an STM32F437 |
RobMeades | 3:442c9afc0229 | 2 | micro. If you need to operate from battery for any significant period, or are |
RobMeades | 3:442c9afc0229 | 3 | mains powered and don't want to take the planet down with you, you should design |
RobMeades | 3:442c9afc0229 | 4 | your code with this in mind. |
RobMeades | 3:442c9afc0229 | 5 | |
RobMeades | 3:442c9afc0229 | 6 | This library uses the https://developer.mbed.org/users/Sissors/code/WakeUp/ |
RobMeades | 3:442c9afc0229 | 7 | library and so could be extended to support all of the MCUs that library |
RobMeades | 3:442c9afc0229 | 8 | supports. |
rob.meades@u-blox.com | 1:4f2c412dc013 | 9 | |
RobMeades | 3:442c9afc0229 | 10 | The principle is that the STM32F437 is put into Stop mode (typical current |
RobMeades | 3:442c9afc0229 | 11 | consumption 230 uA @ 1.8 V) for a specified time. In Stop mode the main clocks |
RobMeades | 3:442c9afc0229 | 12 | are stopped (so software timers are frozen) and the processor is running from |
RobMeades | 3:442c9afc0229 | 13 | an internal 32 kHz oscillator. Wake-up from this state after the specified delay |
RobMeades | 3:442c9afc0229 | 14 | is achieved using an alarm from the RTC. |
rob.meades@u-blox.com | 1:4f2c412dc013 | 15 | |
RobMeades | 3:442c9afc0229 | 16 | In addition to this, it is possible to save significantly more power by putting |
RobMeades | 3:442c9afc0229 | 17 | the STM32F437 into Standby mode (typical current consumption 2.8 uA @ 1.8 V). |
RobMeades | 3:442c9afc0229 | 18 | In this mode, as well as the main clocks being stopped, all of RAM is also |
RobMeades | 3:442c9afc0229 | 19 | powered down; only the 4 kbyte Backup SRAM is retained. If you are able to |
RobMeades | 3:442c9afc0229 | 20 | design your code such that none of the following need be maintained across a |
RobMeades | 3:442c9afc0229 | 21 | low-power sleep cycle: |
rob.meades@u-blox.com | 1:4f2c412dc013 | 22 | |
rob.meades@u-blox.com | 1:4f2c412dc013 | 23 | * RTOS timers, |
RobMeades | 3:442c9afc0229 | 24 | * dynamically allocated variables (i.e. those on the stack or the heap, for |
RobMeades | 3:442c9afc0229 | 25 | instance allocated with 'new'), |
rob.meades@u-blox.com | 1:4f2c412dc013 | 26 | * more than 4 kbytes of statically allocated variables, |
rob.meades@u-blox.com | 1:4f2c412dc013 | 27 | |
RobMeades | 3:442c9afc0229 | 28 | ...then it may be possible to use Standby mode. Of course, designing your |
RobMeades | 3:442c9afc0229 | 29 | code to work in this way is quite a specific task. The code will begin running |
RobMeades | 3:442c9afc0229 | 30 | at main() again on expiry of the Standby delay and will need to your code will |
RobMeades | 3:442c9afc0229 | 31 | need to determine how to behave based on the information it saved in the 4 kbyes |
RobMeades | 3:442c9afc0229 | 32 | of Backup SRAM. But, given the huge saving in power, such a design may be |
RobMeades | 3:442c9afc0229 | 33 | worthwhile. |
rob.meades@u-blox.com | 1:4f2c412dc013 | 34 | |
RobMeades | 3:442c9afc0229 | 35 | Finally, if your code has another means of retaining state across a low-power |
RobMeades | 3:442c9afc0229 | 36 | sleep cycle then even the Backup SRAM can be powered down, reducing the typical |
RobMeades | 3:442c9afc0229 | 37 | current consumption to 2.3 uA @ 1.8 V. |
rob.meades@u-blox.com | 1:4f2c412dc013 | 38 | |
RobMeades | 3:442c9afc0229 | 39 | Note: these functions assume possession of Alarm A on the RTC hardware block of |
RobMeades | 3:442c9afc0229 | 40 | the microcontroller. |
RobMeades | 3:442c9afc0229 | 41 | Note: it is up to the application to disable any external interrupts that it has |
RobMeades | 3:442c9afc0229 | 42 | activated, otherwise these interrupts will cause the processor to wake up from |
RobMeades | 3:442c9afc0229 | 43 | sleep permaturely. |
RobMeades | 3:442c9afc0229 | 44 | Note: it is not possible to make these functions threadsafe versus set_time(), |
RobMeades | 3:442c9afc0229 | 45 | so please ensure that set_time() can never be active at the same moment as one |
RobMeades | 3:442c9afc0229 | 46 | of these calls. |