Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Common API for Sleep Management / Example for SAM4L-EK Documentation

Introduction

This simple example shows how to use the Sleep manager.

Main files:

Sleep manager API

The sleep manager API can be found here.

Device Info

All SAM4L series devices can be used. The example can be applied on:

  • SAM4L-EK
  • SAM4L-XPLAINEDPRO
  • SAM4L8-XPLAINEDPRO

Description of the example

The device is put to sleep in sleep modes with increasing "depth", and is periodically woken up by the AST or asynchronously by an external interrupt for the modes which also disable the RTC. The device will remain in ACTIVE mode for approximately 3 seconds after wake- up, before it goes to sleep in the next mode.

The AST wakes the CPU every 4 seconds. If the device remains in sleep (LED turned off), the device has gone into a too deep sleep mode for the AST to operate (in the case of this example, the chosen source clock for the AST is the RCOSC and the RCOSC is stopped in the WAIT/RET sleep mode). In that case, the user must wake the device up by applying a low-level on the external interrupt pin, e.g., by pushing a button connected to the pin (WAKE_BUTTON_EIC_PIN).

A pin (LED_ACTIVITY_STATUS_PIN) with, e.g., a LED connected is driven low when the device is active and driven high when the device is sleeping.

Compilation Info

This software was written for the GNU GCC and IAR. Other compilers may or may not work.

Contact Information

For further information, visit Microchip.
Support and FAQ: https://www.microchip.com/support/