Monthly Archives: August 2018

802.15.4 CSMA/CA

The WiSense MAC is based on the IEEE 802.15.4 standard. It uses the un-slotted CSMA/CA algorithm for transmission of all frames (data and control).

Each time a device wishes to transmit data frames or MAC commands, it waits for a random period. If the channel is found to be idle, following the random back-off, the device transmits its data. If the channel is found to be busy following the random back off, the device waits for another random period before trying to access the channel again. Acknowledgment frames are sent without using a CSMA-CA mechanism.


The algorithm is implemented using units of time called back-off periods, where one back-off period shall be equal to aUnitBackoffPeriod.

In un-slotted CSMA-CA, the back-off periods of one device are not related in time to the back-off periods of any other device in the PAN.

Each device  maintains two variables for each transmission attempt: NB, and BE.

  • NB is the number of times the CSMA-CA algorithm is required to back off while attempting the current transmission; this value shall be initialized to zero before each new transmission attempt
  • BE is the back-off exponent, which is related to how many back-off periods a device shall wait before attempting to assess a channel. BE is initialized to the value of macMinBE.


MAC  constants


  • Description: The number of symbols forming the basic time period used by the CSMA-CA algorithm.
  • Value:  20


MAC PIB attributes


  • Data Type: Integer
  • Range: 3–8
  • Description: The maximum value of the back-off exponent, BE, in the CSMA-CA algorithm.
  • Default value:  5



  • Data Type: Integer
  • Range: 0 – macMaxBE
  • Description: The minimum value of the backoff exponent (BE) in the CSMA-CA algorithm.
  • Default value:  3



  • Data Type: Integer
  • Range: 0 – 5
  • Description: The maximum number of back-offs the CSMA-CA algorithm will attempt before declaring a channel access failure.
  • Default value:  4



  • Data Type: Integer
  • Range: 0 – 7
  • Description: The maximum number of retries allowed after a transmission failure.
  • Default value:  3



CCA is performed by the radio chip (CC11XX) when requested through the STX command.

  • In IDLE state: Enable TX. Perform calibration first if SETTLING_CFG.FS_AUTOCAL = 1.
  • If in RX state and PKT_CFG2.CCA_MODE != 0: Only go to TX if channel is clear.

If the radio controller is in RX when the STX or SFSTXON command strobes are used, the TX-on-CCA function will be used. If the channel is clear, TX (or FSTXON state) is entered. The PKT_CFG2.CCA_MODE setting controls the conditions for clear channel assessment.



Baud Rate:  20000 symbols/sec, symbol_time is  50 microsecs

Assume macMaxBE is 5 and  macMinBE is 3.

The CSMA/CA procedure starts with BE  = macMinBE

Back_off_duration = (rand((2^3)- 1)) * aUnitBackoffPeriod * symbol_time 

Assume rand(7) returns 7 in which case

Back_off_duration = 7 * 20 * 20 = 2800 micros  = 2.8 milli-secs.

If the  rand(7) returns 0 in which case   “Back_off_duration = 0  microsecs

If BE is set to macMaxBE (5), then

Back_off_duration = (rand((2^5)- 1)) * aUnitBackoffPeriod * symbol_time 

Assume rand(31) returns 31 in which case

Back_off_duration = 31 * 20 * 20 = 12400 micros  = 12.4 milli-secs.


If macMaxBE is set to 8 – 

If BE is set to macMaxBE (8), then

Back_off_duration = (rand( (2^8) – 1)) * aUnitBackoffPeriod * symbol_time 

Assume rand(255) returns 255 in which case

Back_off_duration = 255 * 20 * 20 = 102000 micros  = 102 milli-secs.