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

Committer:
RobMeades
Date:
Mon Jun 05 14:28:14 2017 +0000
Revision:
4:691e6b38fc54
Parent:
3:442c9afc0229
Update readme.txt.

Who changed what in which revision?

UserRevisionLine numberNew 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 4:691e6b38fc54 28 ...then it may be possible to use Standby mode. Designing your code to work in
RobMeades 4:691e6b38fc54 29 this way requires a specific design approach. Your code will begin running
RobMeades 4:691e6b38fc54 30 again at main() on expiry of the Standby delay and hence you will need to
RobMeades 4:691e6b38fc54 31 determine how to behave based on the information that you have saved in the
RobMeades 4:691e6b38fc54 32 4 kbyes of Backup SRAM. Given the huge saving in power, such a design approach
RobMeades 4:691e6b38fc54 33 may well be 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.