DigiMesh Power Management using Asynchronous Cyclic Sleep example for mbed XBeeLib By Digi

Dependencies:   XBeeLib mbed

Fork of XBeeZB_power_mngmnt_cyclic_sleep by Digi International Inc.

Description

This example characterizes a device that needs to be continuously joined to the coordinator so it doesn't lose any incoming packets. A fast response to packets is not required so radio can sleep for some time to save power while the coordinator buffers its packets.

The example configures the radio to poll its coordinator every 5 seconds if there is any packet for it.
If there is one or more, it awakes and send the packets to the mbed micro-controller.

Note that in DigiMesh modules, the polling mechanism required in this example is restricted to devices one hop away (Point to Multipoint delivery); it will not work fine across a DigiMesh network.

Setup

Network

You need to set up a coordinator in the network so it buffers the packets send to our local XBee device while it's sleeping.
A module configured as coordinator requires:

  • 'Coordinator Enable (CE)' parameter set to 1.
  • 'Cyclic Sleep Period (SP)' parameter set as the local XBee device.
    In the example it is set to 5000 which represent 5000 ms or 5 seconds.
    In the coordinator, when using X-CTU for configuration, the SP parameter has to be entered as the desired sleep time divided by 10 and in hexadecimal so to cope with the example it should be 5000 / 10 = 500 = 0x1F4 -> 1F4
  • 'Time Before Sleep (ST)' parameter set as the local XBee device; 500 ms = 0x1F4.
  • 'Transmit Options (TO)' parameter set to 0x40 so delivery method is Point to Multipoint.

Demo run

While it is running, send a packet to the device:

  • Go to the "Console" tab of the XCTU connected to the coordinator.
  • Press the "Add API frame to the list" button.
  • Press "Create using API Frame generator" button.
  • Select "DigiMesh" protocol and "0x10 Transmit Request" Frame Type.
  • Paste the Local XBee device 64-bit address in the "64-bit dest. address" text box. (You can copy it from the application banner).
  • In the "Options" text box, type 0x40 to select delivery method as Point To Multipoint (you can skip this if you configured atTO accordingly)
  • In the "RF data" text box, select the ASCII box and type "Hello XBee!".
  • Press OK, Add Frame.
  • Select the frame and press the "Send selected frame" button to send the frame ("Hello XBee!") to the XBee network.

Once the XBee device receives the frame, the radio will wake up to send it to mbed micro-controller, which will process and print the received data.

Verify that the XBee module has received the frame by accessing the serial console terminal. If it was successful, the "Hello XBee!" message will be displayed there.

After that, the radio will go to sleep again until new data is received.

Committer:
hbujanda
Date:
Mon May 11 18:03:37 2015 +0200
Revision:
0:4fadd116f813
Automatic upload

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hbujanda 0:4fadd116f813 1
hbujanda 0:4fadd116f813 2 #if !defined(__CONFIG_H_)
hbujanda 0:4fadd116f813 3 #define __CONFIG_H_
hbujanda 0:4fadd116f813 4
hbujanda 0:4fadd116f813 5 #define PATFORM_ARCHPRO
hbujanda 0:4fadd116f813 6
hbujanda 0:4fadd116f813 7 /** Library configuration options */
hbujanda 0:4fadd116f813 8 #define ENABLE_LOGGING
hbujanda 0:4fadd116f813 9 #define ENABLE_ASSERTIONS
hbujanda 0:4fadd116f813 10 #define FRAME_BUFFER_SIZE 10
hbujanda 0:4fadd116f813 11 #define MAX_FRAME_PAYLOAD_LEN 128
hbujanda 0:4fadd116f813 12 #define ENABLE_PM_SUPPORT
hbujanda 0:4fadd116f813 13
hbujanda 0:4fadd116f813 14 #define SYNC_OPS_TIMEOUT_MS 2000
hbujanda 0:4fadd116f813 15
hbujanda 0:4fadd116f813 16 #if defined(PATFORM_ARCHPRO)
hbujanda 0:4fadd116f813 17 #define RADIO_TX P4_28
hbujanda 0:4fadd116f813 18 #define RADIO_RX P4_29
hbujanda 0:4fadd116f813 19 #define RADIO_RESET P2_13
hbujanda 0:4fadd116f813 20 //#define RADIO_RESET NC
hbujanda 0:4fadd116f813 21 #define RADIO_SLEEP_REQ NC
hbujanda 0:4fadd116f813 22 #define RADIO_ON_SLEEP NC
hbujanda 0:4fadd116f813 23 #define DEBUG_TX P0_2
hbujanda 0:4fadd116f813 24 #define DEBUG_RX P0_3
hbujanda 0:4fadd116f813 25 #elif defined(TARGET_LPC1768)
hbujanda 0:4fadd116f813 26 #define RADIO_TX p9
hbujanda 0:4fadd116f813 27 #define RADIO_RX p10
hbujanda 0:4fadd116f813 28 #define RADIO_RESET p30
hbujanda 0:4fadd116f813 29 #define RADIO_SLEEP_REQ NC
hbujanda 0:4fadd116f813 30 #define RADIO_ON_SLEEP NC
hbujanda 0:4fadd116f813 31 #define DEBUG_TX P0_2
hbujanda 0:4fadd116f813 32 #define DEBUG_RX P0_3
hbujanda 0:4fadd116f813 33 #elif defined(TARGET_FRDM_KL25)
hbujanda 0:4fadd116f813 34 #define RADIO_TX PTD3
hbujanda 0:4fadd116f813 35 #define RADIO_RX PTD2
hbujanda 0:4fadd116f813 36 #define RADIO_RESET NC
hbujanda 0:4fadd116f813 37 #define RADIO_SLEEP_REQ NC
hbujanda 0:4fadd116f813 38 #define RADIO_ON_SLEEP NC
hbujanda 0:4fadd116f813 39 #define DEBUG_TX USBTX
hbujanda 0:4fadd116f813 40 #define DEBUG_RX USBRX
hbujanda 0:4fadd116f813 41 #elif (defined TARGET_LPC11U24)
hbujanda 0:4fadd116f813 42 #define RADIO_TX p9
hbujanda 0:4fadd116f813 43 #define RADIO_RX p10
hbujanda 0:4fadd116f813 44 #define RADIO_RESET p30
hbujanda 0:4fadd116f813 45 #define RADIO_SLEEP_REQ NC
hbujanda 0:4fadd116f813 46 #define RADIO_ON_SLEEP NC
hbujanda 0:4fadd116f813 47 #define DEBUG_TX USBTX
hbujanda 0:4fadd116f813 48 #define DEBUG_RX USBRX
hbujanda 0:4fadd116f813 49 #else
hbujanda 0:4fadd116f813 50 #error "Define a platform"
hbujanda 0:4fadd116f813 51 #endif
hbujanda 0:4fadd116f813 52
hbujanda 0:4fadd116f813 53 #endif /* __CONFIG_H_ */
hbujanda 0:4fadd116f813 54