SAM L10/L11 SleepWalking

SleepWalking Overview

SleepWalking is the capability of a device to temporarily and asynchronously wake up a peripheral by enabling its clock so it can perform a task without waking up the CPU from Standby mode. This is called SleepWalking because it allows the CPU to sleep until a relevant event occurs. To perform SleepWalking, the Event System (EVSYS) is required to interconnect the peripherals. The EVSYS is used to connect an Event Generator Peripheral to an Event User Peripheral.

When the CPU is in Standby, the Event User Peripheral can request its clock, upon receiving an event generator peripheral trigger, to perform its task autonomously as described in the following figure:

saml10-sleepwalking_figure.png

This timing chart explicitly shows that the CPU will wake-up only after the peripheral wake-up request (interrupt) is issued.

Initially, we see the peripheral requesting its clock to perform the first task. The conditions to wake up the SleepWalking CPU were not met after this first task. The peripheral requests its clock again, and the conditions are subsequently met to trigger a peripheral interrupt allowing the CPU to wake-up.

Thus, SleepWalking is accomplished by the peripheral itself using the EVSYS to interconnect the peripherals in Standby without CPU intervention. The CPU and the full RAM will not wake up until the condition is true.

When implementing SleepWalking user has to reproduce the following configuration:

saml10-sleepwalking_configuration.png

SleepWalking with Dynamic Power Gating

To reduce power consumption even further, SleepWalking with dynamic Power Domain Gating (also referred to as "Dynamic Sleepwalking") is used to turn the power domain state from retention to active and vice-versa, based on an event or DMA trigger. This capability, which extends the clock gating function normally provided by the "Static" SleepWalking function to enable a power domain, is called Power Gating.

Refer to "SAM L10/L11 Power Gating" for more details.

Related Peripherals

SleepWalking involves several parts of the architecture and strongly depends on which peripherals are used in the targeted application. You must be familiar with common system peripherals that are the minimal required set to get the device performing SleepWalking. Here is a list of tasks and peripheral components that are required for SleepWalking:


How to Perform SleepWalking

Application Considerations

Before considering a SleepWalking implementation, you must understand the key power constraints for your application. Consider the following questions:

  1. Is my application power-constrained?
    • e.g.: Is it battery powered?
  2. In my application, what is the ratio of Sleep time vs. Active time?
  3. Will my application require the maximum CPU frequency for computation during Active mode?
    • What is the source clock that I will use for the CPU?
    • What Performance Level must be required in Active and in Sleep?
  4. What will be the best suitable Sleep mode for my application?
    • Is that Sleep mode available with my considered Performance Level?
    • Should I consider switching into a lower Performance Level once in Sleep?
    • What will be the relevant interrupt(s) waking-up my devices
  5. How many peripherals does my application require?
    • Is it possible to interconnect them using the Event System?
    • If yes, what is my Event Generator Peripheral?
    • What is my Event User Peripheral?
    • What is the EVSYS connection required to get them working together as expected?
    • Will they work synchronously or asynchronously from each other?
  6. Considering power efficiency, what is the best clock configuration for my application?
    • Should all the parts of my system be clocked by the same clock source?
    • Should they be clocked independently allowing the unused parts to be switched off?
    • What are the clock sources that are the most power-efficient for each peripheral for my application?
    • Can I group some peripherals to a dedicated clock source?
    • Considering that my application will spend most of the time in Sleep mode, which fast clock can I use to spend as little time as possible when in Active mode?

Guide to Main Steps

1

Source Clocks

In this step, you have to implement the clock(s) strategy of your application:

  • When the device is in Active mode.
  • When the device is in Low-Power mode.
  • Enable the source clock(s) of the peripherals. Refer to the Oscillator Controller (OSCCTRL) or 32K Oscillator Controller (OSC32KCTRL) peripheral example.
  • Configure the clock sources with On Demand and Run in Standby enabled. These bits are located into the specified source clock Control Register e.g:
    • For OSC16M:
      • OSCCTRL.OSC16MCTRL.bit.ONDEMAND
      • OSCCTRL.OSC16MCTRL.bit.RUNSTDBY
    • For DFLLULP:
      • OSCCTRL.DFLLULPCTRL.bit.ONDEMAND
      • OSCCTRL.DFLLULPCTRL.bit.RUNSTDBY

2

Generic Clock Generator

  • Enable the source clock of the peripherals. Refer to Generic Clock Generator Controller (GCLKC) peripheral example.
  • Configure the generic clock generator with Run in Standby enabled. This bit is located into the Generic Generator CONTROL x Register e.g:
    • For GENCTRL0:
      • GCLK.GENCTRL0.bit.RUNSTDBY

3

Peripheral Event Generator

