4.2.2 Using Parameters Influencing Network Start

Certain CS parameters help to achieve an appropriate form of network start-up. This helps to choose a proper network by predefining the network Personal Area Network Identifier (PANID) or setting either a static or stochastic addressing scheme, among other things.

Choosing Device Type

In addition to the CS_DEVICE_TYPE parameter, which specifies the type of a device. The user must also consider the CS_RX_ON_WHEN_IDLE parameter to determine the device type. For more details, refer to the Zigbee Specification Revision 22 1.0 (05-3474-22). The CS_RX_ON_WHEN_IDLE parameter indicates whether the radio is permanently ON. Routers and the coordinator must always have this parameter set to true. On end devices, if the parameter’s value is false, which must only occur on end devices, the radio turns ON only to transmit data and to wait for a response from a parent for a certain short period. Furthermore, setting the parameter to false enables a polling mechanism that allows sleeping end devices to receive deferred messages stored by their parent while the end device was asleep. Therefore, the user must set the CS_RX_ON_WHEN_IDLE parameter to false on sleeping end devices.

For example, if the user needs to specify the device type at run-time, a typical configuration for a sleeping end device is:
//Prepare variablesDeviceType_t deviceType = DEVICE_TYPE_END_DEVICE;
bool rxOnWhenIdle = false;

//Set parameters CS_WriteParameter(CS_DEVICE_TYPE_ID,&deviceType);
CS_WriteParameter(CS_RX_ON_WHEN_IDLE_ID, &rxOnWhenIdle);

Handling the Network PANID

There are two identifiers to define the network:
  • Extended PANID
  • Short PANID (network PANID)
The extended PANID requires a 64-bit value and serves as the primary identifier. Meanwhile, the short PANID uses a 16-bit value, often generated randomly, to replace the extended PANID in frame headers, reducing overhead. The CS_EXT_PANID parameter predefines the extended PANID, directing the coordinator to establish a network with a PANID that matches this parameter and prompting other nodes to join a network with the same PANID. If a router or an end device sets CS_EXT_PANID to 0x0, it joins the first suitable network it finds.
Administrators can also predefine the short PANID on the coordinator, for example, when the coordinator needs to reset and reconnect to the same network after powering ON. In such cases, the user must set CS_NWK_PREDEFINED_PANID to ‘1’. The user can configure these parameters at compile-time or run-time. The following example provides an insight into configuration at run-time:
//Prepare variables 
bool predefPANID = true;
uint16_t nwkPANID = CPU_TO_LE16(0x1111); //Set to 16-bit value converted to little endian format
CS_WriteParameter(CS_NWK_PREDEFINED_PANID_ID,&predefPANID); //Indicate that the PANID is predefined
CS_WriteParameter(CS_NWK_PANID_ID, &nwkPANID); //Set the PANID value

Stochastic and Static Addressing

The user can choose between stochastic and static addressing schemes to address nodes in the network by setting the CS_NWK_UNIQUE_ADDR parameter to ‘0’ or ‘1’, respectively. Addressing scheme determines the method used to assign a short (network) address to the device in the following way:
  • In the stochastic scheme, the stack automatically selects a unique short address during network start, ensuring it differs from all existing addresses in the network.
  • In static addressing, the stack uses the value provided by the CS_NWK_ADDR parameter for the short address. With static addressing, it is the responsibility of the user to ensure that all addresses assigned to nodes in the network are unique.