Dynamic Power Control

Description

Change power mode dynamically from task code

This resource allows the Sensor Controller to switch between the active and low-power power modes within task code blocks.

This can be used instead of, or in combination with, static configuration in the Power and Clock Settings Panel in Sensor Controller Studio.

The table below shows clock rate and availability in the different power modes for each task resource:

Task Resource Clock Rate Active Mode Low-Power Mode Standby Mode
Accumulator Based Math Same as Sensor Controller Available Available  
ADC Same as AUX bus Available    
COMPA Analog / asynchronous Available Available Available
COMPB 32 kHz Available Available* Available
Delay Insertion 2 MHz Available Available  
Digital GPIO Same as Sensor Controller Available Available  
ISRC Analog / asynchronous Available    
Reference DAC Automatically adapted Available Available Available
Pulse Counter Asynchronous Available Available Available
I2C Master Same as Sensor Controller Available    
SPI Chip Select Same as Sensor Controller Available Available  
SPI Data Transfer Same as Sensor Controller Available Available  
TDC Same as AUX bus Available    
Timer 0 Same as Sensor Controller Available Available  
Timer 1 Same as Sensor Controller Available Available  
Timer 2 24 MHz, 2 MHz or 32 kHz Available Available Available
LCD Controller Same as Sensor Controller Available Available Between updates
UART Emulator Based on Timer 0 Available    
COMPA Event Trigger Asynchronous     Wake-up trigger
COMPB Event Trigger Asynchronous (32 kHz)     Wake-up trigger
GPIO Event Trigger Asynchronous     Wake-up trigger
System Event Trigger Asynchronous     Wake-up trigger
Timer 0 Event Trigger 4 kHz signal from RTC     Wake-up trigger
Timer 1 Event Trigger 4 kHz signal from RTC     Wake-up trigger
Timer 2 Event Trigger Based on Timer 2     Wake-up trigger

* The procedures that enable/disable COMPB can only be called when the Sensor Controller (or System CPU) is in active mode.

Examples

Entering Active Mode Only During Some Wakeups

// The task code block starts in low-power mode

// If some condition is met ...
if (...) {

    // Enter active mode
    pwrRequestAndWaitForActiveMode();

    // Get one ADC sample
    adcEnableSync(ADC_REF_FIXED, ADC_SAMPLE_TIME_2P7_US, ADC_TRIGGER_MANUAL);
    adcGenManualTrigger();
    adcReadFifo(output.adcValue);
    adcDisable();

    // Return to low-power mode
    pwrRequestAndWaitForLowPowerMode();
}

// The task code block ends in low-power mode, so unless changed by the static configuration,
// the Sensor Controller will start in low-power mode at the next wake-up

Procedures Overview

Name Brief description
pwrRequestActiveMode() Requests change to the active power mode. More …
pwrRequestAndWaitForActiveMode() Requests change to the active power mode, and waits for it to take effect. More …
pwrRequestAndWaitForLowPowerMode() Requests change to the low-power power mode, and waits for it to take effect. More …
pwrRequestLowPowerMode() Requests change to the low-power power mode. More …
pwrWaitForActiveMode() Waits for change to the active power mode to take effect. More …
pwrWaitForLowPowerMode() Waits for change to the low-power power mode to take effect. More …

Constants

None.

Global Variables

None.

Procedures

pwrRequestActiveMode

Prototype: pwrRequestActiveMode()

Requests change to the active power mode.

This request must be followed by a call to pwrWaitForActiveMode() before:

  • Calling any other other dynamic power control procedures
  • The end of the task code block

pwrRequestAndWaitForActiveMode

Prototype: pwrRequestAndWaitForActiveMode()

Requests change to the active power mode, and waits for it to take effect.

pwrRequestAndWaitForLowPowerMode

Prototype: pwrRequestAndWaitForLowPowerMode()

Requests change to the low-power power mode, and waits for it to take effect.

pwrRequestLowPowerMode

Prototype: pwrRequestLowPowerMode()

Requests change to the low-power power mode.

This request must be followed by a call to pwrWaitForLowPowerMode() before:

  • Calling any other other dynamic power control procedures
  • The end of the task code block

pwrWaitForActiveMode

Prototype: pwrWaitForActiveMode()

Waits for change to the active power mode to take effect.

Note: Deadlock will occur if this procedure is called without a prior call to pwrRequestActiveMode() .

pwrWaitForLowPowerMode

Prototype: pwrWaitForLowPowerMode()

Waits for change to the low-power power mode to take effect.

Note: Deadlock will occur if this procedure is called without a prior call to pwrRequestLowPowerMode() .