Communications and Network
Vol.3 No.3(2011), Article ID:6771,4 pages DOI:10.4236/cn.2011.33018

A Effective Method for Properties Access in MAC Layer of ZigBee

Qi-Yong Pan1, Jin Wu2, Yi-Huai Wang2, Jingfei Ni2

1College of Physics & Electronic Engineering, Changshu Institute of Technology, Changshu, China

2College of Computer Science & Technology, Soochow University, Suzhou, China


Received April 20, 2011; revised May 24, 2011; accepted June 3, 2011

Keywords: ZigBee Protocol, IEEE 802.15.4, MAC Layer, Property


The attribute access methods of MAC layer in wireless communication network is researched. Aiming at conquering the problem of the shared ZigBee wireless channel resulting multi-channel device conflicts when using the data channel at the same time, therefore the protocol is improved and a method used to access the properties of ZigBee is proposed, and this method can be achieved to manage effectively for all the 29 properties MAC layer, save storage space and realize property maintenance and expansion.

1. Introduction

ZigBee [1] is a technology has the characters of short distance, low complexity, low power, low data rate and low-cost, and it is currently widely used.

A complete ZigBee protocol [2-4], includes the Application Layer (APL), the network layer (NWK), Medium Access Control Layer (MAC) and Physical Layer (PHY) and so on. MAC layer is responsible for a node and its immediate neighbors to provide a reliable communication link to provide collision avoidance, in order to improve communication efficiency, responsible for the assembly and decomposition of MAC layer frames.

ZigBee wireless channel is as a shared channel, at any time, if a device is using the channel to send data, other devices can not use the channel, otherwise it will generate an error for the conflicts (collisions). How to solve the reasonable sharing of radio channel is one of the key technologies of MAC layer. The overall network performance such as throughput, delay, energy consumption and so on depends on the used MAC protocol. In the management of physical layer properties, for the number of attributes in physical layer only 4, so it can be realized by just using statements or switch/case statement, but there are up to 29 properties of MAC layer. So in order to realize properties setting and the original language reading, these is a need to manage and organize the properties, or else the function code size will be too large, intensive. So this paper tries to find an easy method to manage all the properties in constant time, and then the simulation is given and the result proves it is a feasible way.

2. The Relative Work

2.1. ZigBee MAC Layer Overview

The MAC layer reference model defined by IEEE 802.15.4 is shown in Figure 1, where PD-SAP (PHY Data Service Access Point) is the data service interface physical layer of provided to the MAC layer; PLMESAP (Physical Layer Management Entity-Service Access Point) is the management services interface physical layer provided to the MAC layer; MCPS-SAP MAC Common Part Sublayer-Service Access Point) is the data service interface MAC layer provided to the network layer; MLME-SAP (MAC Sublayer Management

Figure 1. The Reference model of MAC.

Entity-Service Access Point) is the management service interface MAC layer provided to network layer.

MAC layer handles all the accesses for physical radio channel, it is mainly to complete the following work: If the device is a coordinator, then it can choose generating web beacons (beacon) and support Personal Area Network (PAN) connection and disconnection and equipment security, using CSMA-CA (Carrier Sense Multiple Access with Collision Avoidance,) mechanism for channel access; handling and maintenance of protected time slot (Guaranteed Time Slot, GTS); providing a reliable link for two peer MAC entities.

2.2. Beacon and Non-beacon Network

MAC layer defines two basic modes of operation: Beacon model (beacon) and non-beacon (non-beacon) model, and the corresponding network are called beacon network and non-beacon networks respectively.

There is a format called super frame in the letter network. The active part of the super frame is in the letter, the network provides for a standard called super frame (super frame) format. The active part of super frame is divided into 16 equal length time slots, the length of each time slot determined by the coordinator, and through the beacon frame it can be broadcasted to the entire network. Coordinate sends the beacon frame in the start of super frame, followed by a competitive access period (Contention Access Period, CAP), during this time all nodes access the channel in a competitive channel; then followed by the competition-free period (Contention-Free access Period, CFP), the node uses time division multiplexing access channel; and finally is the non-active period, the node goes to sleep and wait for the next super-frame period and send beacon frame at the next beginning of super frame.