According to the Event System page, you have to identify which peripherals can be interconnected together using the Peripheral Event System in your application. In this step, the Peripheral Event Generator is configured.

Regarding SleepWalking, the main settings to consider in the Peripheral Event Generator configuration are the following:

  • Run In Standby capability: If the Event Generator Peripheral is required to Run in StandBy Low-Power mode, the bit RUNSTDBY must be set. This bit is located in the Control register of the Event Generator Peripheral.
  • On Demand clock request capability: This is a mandatory parameter that is required to be set, allowing the peripheral to be able to request its own clock. This bit is located in the Control register of the Event Generator Peripheral.
  • Event Generation capability must be configured. This feature is usually configured through the Event Control Register (EVCTRL) of each peripheral connected to the Event System.

4

Peripheral Event User

According to the Event System page, you have to identify which peripherals can be interconnected together using the Peripheral Event System in your application. In this step, the Peripheral Event User is configured.

Regarding SleepWalking, the main settings to consider in the Peripheral Event Generator configuration are the following:

  • Run In Standby capability: If the Event User Peripheral is required to Run in StandBy Low-Power mode, the bit RUNSTDBY must be set. This bit is located in the Control register of the Event User Peripheral.
  • On Demand clock request capability: This is a mandatory parameter that is required to be set, allowing the peripheral to be able to request its clock. This bit is located in the Control register of the Event User Peripheral.
  • Event Input trigger must be configured. This feature is usually configured through the Event Control Register (EVCTRL) of each peripheral connected to the Event System.

5

Peripheral Event System

In this step the interconnection between the Event Generator Peripheral and the Event User Peripheral is realized by configuring the Event System (EVSYS).

6

Prepare to enter Low-Power mode

In this step, the aim is to prepare the device to be very power efficient once it enters Sleep mode, by using different combined low power techniques offered by its architecture. Although these techniques are introduced in this section, they can also be used in different applications where Sleepwalking is not even required.

  • Enable the NVM Flash Cache Low-Power mode: By default, the cache is enabled using the "No Miss Penalty" mode which gives the best system performances, but which consumes more power. The Low-Power mode reduces the power consumption of the cache system but inserts a wait state each time there is a cache miss. This mode may not be relevant if CPU performance is required, as the application will be stalled and may lead to increased run time (NVMCTRL->CTRLB.bit.READMODE).
  • Adapt Performance Level to save power consumption: Disabling the PL selection forces the device to run in PL0, reducing the power consumption, and the wake-up time from Standby Sleep mode (PM->PLCFG.bit.PLDIS).
  • Enable Dynamic Power Gating: Make sure to have Dynamic SleepWalking for switchable power domain PDSW enabled (PM->STDBYCFG.bit.DPGPDSW.)
  • Adapt SRAM size retention (PM->PWCFG.bit.RAMPSWC).
  • Select the most Power-efficient Regulator Type for your application: Buck regulator is generally the most efficient in terms of power consumption (SUPC->VREG.bit.SEL).
  • Check if the ULP Voltage reference is ready to be used by the main regulator (SUPC->STATUS.bit.ULPVREFRDY).
  • Select the ULP Voltage reference before entering into Sleep mode (SUPC->VREG.bit.VREFSEL).
  • If your application main voltage is above 2.5 V, apply the Low-Power mode Efficiency for the Low Power Voltage Regulator (LPVREG) (SUPC->VREG.bit.LPEFF).
  • Optionally configure the IO ports to be in a tri-state condition.

7

Enter in Low Power

Once ready, the device can enter into Low-Power mode. There are two remaining steps before issuing the Wait For Interrupt (WFI) instruction:

  • Select the Sleep mode required using the bitfield PM->SLEEPCFG.bit.SLEEPMODE.
  • Check if the previous register write operation has been successfully performed.

8

Exit From Low-Power

The CPU wakes-up only after a peripheral interrupt is issued. This interrupt usually comes from the Event User Peripheral. In this step, the focus is about what will be implemented in the interrupt handler. SleepWalking doesn't alter classical interrupt handling. The interrupt flags must be cleared in the handler to enable subsequent interrupts.

9

Reconfigure Device for Active mode

At this time, the first function to be executed must reconfigure the device to the appropriate operational state allowing it to operate in Active mode. You have to take particular care to reconfigure the clocks, the performance levels, the Flash Wait States, etc.

Related Sections

 
Power Manager (PM)
Learn more >
 
Supply Controller (SUPC)
Learn more >
 
Generic Clock Generator Controller (GCLKC)
Learn more >
 
32K Oscillator Controller (OSC32KCTRL)
Learn more >
 
Oscillator Controller (OSCCTRL)
Learn more >
 
Main Clock Controller (MCLK)
Learn more >
 
Event System
Learn more >
 
Power Gating
Learn more >

References:

SAM L10 and L11

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.