2 Literature Review 8
2.3. ZigBee Protocol 12
5.3.2. Media access control 17
The media access control layer (MAC) controls access to the physical layer. It also handles channel access management, personal area network association, broadcasting of beacon messages management, packet delivery confirmation and power management. This section will describe in details the main functionalities of the MAC layer.
The ZigBee protocol supports the following two types of devices at this layer:
Full Function Device (FFD): this device can support any type of topology and can be used as a network coordinator. It is basically able to communicate with any device in the network. Only FFDs are able to be configured in a peer to peer topology as illustrated in Figure 13. A full function device can operate as a network coordinator, a PAN coordinator or a regular device.
Reduce Function Device (RFD): this node is only authorized to communicate with a full function device therefore it can only be configured in a star topology. RFDs cannot become coordinators.
2. Literature Review
18
Figure 12: Star Topology
Figure 13: Peer to Peer
A ZigBee PAN has a 16 bits unique identification. This network ID is used for ZigBee devices to join the network. The 16 bits key is generated by the network coordinator. Devices in a ZigBee PAN are assigned an extended 64 bits unique address. The 64 bits address includes a 40 bits frame assigned by the manufacturer and a 24 bits organizational unique identifier (OUI). The PAN devices are also assigned a shorter address of 16 bits once they join the network.
A typical MAC data unit or MPDU contains a MAC header, a MAC service data unit as well as a MAC footer.
2. Literature Review
19
Figure 15: Super frame Structure
Figure 16: Beacon Frame
Four types of MPDU are defined for ZigBee devices:
1. Data Frame: This is a standard message that contains data to be transmitted in its payload.
2. Super Frame: A super frame described in Figure 15 is a structure that is optionally sent by a coordinator between two beacon messages in order to provide guaranteed time slots for specific devices [25]. Super frames are available only for beacon enabled network. For non-beacon enabled network, un-slotted carrier-sense multiple access is used. Super frames can also be used to save energy by adjusting the inactive period. The frame contains a contention access period (CAP) where the channel is accessible by any device using a carrier-sense multiple access with collision avoidance scheme (CSMA/CA). The frame also contains a contention free period (CFP) where communication is reserve to specific devices. The request sent in this section are called Guaranteed Time Request Slot or GTS. These type of request are unidirectional. A maximum of 7 contiguous GTS frames can fit in a super frame. GTS is not always possible.
3. Beacon Frame: A beacon frame is a message used to maintain the PAN. Coordinators send this message periodically to identify the current structure of the network and to synchronize the nodes. It is also used to notify devices in the network that some messages are pending. The beacon message header is similar to a standard MPDU header except for the fact that it does not specify a destination address. The payload contains the following four fields:
‐ Super frame specification: this field specify the beacon order (length of the super frame), the size of the super frame contention access period, the battery life extension (inactive period), the association permit and the address of the PAN coordinator;
‐ GTS fields: This field specify the GTS request direction (time slot to receive or to send), the GTS descriptor count and the list of GTS request, the start slot of the GTS and the length of the GTS;
‐ Pending address field: This field is used to keep a record of devices waiting to access the channel;
2. Literature Review
20 ‐ Beacon payload
4. Acknowledgement Frame (ACK): An acknowledgement frame is similar to a data frame but only contains a frame control, a sequence number and a footer.
5. MAC Command Frame: the MAC commands are used to establish communication between devices and also to resolve MAC layer conflicts. The following commands are supported:
a. Association Request: this is a simple request to join a PAN
b. Disassociation Notification: this command is used to remove a node from the network.
c. Data Request: this command can be between two peer devices; between a coordinator and an end device and vice versa.
d. PAN ID Conflict Notification: once a conflict has been detected, the device that detected the conflict will send a conflict notification to the coordinator. The coordinator will respond with an acknowledgement.
e. Coordinator realignment: Once a conflict notification has been received, if the coordinator require to change the PAN ID, it will do so and broadcast a coordinator realignment message that will contain the new PAN ID that should be used.
f. Allocation of Guaranteed Time Slot Request: this request is used to reserve a time slot during the super frame active period.
g. Orphan Notification: when a device lose communication with its coordinator, it will broadcast an orphan notification command. The coordinator receiving this message will examine it routing table to confirm that the device has once been part of the network. Once it is confirmed, the coordinator will send a realignment command.
The MAC header contains 2 bytes used for frame control, a 1 byte message sequence number and a group of a maximum of 20 bytes allocated for addressing. The addressing frame contains the destination PAN identification, the destination address, the source PAN identification and the source address. The bits contained in the 2 bytes frame control are defined as follows:
Two bits to specify the type of frame (Data, Beacon, ACK or MAC Command) One bit to specify if security is enabled
One bit to show whether a frame is pending or not. One bit to specify is an acknowledge is required One bit to specify if it is an intra PAN message. 2 bits for the destination addressing mode 2 bits for source addressing mode.
And 4 bits reserved for future use.
Once a higher layer detects poor quality of communication, the MAC layer will receive an instruction to look for a channel with better quality. Channel access is managed at this layer using CSMA/CA.
2. Literature Review
21