MAC protocols in ContikiOS
Contents
Introduction
This tutorial covers the main features of Medium Access Control (MAC) protocols available on ContikiOS 2.7. Medium Access Control protocols take care of the organization of medium access in wireless networks. They can be interpreted as rules that coordinate when each node is going to transmit/receive packets.
There are a large number of protocols available in the literature, they can usually be classified as contention-based or reservation-based protocols. The first group is based on Carrier Sensing for detecting medium activity and are prone to collisions and lower efficiency; however, they are of easy implementation. The second group is more efficient in terms of throughput and energy, but require precise synchronization and is less adaptable to dynamic traffic. ContikiOS only presents MAC protocols of the first category.
There are about 5 types of MAC layers that can be used in ContikiOS. They are usually implementation of well-known MAC protocols for Wireless Sensor Networks; a few of them are implementations of protocols developed exclusively for ContikiOS, but that were based on previous work present in the literature.
You will learn
Here you are going to be to be more familiar with all MAC protocols implemented on ContikiOS. You are going to understand the organization of MAC protocols, where all files are located and where you should start when you want to modify a protocol. You will also learn the steps you need to take in order to implement your own MAC protocol. And finally, we evaluate two famous MAC protocols: ContikiMAC and X-MAC, showing a few statistics regarding their performance.
MAC, RDC and Framer drivers
The network stack implemented in ContikiOS is a little bit different than the usual 5-layers model typically adopted in TCP/IP. In-between the Physical and the Network layers, where usually is located the MAC, we have 3 different layers: Framer, Radio Duty-Cycle (RDC) and Medium Access Control (MAC). The figure X shows the organization of layers in ContikiOS.
<Figure>
The network layers can be accessed through the global variable NETSTACK, which is initialized during boot-up time to the appropriate type of layers that are expected to be used in the firmware.
Framer layer is not a common layer, but instead, it is a collection of auxiliary functions that are called for framezation os transmitting data and parsing of data being received. Examples of Framer types can be found in core/net/mac; there are two types of Framer layers: framer-802154.c and framer-nullmac.c.
Radio Duty-Cycle layer takes care of the sleep period of nodes. This is the most important layer in the sense that it decided exactly when the packets will be transmitted and it need to make sure that the node is awake when packets need to be received. RDC protocols' source codes are also located in core/net/mac. Examples of RDC layers that are implemented are: ContikiMAC.c, X-MAC.c, LPP.c, NullRdc-NoFramer.c, nullrdc.c and sicslowmac.c
Finally, the MAC layer takes care of addressing and retransmission of lost packets. The source files can be located in core/net/mac; we have only two types of MAC layer available: csma.c and nullmac.c.
How to choose and change your protocols
How to code your own protocol
Evaluating ContikiMAC and XMAC protocols
Edited by: Pedro