Mastering IOT
上QQ阅读APP看书,第一时间看更新

IEEE 802.15.4 architecture

The IEEE 802.15.4 protocol operates in the unlicensed spectrum in three different radio frequency bands: 868 MHz, 915 MHz, and 2400 MHz. The intent is to have as wide a geographical footprint as possible, which implies three different bands and multiple modulation techniques. While the lower frequencies allow 802.15 to have fewer issues with RF interference or range, the 2.4 GHz band is by far the most often used 802.15.4 band worldwide. The higher frequency band has gained its popularity because the higher speed allows for shorter duty cycles on transmitting and receiving, thus conserving power.

The other factor that has made the 2.4 GHz band popular is its acceptance in the market due to the popularity of Bluetooth. The table blow lists various modulation techniques, geographical area, and data rates for various 802.15.4 bands.

 

The typical range of an 802.15.4-based protocol is roughly 200 meters in an open-air, line-of-sight test. Indoors, the typical range is roughly 30 m. Higher power transceivers (15 dBm) or mesh networkinmg can be used to extend the range. The following graphiuc shows the three bands used by 802.15.4 and the frequency distribution. 

IEEE 802.15.4 bands and frequency allocations. 915 MHz band uses a 2MHz frequency separation and the 2.4GHz band uses a 5 MHz frequency separation.

To manage a shared frequency space, 802.15.4 and most other wireless protocols use some form of Carrier Sense Multiple Access Collision Avoidance (CSMA/CA). Since it is impossible to listen to a channel while transmitting on the same channel, collision detection schemes don't work; therefore, we use collision avoidance. CSMA/CA simply listens to a specific channel for a predetermined amount of time. If the channel is sensed "idle", then it transmits by first sending a signal telling all other transmitters the channel is busy. If the channel is busy, then the transmission is deferred for a random period of time. In a closed environment, CSMA/CA will provide 36 percent channel usage; however, in real-world scenarios, only 18 percent of the channels will be usable. 

The IEEE 802.15.4 group defines the operational transmit power to be capable of at least 3 dBm and the receiver sensitivity to be -85 dBm at 2.4 GHz and -91 dBm at 868/915 MHz. Typically, this implies a 15 mA to 30 mA current for transmission and a 18mA to 37mA current for the reception. 

The data rate as state peaks at 250 kbps, as stated using the offset quadrature phase shift key. 

The protocol stack only consists of the bottom two layers of the OSI model (PHY and MAC). The PHY is responsible for symbol encoding, bit modulation, bit demodulation, and packet synchronization. It also performs transmit-receiving mode switching and intra-packet timing/acknowledgment delay control. Shown below is the 802.15.4 protocol stack as a comparison to the OSI model. 

IEEE 802.15.4 Protocol Stack. Only PHY and MAC layers are defined, other standards and organizations are free to incorporate layers 3 to 7 above the PHY and MAC.

On top of the physical layer is the data link layer responsible for detecting and correcting errors on the physical link. This layer also controls the media access layer (MAC) to handle collision avoidance using protocols such as CSMA/CA. The MAC layer is typically implemented in software and runs on an MCU such as the popular ARM Cortex M3 or even an 8-bit ATmega core. There are a few silicon vendors that have incorporated the MAC in pure silicon, such as Microchip Technology Inc. 

The interface from the MAC to the upper layers of the stack are provided through two interfaces called the Service Access Points (SAP):

  • MAC-SAP: For data management
  • MLME-SAP: For control and monitoring (MAC layer management entity)

There are two types of communication in IEEE 802.15.4: beacon and beaconless communication.

For a beacon-based network, the MAC layer can generate beacons that allow a device to enter a PAN as well as provide timing events for a device to enter a channel to communicate. The beacon is also used for battery-based devices that are normally sleeping. The device wakes on a periodic timer and listens for a beacon from its neighbors. If a beacon is heard, it begins a phase called a SuperFrame Interval where time slots are pre-allocated to guarantee bandwidth to devices, and devices can call for a neighbor node attention. The SuperFrame Interval (SO) and Beacon Interval (BO) are fully controllable by the PAN coordinator. The SuperFrame is divided into sixteen equally sized time slots with one dedicated as the beacon of that SuperFrame. Slotted CSMA/CA channel access is used in beacon-based networks. 

The guaranteed time slots (GTS) can be assigned to specific devices preventing any form of contention. Up to seven GTS domains are allowed. The GTS slots are allocated by the PAN coordinator and announced in the beacon it broadcasts. The PAN coordinator can change the GTS allocations on the fly dynamically based on system load, requirements, and capacity. The GTS direction (transmit or receive) is predetermined before the GTS starts. A device may request one transmit and/or one receive GTS.

The SuperFrame has contention access periods (CAP) where there is crosstalk on the channel and contention free periods (CFP) where the frame can be used for transmission and GTS. The following figure illustrates a superframe consisting of 16 equal time slots bounded by beacon signals (one of which must be a beacon). Contention Free Period will be further divided into Guaranteed Time Slots (GTS) and one or more GTSW may be allocated to a particular device. No other device may use that channel during a GTS

IEEE 802.15.4 SuperFrame Sequence. 

In addition to beacon-based networking, IEEE 802.15.4 allows for beacon-less networking. This is a much simpler scheme where no beacon frame is transmitted by the PAN coordinator. It implies, however, that all nodes are in a receiving mode all the time. This provides full-time contention access through the use of unslotted CSMA/CA. A transmitting node will perform a clear channel assessment (CCA) in which it listens to the channel to detect if it's used and then transmit if clear. CCA is part of a CSMA/CA algorithm and is used to "sense" if a channel is used. A device can receive access to a channel if it is clear of other traffic from other devices (including non-802.15.4 devices). In the event a channel is busy, the algorithm enters a "back-off" algorithm and waits a random amount of time to retry the CCA. The IEEE 802.15.4 group specifies the following for CCA usage:

  • CCA mode 1: Energy above threshold (lowest). The CCA will report a busy medium on detecting any energy greater than a threshold value (ED).
  • CCA mode 2: Carrier sense only (medium - default). This mode causes CCA to report a busy medium only if a direct-sequence spread spectrum (DSSS) signal is detected. The signal may be above or below the ED threshold.
  • CCA mode 3: Carrier sense with energy above threshold (strongest). In this mode, the CCA reports busy if it detects a DSSS signal with an energy above the ED threshold.
  • CCA mode 4: This mode is a carrier sense detection mode with a timer. The CCA starts a timer of some number of milliseconds and will report busy only if it detects a high-rate PHY signal. CCA will report the medium is idle if the timer expires and no high-rate signal is observed. 
  • CCA Mode 5: This is a combination of carrier sense and energy above a threshold mode. 

To note regarding CCA modes:

  • Energy detection will be at most 10 dB above specified receiver sensitivity
  • CCA detection time will equal eight symbol periods
  • It should be noted that CCA modes that are based on energy detection consume the least amount of energy for the device. 

This mode will consume much more power than beacon-based communication.