Extended PAN IDs
Extended PAN IDs (EPIDs) are 64-bit numbers that uniquely identify a PAN. ZigBee communicates using the shorter 16-bit PAN ID for all communication except one. The beacon response issued as the result of a beacon request contains an Extended PAN ID to allow a node that wishes to join a network to pick exactly the right one.
Every time a ZigBee node wishes to join a network, it sends out a beacon request. It then pays attention to all of the beacon responses, and picks the "best " network (if any) out of these responses. Take a look at the beacon response (also just called a beacon) from the switch in the last example (packet #3 from Example 4-1 ZigBee Extended PAN IDs, available on-line):
Frame 3 (Length = 24 bytes)
Time Stamp: 14:10:23.413
Frame Length: 24 bytes
Capture Length: 24 bytes
Link Quality Indication: 115
Receive Power: -60 dBm
Frame Control: 0x8000
.... .... .... .000 = Frame Type: Beacon (0x0000)
.... .... .... 0... = Security Enabled: Disabled
.... .... ...0 .... = Frame Pending: No more data
.... .... ..0. .... = Acknowledgment Request: Acknowledgement not required
.... .... .0.. .... = Intra PAN: Not within the PAN
.... ..00 0... .... = Reserved
.... 00.. .... .... = Destination Addressing Mode: PAN identifier and address field are not present (0x0000)
..00 .... .... .... = Reserved
10.. .... .... .... = Source Addressing Mode: Address field contains a 16-bit short address (0x0002)
Sequence Number: 221
Source PAN Identifier: 0x000a
Source Address: 0x0000
Superframe Specification: 0xcfff
.... .... .... 1111 = Beacon Order (0x000f)
.... .... 1111 .... = Superframe Order (0x000f)
.... 1111 .... .... = Final CAP Slot (0x000f)
...0 .... .... .... = Battery Life Extension: Disabled
..0. .... .... .... = Reserved
.1.. .... .... .... = PAN Coordinator: Transmitter is a PAN Coordinator
1... .... .... .... = Association Permit: Coordinator accepting Association Requests
GTS Specification: 0x00
.... .000 = GTS Descriptor Count (0x00)
.000 0... = Reserved
0... .... = GTS Permit: Coordinator not accepting GTS Requests Pending Address Specification: 0x00
.... .000 = Number of short Addresses pending: 0
.... 0... = Reserved
.000 .... = Number of extended Addresses pending: 0
0... .... = Reserved
Protocol ID: ZigBee NWK (0x00)
Frame Check Sequence: Correct
NWK Layer Information: 0x8421
.... .... .... 0001 = Stack Profile (0x1)
.... .... 0010 .... = nwkcProtocolVersion (0x2)
.... ..00 .... .... = Reserved (0x0)
.... .1.. .... .... = Router Capacity: True
.000 0... .... .... = Device Depth (0x0)
1... .... .... .... = End Device Capacity: True
Extended PAN ID: 0x0050c20d10046400
The Source PAN Identifier is 0x000a, but notice the contents of the final field above: the Extended PAN ID (0x0050c20d10046400). This field by default uses the Freescale OUI (0x0050c2) for the top 24 bits, and adds some random numbers for the rest.
EPIDs are not managed by any standards body. I recommend using your OUI, a unique 24-bit number issued by IEEE to companies making networking products, for the top 24 bits of the EPID. See MAC Addresses in Chapter 7, "The ZigBee Networking Layer," for more details on the OUI.
It's also interesting to note that Extended PAN IDs are completely unrelated to PAN IDs, and also to MAC addresses. They are a unique 64-bit number, used solely for helping nodes find the right network.
In this next example, both the NcbZcLightExtPan and the SrbZcSwitchExtPan projects will use the extended PAN ID of 0x1122334455667788. The PAN ID will be set to 0xffff so that the NcbZcLightExtPan will form a random PAN ID and the SrbZcSwitchExtPan will find it. The example will look very similar from a user perspective to the previous one, but the over-the-air mechanism used is quite different (see Figure 4.15).
Figure 4.15: Switch Finds the Right Extended PAN ID
As in the previous example, this one can be followed using the three-node Freescale Network Starter Kit. The BeeKit Solution file, capture file, and source code to the application can be found in the usual place: http://www.zigbookexamples.com. Download the following three projects to the respective boards (you can save yourself a step if you still have the SrbZcLightPanB from the previous example):
Boot all the boards. Notice the switch always joins the network based on Extended PAN ID, and not PAN B, which has the wrong Extended PAN ID.
An application could look for a range of extended PAN IDs to join. For example, it might look for all EPIDs with the mask of 0x0050c237b0xxxx to ensure that it's any one of a set of EPIDs from a particular manufacturer. To modify Freescale BeeStack to look for a range of EPIDs, modify the routine SearchForSuitableParentToJoin() found in AppStackImpl.c:
Use Extended PAN IDs (EPIDs) to force nodes to join a specific network.
Coming up in part 4: ZigBee addressing.
Printed with permission from Newnes, a division of Elsevier. Copyright 2008. "ZigBee Wireless Networking" by Drew Gislason. For more information about this title and other similar books, please visit www.elsevierdirect.com.
ZigBee applications - Part 1: Sending and receiving data | Part 2: No common C API
Picking the right technologies for your home network design
ZigBee RF4CE coexistence with common 2.4-GHz ISM-band consumer electronics
Optimization of battery power for ZigBee wireless nodes
Ad hoc networking: ready when you are
Practical Embedded Security - Part 3: Wireless technologies