Non-beacon network is more flexible, coordinator has no necessary to send beacon frames periodically, but only when the device sends a request, the node is accessing channel in a competitive way. Because of there are the periodical beacon in the beacon network, so all nodes in the network can be synchronized, but the size of the synchronization network will not be so great, generally proper for the communication between low latency devices. In fact, the non-beacon network is used more in ZigBee.

In the beacon network, competitive access channel CSMA-CA algorithm using the time slot, then the back-off period boundary of each device should be with the super-frame time slot boundaries. In non-beacon network, non-slotted CSMA-CA algorithm is used and no backoff period boundary demands are required. This design in this paper uses non-beacon networks.

3. Channel Access for Non-beacon Network MAC Layer

3.1. Data Transfer Type

In IEEE 802.15.4, there are three different data transfer types such as from the device to the coordinator, from the coordinator to the device and from one to another in the Ad-hoc network. To highlight the low power consumption, data transfer can be divided into the following three ways [5,6]:

1) Direct transfer (direct transfer): It is for all of the above three types of data transfer.

2) Indirect transfer (indirect transfer): It is only proper for the data transfer from the coordinator to the device. In non-beacon network, the device is asking if there are the data which the device demands. This way, you can make the device most of the time receiving circuit in sleep state, thereby significantly reducing power consumption.

3) Protecting slot (GTS) transmission: It is only suitable for data transfer between the device and the coordinator in the beacon network.

3.2. The Non-slot CSMA-CA Algorithm

Since all the nodes in the ZigBee network are working on the same channel, so if its neighboring nodes are sending data at the same time and the conflict will be leaded. The CSMA-CA algorithm is proposed to solve the shared access to wireless channels. To be clearly, the nodes listen data before sending the data channel. If the channel is idle the node can send data, or it will conduct a random back-off, namely after a random delay time, and then to listen. All nodes share the same channel. Random back-off time is exponential and has the maximum value. The reason for this is if multiple monitoring channels are busy, it is possible that a large quantity of data channels, thus allowing the node waiting more time to avoid the busy listening.

MAC layer takes time to deal with the data received from the physical layer. So after sending the frame, there will be frame interval (Interframe Spacing, IFS). If the transfer needed to confirmed, IFS should be followed after the confirmation frame.

CSMA-CA algorithm implementation should take into account of the requirements of IFS. For non-beacon network, the CSMA-CA algorithm is used in non-slotted as the basic process showed in Figure 2. Each device maintains two variables for every task such as NB and BE. NB is the back-off number of executing CSMA-CA algorithm. It is initialized to 0 before each implementation of the new send task. BE is the back-off index and

Figure 2. The basic flow of CSMA-CA.

relative to the back-off period before the device trying to access the channel. In the non-slot system, BE is initialized as the same value of macMinBE. In the IEEE 802.15.4 in the value of macMinBE, aMaxBE and mac MaxCSMABackoffs are respectively 5, 4 and 3.

3.3. MAC Layer Properties Management Design

The properties of MAC Layer have up to 29, in order to set the properties and read the original language, and they should be managed and organized using some forms. If the switch/case is used in the function, it will account an amount of space and not help for the extension and maintain, therefore, a method is advanced to manage all the constant time.

Although the data types and the range of the property in the MAC layer are different, but there are some rules to follow. The data types can be conclude as three such as integer, boolean and byte arrays. There are only two kinds of values for boolean attributes, namely, true or false value. There are not limit for integer properties, but there are also individual attributes only take a certain integer values within a row or just take a few discrete values, but the number for discrete value is no more than 2, and these integral properties are 8-bit unsigned integer. And for the byte array type that some node address. Most important is all of the properties are continuous attributes, and the current is from 0 × 40 - 0 × 55 and 0 × 70 - 0 × 76.

