Running the demonstration examples
This section describes how to use the supplied pre-built binaries to run the example applications on a ZigBee device. All the applications run on the K32W148-EVK board (or the FRDM-MCXW71 / MCX-W72-EVK / FRDM-RW612 / RD-RW612-BGA boards). The examples do not run on other development kits. All the ZigBee wireless demo applications are configured to use a default channel 12. The pre-processor configuration uses the setting SINGLE_CHANNEL=12
, which can be overwritten to change it to a different channel.
The ZigBee examples work in the Centralized (Trust center) network only, and all devices are expected to join with the ZigBee09 key. Once joined, the devices then automatically negotiate a new TCLK key.
For details of the differences between a Centralized (Trust center) network and a Distributed network, see the ZigBee Devices User Guide (document JNUG3131).
Loading the applications
The table below lists the binaries generated by the examples.
Hardware platform |
Binary files |
---|---|
K32W148-EVK board |
• k32w148evk_zigbee_coordinator_bm.axf |
FRDM-MCXW71 board |
• frdmmcxw71_zigbee_coordinator_bm.axf |
MCX-W72-EVK board |
• mcxw72evk_zigbee_coordinator_freertos.axf |
To write the images to the board, perform the following steps:
Use the J-Link utility.
Download the J-Link from J-Link / J-Trace Downloads.
Plug the K32W148-EVK board (or FRDM-MCXW71 board, or MCX-W72-EVK board) to the USB port (do not keep the SW4 button pressed while doing this step).
Create a
commands_script
file with the following content (change the application name as necessary):Reset Halt Erase LoadFile <PATH_TO_AXF> Reset Go Quit
Copy the application and
commands_script
in the same folder where the J-Link executable is placed.Run the following code:
JLink.exe/JLinkExe (linux) -<DEVICE_NAME> -if SWD -speed 4000 -autoconnect 1 -CommanderScript commands_script
where
DEVICE_NAME
can be:K32W1480 for K32W1
MCXW716 for MCXW71
MCXW727C_CORE0 for MCXW72
After completing the above steps, reset the board or module to run the application.
Loading the application for RW612 platform
For instructions on loading the examples for the RD-RW612-BGA and FRDM-RW612 boards, refer to the section RW612: loading the applications.
Refer to the Over The Air Upgrade (OTA) for RW612 platforms.
Note: The RW612 platform only supports the west build.
Parent topic:Running the demonstration examples
Coordinator functionality
The functionality of the Coordinator application is described as follows:
The Coordinator is responsible for initially forming the network. It manages other devices that can join the network via the Trust center functionality. It distributes security materials to those devices that are allowed to join. The Coordinator supports the mandatory clusters and features of the Base Device as defined in the ZigBee Base Device Behavior Specification.
The Coordinator also supports the On/Off Cluster as a client for demonstrating the “Finding and Binding” functionality.
The serial commands issued from a terminal program control the Coordinator. The terminal program runs on a PC connected to the Zigbee device through a USB connection. The Coordinator application is configured to communicate with the following configuration:
Baud rate = 115200
Data = 8 bits
Stop = 1 bit
Parity = None
Flow control = None The serial interface is not case-sensitive. For a summary of the serial interface, refer to Summary of Serial Interface Commands.
Forming a network
A network can be formed from a factory-new Coordinator (Network Steering while not on a network) as follows:
Enter the
form
on the serial interface. The Coordinator then starts a network.Using a ZigBee packet sniffer (running separately on a USB Dongle), validates the user regarding network status. The periodic “link status” messages must be present on the operational channel. This step is optional.
Parent topic:Coordinator functionality
Allowing other nodes to join (Network Steering)
Once a network has been formed, it must be opened to allow other devices to join it, referred to as Network Steering while on a network. To initiate Network Steering, perform the following steps:
Enter the
steer
on the serial interface (Dongle or Carrier Board).Then, the Coordinator broadcasts a Management Permit Join Request to the network to open the “permit join” window for 180 seconds.
The Network Steering process (for devices not on a network) can now be triggered on the devices that are to join the network.
Parent topic:Coordinator functionality
Operating the device (Coordinator)
The operational functionality of this device in this demonstration is provided by the On/Off cluster. Enter the toggle
in the serial interface (Carrier Board) to send an OnOff Toggle command to the bound device (in the Binding table).
Parent topic:Coordinator functionality
Rejoining a network (Coordinator)
As a Coordinator, when this device is restarted in a state that is not factory-new, it resumes operation in its previous state. All applications, bindings, groups, and network parameters are preserved in non-volatile memory.
Parent topic:Coordinator functionality
Performing a factory reset (Coordinator)
The Coordinator can be returned to its factory-new state, which erases all persistent data except the outgoing network frame counter.
To perform a factory reset, enter the following command on the serial interface:
factory reset
Parent topic:Coordinator functionality
Summary of serial interface commands
The serial port connection to the Coordinator application is set up with the following configuration settings:
Baud rate = 115200
Data = 8 bits
Stop = 1 bit
Parity = None
The serial commands are not case-sensitive.
Serial command |
Action |
---|---|
|
Sends an On/Off Toggle command to bound devices |
|
Triggers Network Steering for a device on the network |
|
Triggers network formation for a device not on a network |
|
Triggers Finding and Binding as an initiator |
|
Factory resets the device, erasing persistent data |
|
Triggers a software reset (no loss of data) |
Parent topic:Coordinator functionality
Parent topic:Running the demonstration examples
Router functionality
For demonstrating the “Finding and Binding” functionality, the Router also supports the On/Off Cluster as a server.
Forming or joining a network (router)
The router can only join an existing network. If it does not find the network, it continues discovering the network until it can find a network to join.
Parent topic:Router functionality
Joining an existing network using network steering (Router)
A factory-new Router can join an existing ZigBee only when the network is opened to accept new joiners (Network Steering for a device on a network).
Joining an existing network using Network Steering is achieved as follows:
Trigger Network Steering on one of the devices already on the network (Coordinator or another Router in the same ZigBee network).
Then reset using the RESET button or power on the joining Router device.
As a result, the Router starts a network discovery and the associate process. Association is followed by an exchange of security materials and an update of the Trust center link key (if joining a Centralized Trust center network).
By power cycling, the join can be retried if it fails.
Parent topic:Router functionality
Allowing other devices to join the network (Router)
Once the Router joins a network, the network is immediately opened for 180 seconds to allow other devices to join (Network Steering while on a network). During this time, new devices can join the network using either the Coordinator or the Router as the parent, with no additional steps required. After this time expires, no new nodes can ever join the network. If rejoining other nodes is necessary after this time expires, perform the following steps:
Press the USER button on the (K32W148-EVK / FRDM-MCXW71 / MCX-W72-EVK / FRDM-RW612 / RD-RW612-BGA board). The same button is also used to start “Finding and Binding”, described in Binding devices.
Then, the Router broadcasts a Management Permit Join Request to the network to open the “permit join” window for 180 seconds. The Network Steering process (for devices not on a network) can now be triggered on the devices that are to join the network.
Parent topic:Router functionality
Operating the device (router)
The operational functionality of this device in this demonstration is provided by the On/Off cluster. As the device supports the On/Off cluster server, its operation is passive, and it responds to commands sent by bound devices. It responds to an OnOff Toggle command from a bound controller device, by toggling the LED1 on the K32W148-EVK, FRDM-MCXW71, MCX-W72-EVK, RD-RW612-BGA, or the FRDM-RW612 board.
Parent topic:Router functionality
Rejoining a network (router)
As a Router, when this device is restarted in a state, which is not factory-new, it resumes operation in its previous state. All applications, binding, group, and network parameters are preserved within the non-volatile memory of the device.
Parent topic:Router functionality
Performing a factory reset (router)
The Router can be returned to its factory-new state (erasing all persistent data except the outgoing network frame counter) as follows:
Hold down the USER button and press the RESET button on the board (K32W148-EVK / FRDM-MCXW71 / MCX-W72-EVK / FRDM-RW612 / RD-RW612-BGA).
The Router then broadcasts a Leave Indication on the old network. It also deletes all persistent data (except the outgoing network frame counter) and performs a software reset.
The two supported over-the-air commands for removing a device from the network are as follows:
Network Leave Request without rejoin
ZDO Management Network Leave Request without rejoin
The Reset command of the Basic cluster causes the ZCL to be reset to its factory-new defaults, resetting all attributes and configured reports. It does not remove the device from the network. Therefore, all network parameters, groups, and bindings remain in place.
Parent topic:Router functionality
Parent topic:Running the demonstration examples
End Device functionality
The End Device is not capable of either forming a network or being a parent to other devices joining the network.
Two types of End Device are as follows:
“RX On” End Devices, which are always ready to communicate in the network
Sleepy “RX Off when Idle” End Devices, which can sleep for periods of time during which it cannot communicate
The End Device supports the mandatory clusters and features of the Base Device as defined in ZigBee Base Device Behavior Specification.
For demonstrating the “Finding and Binding” functionality, the End Device also supports the On/Off cluster as a client.
All communications to/from the End Device are passed through its parent Coordinator or Router. For an RX Off with the Idle End Device, communication is initiated from the End Device through Poll Requests. The parent device then buffers data for the child End Device for some time. During this period, the End Device must send periodic Poll Requests to its parent to receive any messages that are waiting for it.
For the RX On device, no poll is required and messages are sent directly from the parent. However, regular messages must be sent. Otherwise, the device can be timed out.
Joining an existing network using network steering (ED)
A factory-new End Device can join an existing network once the network opens to accept new joiners (Network Steering for a device on a network).
Joining an existing network using Network Steering is achieved as follows:
Trigger Network Steering on one of the devices already on the network.
Then, reset using the RESET button or power on the End device.
Parent topic:End Device functionality
Operating the device (ED)
The operational functionality of this device in this demonstration is provided by the On/Off cluster. The device supports the On/Off cluster server. Therefore, its operation is passive and it responds to commands sent by bound devices. It responds to an OnOff Toggle command from a bound controller device, by toggling the LED1 on the K32W148-EVK, FRDM-MCXW71, MCX-W72-EVK, RD-RW612-BGA, or the FRDM-RW612 board.
Parent topic:End Device functionality
Rejoining a network (ED)
An End Device can be restarted in a state, which is not factory-new. In such a case, it automatically sends a Network Rejoin Request to re-establish contact with its previous parent. If this fails, it then tries to join any Router on the network that can host it. The End Device attempts to rejoin when powered on and after it wakes from the deep sleep state. All the application, binding, group, and network parameters are preserved in non-volatile memory.
Parent topic:End Device functionality
Performing a factory reset (ED)
The End Device can be returned to its factory-new state (erasing all persistent data except the outgoing network frame counter) as follows:
Hold down the USER button and press the RESET button on the K32W148-EVK board or FRDM-MCXW71 board, or MCX-W72-EVK board.
The End Device then unicasts a Leave Indication to its parent. The parent then broadcasts this message again to the old network. The End Device deletes all persistent data (other than the outgoing network frame counter) and performs a software reset.
There are two supported over-the-air commands for removing a device from the network as follows:
Network Leave Request without rejoin
ZDO Management Network Leave Request without rejoin
The Reset command of the Basic cluster causes the ZCL to be reset to its factory-state defaults. It also resets all attributes and configured reports. This step does not remove the device from the network and all network parameters, groups, and bindings remain in place.
Parent topic:End Device functionality
Parent topic:Running the demonstration examples
Binding devices
The Router and End Device support the On/Off cluster as a server and implement the “Finding and Binding” process as a target.
To trigger “Finding and Binding” as a target, perform the following steps:
Press the USER button on the K32W148-EVK board (or the K32W148-EVK / FRDM-MCXW71 / MCX-W72-EVK / FRDM-RW612 / RD-RW612-BGA board) of the target device. The same button is used to start Network Steering, described in Allowing Other Devices to Join the Network.
Start “Finding and Binding” on the initiator device.
This step causes the End Device or Router to self-identify for 180 seconds. In this duration, the initiator tries to find the identifying devices, queries their capabilities, and creates bindings on the devices with matching operational clusters. As part of this process, the Route or End Device can receive an Add Group
command and/or a Binding Request
command.
Reporting is a mandatory feature in ZigBee 3.x. The Router and End Device supports the On/Off cluster as a server and the OnOff attribute of this cluster is a reportable attribute as defined in ZigBee Base Device Behavior Specification. The Router and End Device hold a default configuration for reporting the state of the OnOff attribute. Once a device wishing to receive these periodic and on-change reports creates a remote binding, the Router starts to send reports to this bound device. The frequency of the reports depends on the default report configuration of the individual target device; 60 seconds in this case. The device receiving the reports can request the change by sending a Report Configuration
command.
Parent topic:Running the demonstration examples