## 5 IEEE 802.15.4 Technology
### IEEE 802.15.4 MAC Layer  
IEEE 802.15.4 uses a protocol based on the CSMA/CA algorithm, which requires listening to the channel before transmitting to reduce the probability of collisions with other ongoing transmissions.  
IEEE 802.15.4 defines two different operational modes, namely the _beacon-enabled_ and the _non beacon-enabled_, which correspond to two different channel access mechanisms.  
In the non beacon-enabled mode nodes use an unslotted CSMA/CA protocol to access the channel and transmit their packets [12]. The algorithm is implemented using units of time called backoff periods. First, each node will delay any activities for a random number of backoff periods. After this delay, channel sensing is performed for one unit of time: if the channel is found free the node immediately starts the transmission; if, instead, the channel is busy the node enters again in the backoff state. There exists a maximum number of time the node can try to access the channel (i.e., to sense the channel). When this maximum is reached, the algorithm ends and the transmission cannot occur.  
In the beacon-enabled mode [12], instead, the access to the channel is managed through a superframe, starting with a packet, called _beacon_, transmitted by WPAN coordinator. The superframe may contain an inactive part, allowing nodes to go in sleeping mode, whereas the active part is divided into two parts: the Contention Access Period (CAP) and the Contention Free Period (CFP), composed of Guaranteed Time Slots (GTSs), that can be allocated by the sink to specific nodes (see Figure 6). The use of GTSs is optional.  
The duration of the active part and of the whole superframe, depend on the value of two integer parameters ranging from 0 to 14, that are, respectively, the superframe order, denoted as \(SO\), and the beacon order, denoted as \(BO\), with \(BO\geq SO\). \(BO\) defines the interval of time between two successive beacons, namely the beacon interval, denoted as \(BI\); its duration is equal to  
\[BI=16\cdot 60\cdot 2^{BO}\cdot T_{s} \tag{1}\]  
where \(T_{s}=16\) [\(\mu s\)] is the symbol time.  
The duration of the active part of the superframe, containing CAP and CFP, namely the superframe duration, denoted as \(SD\), is equal to  
\[SD=16\cdot 60\cdot 2^{SO}\cdot T_{s} \tag{2}\]  
According to the standard each GTS must have a duration multiple of \(60\cdot 2^{SO}\cdot T_{s}\) and must contain the packet to be transmitted by the node to which the GTS is allocated to and also an inter-frame space, equal to \(40\,T_{s}\). This is, in fact, the minimum interval of time that must be guaranteed between the reception of two subsequent packets. The WPAN coordinator may allocate up to seven GTSs, but a sufficient portion of the CAP must remain for contention-based access. The minimum CAP duration is equal to 440 \(T_{s}\).  
For what concerns the CSMA/CA algorithm used in the CAP portion of the superframe the only difference with the non beacon-enabled mode is that nodes have to find the channel free for two subsequent backoff periods before transmitting the packet. The other difference with the non beacon-enabled case is that backoff period boundaries of every node in the WPAN must be aligned with the superframe slot boundaries of the coordinator; therefore, the beginning of the first backoff period ofeach node is aligned with the beginning of the beacon transmission. Moreover, all transmissions may start on the boundary of a backoff period.