Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
MAC Symbol Counter Example 2 for ATmega256RFR2 on Xplained Pro Documentation

Introduction

This simple example shows how to use the MAC Symbol Counter Driver(MACSC) to use the MAC Symbol counter to implement a sleep-wakeup scheme suitable for beacon-enabled IEEE802.15.4 networks.

Main files:

MACSC Driver

The MACSC driver can be found here.

Device Info

All megaRF devices with an MACSC can be used.

Description of the example

This example will prepare the MACSC to use the relative compare mode to remain awake during the Contention Access Period(CAP) and required GTS of the superframe and sleep during the sleep period. All 3 compare modules are used along with Beacon Timestamp register. Ideally,Beacon Timestamp register is updated with SCCNT value when an EEE802.15.4 frame is received(automatic Time stamping feature). However,this application simulates the scenario by enabling manual write of the Beacon Timestamp register to demonstrate relative compare.

Power-save sleep mode of the MCU is used in the application. The beacon time-stamp is captured whenever a compare 3 interrupt occurs.This simulates the Beacon Interval(BEACON_INTERVAL in conf_example.h) Compare 1 interrupt occurs with respect to the value in Beacon timestamp register- relative compare mode.This simulates the active period of the superframe(ACTIVE_PERIOD in conf_example.h) Compare 2 interrupt occurs with respect to the value in Beacon timestamp register- relative compare mode.This simulates the sleep period of the superframe(SLEEP_PERIOD in conf_example.h)

Action taken on occurence of interrupt callbacks

  • Compare 3 callback:CMP3_INT_CHK_PIN toggle.CMP2_INT_CHK_PIN set high. End of Beacon Interval.Relative compare for active period on cmp 1 is started.
  • Compare 1 callback:End of active period of superframe.Relative compare for sleep period on compare 2 is started.Put system to sleep.
  • Compare 2 callback:CMP2_INT_CHK_PIN set low. End of sleep period of superframe.Sleep is disabled.

Compilation Info

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

Contact Information

For further information, visit Microchip.