Green Power Device Application Overview

Green Power Device

A Green Power Device (GPD) is a special type of Zigbee device different from the three logical devices defined in Zigbee PRO: Coordinator, Router or End Device. These devices are designed for application where the end product has a very strict energy budget, such as an energy-harvesting device or bateryless devices. GPDs follows their own Zigbee specification which defines the possible capabilities of a given GPD implementation, such as security level, commissioning procedures and supported commands per device definition. As GPDs are the most restricted device in terms of functionality, these devices are not part of the Zigbee network unless those are commissioned to a Green Power Sink (GPS) device directly or through a Green Power Proxy (GPP), if the device to which it got commissioned is not preset, then the device must be recommissioned as it does not have a mean to keep communication with any other device. Once the GPD is commissioned it can send Green Power Data Frames (GPDF) which are converted by the GPP into Green Power Notifications (ZCL frames) that can travel through the Zigbee network until it reaches its destination. For further details on GPDs and its interactions with the network, please refer to 14. Green Power.

General Application Architecture

This section describes how a Green Power Device application task is structured in more detail.

Green Power Configuration

gpd_config.h provides configuration definitions for parameters like device ID, security level and security keys. To change the Green Power Device behavior is neccesary to modify the predefined symbols in the project properties.

../_images/gpd-defines.png
Green Power Device definitions
Name Description Values
DEVICE_ID (uint8) Green Power Device ID 0x00 - 0xFF, refer to GPD spec
GPD_APP_ID Unique identifier of the GPD, either the 4-byte SrcID or the IEEE Addr
0b00 GPD_APP_TYPE_SRC_ID
0b10 GPD_APP_TYPE_IEEE_ID
GPDF_FRAME_DUPLICATES (uint8) Application-specific. Number of GPDF retries per packet. 0x00 - 0xFF (recommended to be low, more retries = more power consumption)
GPD_CHANNEL IEEE channel, 11 - 26 (in Hex) 0x0B - 0x1A
GP_SECURITY_LEVEL Defines the security level which GPDF packets are encrypted and sent with
0b00 GP_SECURITY_LVL_NO_SEC
0b01 Reserved
0b10 GP_SECURITY_LVL_4FC_4MIC
0b11 GP_SECURITY_LVL_4FC_4MIC_ENCRYPT
AUTO_COMMISSIONING Defines whether or not the device will automatically start commissioning on power-up TRUE/FALSE
RX_AFTER_TX RxOnCapability commissioning option. Defines whether or not GPD will turn RX on after TXing a frame, i.e. whether or not GPD is expecting a response TRUE/FALSE
SEQUENCE_NUMBER_CAP Sequence Number Capability commissioning option. Defines if GPD will use Seq Num TRUE/FALSE

Note

Please refer to the preprocessor symbols section of the Z-Stack Quick Start Guide to setup compile options for the project if using IAR.

Non Volatile Memory

gpd_memory.c provides an interface for Non Volatile (NV) memory required for attribute persistence in some GPD configurations. For example the persistence of sequence number when SEQUENCE_NUMBER_CAP is required. Use gp_nv_item_init() to create a new NV item, then gp_nv_read() to get the NV value and gp_nv_write() to update the NV value when necesary.

Callbacks

The application code also likely includes various callbacks from the protocol stack layer and RTOS modules. To ensure thread safety, processing should be minimized in the actual callback, and the bulk of the processing should be done in the application context.

static uint16 gpdSampleSw_process_loop( void )
{
    /* Forever loop */
    for(;;)
    {
        if(events & SAMPLEAPP_KEY_EVT)
        {
            // Process Key Presses
            gpdSampleSw_processKey(keys);
            keys = 0;
            events &= ~SAMPLEAPP_KEY_EVT;
        }

        ApiMac_processIncoming();
    }
}

Send Green Power Data Frames

An API to send Green Power Data Frames (GPDF) is provided in gpd.c. The generic function GreenPowerDataFrameSend() sends a frame formated for the Green Power Device configuration automatically by providing a gpdfReq_t struct, the desired channel and a flag to enable frame security.

Additionally GreenPowerCommissioningSend() and GreenPowerAttributeReportingSend() functions use GreenPowerDataFrameSend() to generate the corresponding commands.

Setting Up the Network with GPD and GPS

To set up a network with a Green Power Device (GPD) and a Green Power Sink (GPS), you will need 3 devices:

  1. Green Power Device (gpd_switch or gpd_temperaturesensor)
  2. Green Power Sink (zc/zr_light_sink or zc/zr_thermostat_sink)
  3. Green Power Proxy (any other Zigbee 3.0 routing device, e.g. zc/zr_genericapp)

Select Network Channel

First, determine which channel you would like to use for your test. To change the channel mask of the Green Power Sink and Green Power Proxy, modify DEFAULT_CHANLIST in f8wconfig.opts. To change the channel of the Green Power Device, change GPD_CHANNEL in the predefined symbols.

Create and Open the Network

Next, create a network with your coordinator. For example, use zc_light_sink to create a network, following the instructions in the Commissioning the Device Into the Network section of this readme:

Join the GPP Device

Next, join the Green Power Proxy (GPP). For example, we can use zr_genericapp as a GPP by simply joining it into the network, following the instructions Example Usage section of this readme:

Enable Commissioning on the GPS

Next, enable GPS Commissioning on the zc_light_sink by following the instructions in the Interfacing with the GP On/Off Switch Example App section of this readme:

Commission the GPD into the Network

Lastly, commission a GPD like the gpd_switch into the network by following the instructions in the Interfacing with the Light Sink Example App section of this readme:

Example Ubiqua Capture of Green Power Traffic

Here is an annotated Ubiqua capture of the expected behavior following the instructions above:

../_images/green-power-network-example.png