# A Novel IEEE 802.15.4e DSME MAC for Wireless Sensor Networks
## 3 The Proposed DSME MAC
### A New Channel Access Scheme  
CSMA/CA scheme is the key component in IEEE 802.15.4e MAC. It is adopted to arrange the devices in the network with an appropriate order when they access the channel. When too many devices have data to transmit to the coordinator at the same time, they try to access the channel simultaneously, which increases the collision and makes the channel busy. As per IEEE 802.15.4e standard, the numbers of superframes present in the DSME superframe are \(2^{BO-SO}\). Hence, the number CAP period presented in the DSME superframe will be \(2^{BO-SO}\). To restrict the number of users to access the channel simultaneously, we propose here a new channel access scheme in which each device is allowed to contend the channel only in one CAP period. Upon receiving the beacon successfully, each device knows the value of BO and SO from the beacon and gets the numbers of CAP period presented in the DSME superframe as \(2^{BO-SO}\). Based on the following equation, each device calculates the index of its assigned CAP period. \[CAP_{index}=(S_{ID}+N_{offset})MOD(2^{BO-SO}) \tag{2}\]  
where \(S_{ID}\) is ID of each device and \(N_{offset}\) represents the offset value in the mapping function. \(N_{offset}\) is determined based on a time stamp divided by a beacon interval field in a beacon frame from the coordinator. It is to be noted that \(N_{offset}\) improves the fairness among the devices as it is changed with respect to the beacon interval. Hence, the mappings of devices to the CAPs are different among beacon intervals. All devices upon receiving the beacon are synchronized and go for the power saving mode. The devices wake-up at the start of the assigned CAP period to access the channel. The devices those are assigned to a CAP period contend with each other in that CAP period only. Our proposed mapping function can allocate the devices in to different CAPs so that the collision rate can be reduced significantly. After the allocation, the variables NB, CW, BE and RT are initialized for each allocated device. NB is the number of times the CSMA/CA scheme required to delay while attempting the current transmission, which is initialized to 0 before every transmission. CW is the contention window length and BE is the backoff exponent. RT is the maximum number of retransmission attempts. Each device generates a random backoff counter (\(R_{b}\)) in the range of \([0;2^{BE}-1]\) units. When the backoff period is count down to zero, the tagged device performs the CCA if the remaining time \(R_{CAP}\) in the CAP period is enough to perform the CCA and to transmit the required data. Let the duration of one backoff slot, time duration to perform one CCA, time for data transmission be \(\sigma\), \(T_{CCA}\) and \(T_{D}\), respectively. It is to be noted that the CAP and CFP period in the superframe is fixed. According to the standard, GTS slots are allotted to different devices based on their requests received by the coordinator during CAP. However GTS slots may be under utilized, if coordinator receives less number of requests as compared to the available slots in the CFP, which will affect the network throughput. Hence, we modify the beacon format by adding one bit field called Cross CAP Boundary (CCB) as shown in Figure 2 to utilize the unused slots, which is allowed by the standard. As per the IEEE 802.15.4e standard, it is to be noted that a device doubles the contention window size up to \(MAX_{NB}\) and performs the CCA again by choosing a random delay within the contention window and discards the packet after maximum number of retransmission \(MAX_{RT}\) attempts if the device finds the channel busy during any of the CCA. After finding the channel idle in the first CCA, the second CCA is performed and transmission is started if the channel is found idle. This procedure is repeated if the channel is found busy during the second CCA, which may be incurred by two reasons. When a tagged device performs the first CCA if another device performs its second CCA, the channel remains busy.