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.
The MACSC driver can be found here.
All megaRF devices with an MACSC can be used.
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
This software was written for the GNU GCC and IAR for AVR. Other compilers may or may not work.
For further information, visit Microchip.