The MAC and PHY layers
Most network protocols use the concept of layers to separate different components and functions into independent modules that developers can assemble in different ways.
The PHY layer defines the physical and electrical characteristics of the network. It is responsible for managing the hardware that modulates and demodulates the RF bits.
The MAC layer is responsible for sending and receiving RF frames. As part of each packet, there is a MAC layer data header that has addressing information as well as packet options. This layer implements packet acknowledgments (ACKs), packet tracking to eliminate duplicates, and so forth.
- When a device is transmitting, it cannot receive packets.
- When a device is not sleeping, it is either receiving or transmitting.
- There are no beacons or master/slave requirements in the design of the MAC/PHY.
The XBee/XBee-PRO SX RF Module uses a patented method for scanning and finding a transmission. When a device transmits, it sends out a repeated preamble pattern, a MAC header, optionally a network header, followed by packet data. A receiving device is able to scan all the channels to find a transmission during the preamble, then once it has locked into that channel it attempts to receive the whole packet.
The following table shows the AT commands related to the MAC/PHY layers.
AT command | Function |
---|---|
CM |
The Channel Mask is a user-defined list of channels that the device operates on. For additional information, see CM (Channel Mask). |
HP |
Change HP (Preamble ID) to make it so a group of devices will not interfere with another group of devices in the same vicinity. The advantage of changing this parameter is that a receiving device will not lock into a transmission of a transmitting device that does not have the same Preamble ID. |
ID |
Change ID (Network ID) to further keep devices from interfering with each other. The device matches this ID after it matches the preamble pattern and after it receives the MAC header. A unique network identifier distinguishes each network. For devices to communicate, they must be configured with the same network identifier. The ID parameter allows multiple networks to co-exist on the same physical channel. |
PL |
Sets the transmit (TX) power level. You can reduce the power level from the maximum to reduce current consumption or for testing. This comes at the expense of reduced radio range. |
RR |
Specifies the number of times a sending device attempts to get an ACK from a destination device when it sends a unicast packet. |
MT |
Specifies the number of times that a device repeatedly transmits a broadcast packet. This adds redundancy, which improves reliability. |