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.
//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
- Extended PANID
- Short PANID (network PANID)
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. 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
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_ADDRparameter 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.