Based on the above analysis rule, a direct idea is to use the feature continuous of attribute identifier to construct a pointer array structure, each element of the array points to the start address of each attribute, and the pointer in the program to in initialization complete the elements of point array and the relationship between the attributes in MAC layer. Then the idea of look-up table is used in converting the property identifier to the subscript label of pointer array. This would resolve the accessing any attributes in memory time, the range and the types of properties can be obtained as follows:

First of all, you can add an 8-bit unsigned integer m_nType to record the type of the property, so the property will know the byte length, and the defined rules are as follows: If the highest bit of m_nType is 1, that is the attribute of byte array type, and its low 7 denotes the number of bytes; otherwise, that is non-byte type. In the current definition 0 × 00 represents Boolean, 0 × 01 - 0 × 03 denotes respectively, 8, 16 and 32 bit unsigned integer, 0 × 04 ~ 0 × 06, respectively, represents 8,16 and 32-bit unsigned integer pointer. So the identification of property types can be recognized. Secondly, the range of the attribute can be adding two 8-bit unsigned integer variable m_nMax and m_nMin to record the maximum and minimum value, and dfollowing rules are defined as follows:

If m_nMax = m_nMin = 0, then the value of the property without restrictions;

If m_nMax < m_nMin, then the property takes the discrete values;

If m_nMax ≥ m_nMin, then the value of the property has certain limitations. The rules defined the range of attribute can solve the problem of detecting the illegal property values assigned when setting MAC attribute value.

Finally, a structure array is used to record the MAC layer attribute address and type information, in order to save RAM. The corresponding structure type is defined as follows:

4. Simulation

The testing of MAC layer focused on the correctness of

Figure 3. The analysis program for MAC layer frame.

testing the beacon frames and MAC command frame structure of organizations. At the beginning of implementation MAC layer functions is realized by using the 16 hex display of serial port debugging tool, then the compare and analysis between the received frame format and its detailed definition of comparative by bit, this is a very time-consuming and requires patience. Later, with the increase of realization for the command frame, the work of test will be amount. So the test program decomposes the MAC frame according to the frame format is proposed showed in Figure 3, greatly improving the test efficiency and reduce the subsequent test workload.

5. Conclusions

The channel access algorithm is proposed in this paper, the format definition of MAC frame is given. The process of connecting device initiating the connection and coordinator reacting to the connection is described, the basic steps of data transceivers and the use of recognized MAC layer. Aiming at the special rule of MAC, a method can maintain and extend any properties in constant time is introduced. Finally, physical layer protocol is implemented and tested on the basis of non-beaconing networks based on ZigBee MAC layer protocol.

6. References

[1]       ZigBee Alliance, ZigBee Specification 053474r1, October 2006.

[2]       D. Johnson, Y. Hu and D. Maltz, “The Dynamic Source Routing Protocol (DSR) for Mobile Ad Hoc Networks for IPv4,” RFC4728, February 2007.

[3]       C. Perkins, E. Belding-Royer and S. Das, “Ad HoconDemand Distance Vector (AODV) Routing,” RFC3561, July 2003.

[4]       E. Belding-Royer and C. Perkins, “Evolution and Future Directions of the Ad Hoc on-Demand Distance-Vector Routing Protocol,” Ad Hoc Networks, Vol. 1, No. 1, 2003, pp. 125-150. doi:10.1016/S1570-8705(03)00016-7

[5]       IEEE, Wireless Medium Access Control (MAC) and Physical Layer (PHY) Specifications for Low-Rate Wireless Personal Area Networks, IEEE Std 802.15. 4-2003, October 2003.

[6]       IEEE, Wireless Medium Access Control (MAC) and Physical Layer (PHY) Specifications for Low-Rate Wireless Personal Area Networks, IEEE Std 802.15.4-2006, September 2006.