Active Mode Operation

In Active mode all clocks are active, and the CPU is running. Power consumption in active mode is proportional to the operating frequency of the system clock. Applications that do not demand high-frequency operation can benefit from lowering the system clock.

Even though the rule of thumb is that lower frequency equals lower power, in some cases the opposite is true. Running at a higher clock frequency could mean that the CPU will finish its task faster, and return back to sleep quicker, resulting in a lower total power consumption. Imagine an application that wakes up from Standby sleep mode periodically and performs some calculations. If these calculations are done at a higher clock frequency the system will spend less time in Active and more time in Standby sleep mode, thus lowering the total power consumption. An example of the opposite could be where an operation such as USART communication is preventing the CPU from sleeping. In this situation, the timing of the USART transaction is the limiting factor, and higher CPU frequency will not help reduce time spent in Active mode.

Running the system at one static frequency can be sufficient for many applications. For some applications, there are advantages to using dynamic frequency scaling. As the operating frequency of the device can be changed on the fly, some parts of an application can execute at a lower frequency, while other parts can be executed at a higher frequency. This can be useful in e.g. applications that are very computationally heavy for short periods. An example of this can be an application that mainly sleeps while collecting data, and periodically performs heavy computations on the sampled data. Using a higher clock frequency to perform the computations can reduce the total power consumption, even though the consumption when the computations are being performed is higher, because of the shorter duration of the computation period.

Note that this technique has a trade-off. As there is a cost related to executing the instructions needed to change the frequency, the code executed at higher frequency must compensate for this. I.e. the savings from executing code faster must outweigh the cost of adding code to change the frequency. Also, note that the frequency must most likely be changed both when entering and exiting the part of the application selected for high-frequency execution.

A convenient way of doing dynamic frequency scaling is to use the Main Clock Prescaler. This prescaler allows the clock to be scaled before going to the CPU and peripherals. Note that as this prescaler affects the clocks for both CPU and peripherals (any peripherals that are configured for a certain clock speed could malfunction). Examples of this could be violating the maximum clock speed of the ADC, or changing the BAUD rate of the USART when changing the peripheral clock. Refer to the chapter on Clock Controller in the corresponding data sheet, for details.

Creating a power budget can be a useful exercise when developing a low-power application. This can be done with a few simple steps. First, calculate the power consumption for each operating mode. Then, calculate how much time is spent in each mode. Lastly, using the numbers from the two previous steps, calculate the average and peak consumption. This allows the developer to calculate e.g. battery-life for that application. It can also be a valuable tool in profiling and optimizing the application.