Green Power On/Off Switch
- Introduction
- Hardware Prerequisites
- Software Prerequisites
- Functional Description
- Configuration With SysConfig
- Example Usage
Introduction
This document discusses how to use the Green Power On/Off Switch Sample App and the different parts that compose it. Green Power On/Off Switch Sample Application is an example which exercises different features of TI Z-Stack for a green power device implementation. The device can operate as battery powered device or batteryless device.
Some of the features exercised include:
- Green Power application ID configuration for source ID or IEEE.
- Security level configuration.
- Auto commissioning.
- Sequence number capabilities.
Hardware Prerequisites
- The Launchpad which is used by this particular project.
Software Prerequisites
Code Composer Studio™ (CCS) v9.1 or newer
Functional Description
Software Overview
This section describes the software components and the corresponding source files.
Application Files
The application can behave as a batteryless device by defining the BATTERYLESS_DEVICE; with this, the application will read the keys pressed at the initialization of the device (start debug session or power cycle) and will transmit a command based on the keys pressed, after which an LED will indicate the status of the transmission and the application will reach its end of execution at a while(1). If BATTERYLESS_DEVICE is not defined, the device will behave as a battery operated device, being in deep sleep until a key is pressed.
- gpd_sw.c/.h: Contains the application's event loop, device initialization function calls (for timers, peripherals, Nvm, LEDs, Switches), Application notifications and all On/Off Switch specific logic.
- gpd_sw_data.c: Contains the Green Power Data Frame definitions for this sample application.
- main.c: Defines the application task and the application stack size.
Configuration With SysConfig
SysConfig is a GUI configuration tool that allows for TI driver and stack configurations.
To configure using SysConfig, import the SysConfig-enabled project into CCS. Double click the *.syscfg
file from the CCS project explorer, where *
is the name of the example project. The SysConfig GUI window will appear, where Zigbee stack and TI driver configurations can be adjusted. These settings will be reflected in the generated files.
The example project comes with working default settings for SysConfig. For the purposes of this README, it is not recommended to change the default driver settings, as any changes may impact the functionality of the example. The Zigbee stack settings may be changed as required for your use case.
Note that some Z-Stack settings are stored in non-volatile storage, and Z-Stack prioritizes stored settings over SysConfig settings. To guarantee SysConfig settings are applied, perform a factory reset of the device to clear non-volatile storage.
Example Usage
This section describes how to use this sample application.
Buttons
Button pressed | Battery device | Batteryless device |
---|---|---|
none | No Action | Sends Toggle Cmd |
1 | Sends On Cmd | Sends On Cmd |
2 | Sends Off Cmd | Sends Off Cmd |
LEDs
DIO6
: Red LED blinks if a frame(s) got transmitted but not all of them. If none of the frames were able to be transmitted then a solid On is set.DIO7
: If all duplicate frames are sent (GPDF_FRAME_DUPLICATES), then then Green LED becomes solid On.
Commissioning the device Into the network
Green Power Devices can be commissioned to a Zigbee network by sending a commissioning GPDF, a GPDF with auto-commissioning or a commissioning tool. A Zigbee device with green power proxy capabilities can create an entry for a Green Power Device with the commissioning data. The proxy device will translate the GPDF commands to ZCL notifcations for the Zigbee network.
Interfacing with the Light Sink Example App
Once the Light Sink and another routing device are in the same network, put the Light Sink in GP Commissioning Mode from the App Menu in the Green Power Sink Commissioning Screen. Executing this screen will change the GPS Commissioning status from 'DISABLED' to 'ENABLED'
Green Power Commissioning screen
Send the On/Off GPDF from the Green Power Device Switch which has Auto-Commissioning enabled. Then from the Green Power Sink Commissioning Screen disable the GP commissioning mode.
Once the GP commissioning mode is disabled, sending the On/Off GPDF with the Green Power Device Switch will toggle the Light Sink LED and the Application status line will be updated accordingly.
NOTE: If the LED is not toggled just repeat the commissioning process and try again.