User Tools


Link to this comparison view

2.0:power_management [2015/09/14 00:10] (current)
Line 1: Line 1:
 +====== Power Management ======
 +
 +TruConnect power management currently supports a number of power modes:
 +
 +^Mode                   ​^Description ​                                   ^Minimum \\ Current Consumption \\ Bobcat module^
 +| awake                 |All functions available ​                                           |3.5mA ​         |
 +| low power advertising |Advertising as peripheral, UART disabled, responds to ''​mode_sel''​ |35µA ​          |
 +| deep sleep            |Minimal power state, UART disabled, responds to ''​mode_sel'' ​      ​|1.65µA ​        |
 +| power off             ​|Disable external power regulator ​                                  ​|0A ​            |
 +
 +In the following discussion, sleep refers to deep sleep mode.
 +
 +You can configure your ACKme BLE device to transition between power modes in a variety of ways, depending on the level of GPIOs, and on activity on the UART or wireless BLE interface.
 +
 +  * enter low power advertising mode when there is no activity for a specified duration
 +  * deep sleep or wake depending on the level of a GPIO
 +  * deep sleep or wake on toggling the level of a GPIO (edge-triggered)
 +  * deep sleep or wake on timeout
 +  * power off when there is no activity for a specified duration
 +  * power off when a GPIO is held low
 +  * power off when there is no activity for a specified duration
 +  ​
 +  ​
 +  ​
 +===== GPIO Power Management Functions =====
 +
 +GPIO functions are set with the [[.commands#​gfu|gfu (GPIO function)]] command.
 +
 +==== sleepwake GPIO function ====
 +
 +The ''​sleepwake''​ function is an input:
 +  * ''​sleepwake''​ assert: Wake the module from sleep
 +  * ''​sleepwake''​ de-assert: Put the module to sleep
 +
 +==== shutdown GPIO function ====
 +
 +The ''​shutdown''​ function is an input. It has two modes:
 +  * ''​activity''​ function **NOT** assigned:
 +    * ''​shutdown''​ level change, module asleep: Wake the module from sleep
 +    * ''​shutdown''​ level change, module awake: Put the module to sleep    ​
 +  *  ''​activity''​ function **IS** assigned:
 +    * ''​shutdown''​ assert for >1 second: Force the ''​activity''​ GPIO low 
 + 
 +==== activity GPIO function and system activity timeout ====  ​
 +
 +The ''​activity''​ function is an output. ​
 +
 +When there is activity on either the BLE interface or the UART, the ''​activity''​ GPIO level goes high. 
 +
 +The  [[.variables#​sy_a_t|system activity timeout (sy a t)]] variable determines the period of inactivity before the ''​activity''​ GPIO goes low.
 +
 +{{.power_management/​activity1.png?​350}}
 +
 +===== Power Management Applications =====
 +  ​
 +==== Low Power Advertising Mode =====
 +
 +In low power advertising mode, the module advertises with regular beacons, but minimal other functions are available. ​
 +
 +The module awakes from low power advertising mode on:
 +  * A remote central connecting via the BLE interface
 +  * ''​mode_sel''​ function GPIO
 +  * Reset
 +
 +{{.power_management/​low_power_advertising1.png?​500}}  ​
 +  ​
 +To set up low power advertising mode, set the  [[.variables#​sy_a_t|system activity timeout (sy a t)]] variable to a non-zero value, and ensure advertising is on. For example:<​code>​
 +adv
 +set sy a t 120
 +</​code>​
 +  ​
 +==== Sleep or Wake on GPIO Level  ====
 +
 +To sleep or wake depending on a GPIO level, assign the GPIO function ''​sleepwake''​ to a GPIO, using the [[.commands#​gfu|gfu]] command:
 +<​code>​
 +> gfu <​GPIO#>​ sleepwake
 +</​code>​
 +For example:
 +<​code>​
 +> gfu 8 sleepwake
 +Success
 +</​code>​
 +
 +{{.power_management/​sleepwake_vcc_1.png?​350}}
 +
 +==== Sleep or Wake on GPIO Edge-Trigger ​ ====   
 +
 +To sleep or wake on a GPIO edge trigger, assign the GPIO function ''​shutdown''​ to a GPIO, using the [[.commands#​gfu|gfu]] command:
 +<​code>​
 +> gfu <​GPIO#>​ shutdown
 +</​code>​
 +For example:
 +<​code>​
 +> gfu 8 shutdown
 +Success
 +</​code>​
 +
 +{{.power_management/​shutdown1.png?​350}}
 +
 +<!-- %%pageBreakAfter%% -->
 +
 +**Note**: In order to use the ''​shutdown''​ function as a sleep wake toggle in this mode, the ''​activity''​ function must NOT be assigned to any GPIO. If the ''​activity''​ function is assigned, the ''​shutdown''​ function works in a different mode. See [[#​power_down_on_inactivity_with_manual_shutdown_and_power_up | Power Down on Inactivity with Manual Shutdown and Power Up]] below.
 +
 +
 +==== Sleep or Wake on Timeout ====
 +
 +To enter sleep mode on timeout, set a non-zero value for the [[.variables#​sy_s_t|sy s t]] (system sleep timeout) variable. ​
 +
 +When the module is in deep sleep mode, it wakes only on ''​mode_sel''​ or ''​reset''​. Advertising is disabled so no activity is possible on the BLE interface. This means that if you remotely set the [[.variables#​sy_s_t|sy s t]] variable to put the module to sleep, you should also set the [[.variables#​sy_w_t|sy w t]] variable to ensure it will wake up again. ​
 +
 +To wake from sleep mode on timeout, set a non-zero value for the [[.variables#​sy_w_t|sy w t]] (system wakeup timeout) variable. ​
 +
 +For example, to sleep after the minimum 10 seconds, and wake after 5 seconds:
 +<​code>​
 +set sy s t 10
 +set sy w t 5
 +save
 +reset
 +</​code>​
 +
 +If you set both the [[.variables#​sy_s_t|sy s t]] and [[.variables#​sy_w_t|sy w t]] variables, the module enters a cycle of sleep and wake states. To break out of the cycle, during a wake state, set the [[.variables#​sy_s_t|sy s t]] variable to ''​0''​ and  [[.commands#​save]]:​
 +<​code>​
 +set sy s t 0
 +save
 +</​code>​
 +
 +==== Power Down on Inactivity ​ ====
 +
 +To power down on inactivity, set the ''​activity''​ GPIO, using the [[.commands#​gfu|gfu]] command:
 +
 +<​code>​
 +> gfu <​GPIO#>​ activity
 +</​code>​
 +
 +Connect the ''​activity''​ GPIO to the enable pin on a regulator controlling module power. The regulator may also control power to other devices. ​
 +
 +{{.power_management/​activity_shutdown1.png?​600}}
 +
 +This configuration allows you to power the module down automatically,​ but not to turn it back on. For a more practical configuration,​ see [[#​power_down_on_inactivity_with_manual_shutdown_and_power_up | Power Down on Inactivity with Manual Shutdown and Power Up]] below.
 +
 +
 +==== Power Down on Inactivity with Manual Shutdown and Power Up ====
 +
 +While the ''​activity''​ function alone allows powering down, it can be used in conjunction with the ''​shutdown''​ function to shut down either automatically or manually, and power up manually.
 +
 +For this application,​ assign the ''​shutdown''​ and ''​activity''​ functions to two GPIOs, using the [[.commands#​gfu|gfu]] command:
 +<​code>​
 +> gfu <​GPIO-shutdown#>​ shutdown
 +> gfu <​GPIO-activity#>​ activity
 +</​code>​
 +
 +With the circuit shown below, holding down the manual shutdown button for one second shuts down power before system activity timeout elapses. With the system powered down, pressing the manual shutdown button powers the module back up.
 +
 +{{.power_management/​activity_shutdown2.png?​600}}
 +
 +===== Other Power Management Strategies =====
 +
 +Reducing LED blink rate and duty cycle can result in an effective power savings in low power applications.
 +
 +The [[.variables#​sy_i_s|sy i s]] (system indicator status blink behavior) variable allows control of the blink rate and duty cycle of the system indicator function LED. 
 +