Radio channels

The XBee 3 802.15.4 module works on the 2.4 GHz band, and there are 12 channels available. The values are between 0x0C-0x17 (12 values).

Due to the frequency band used is a free band, a channel may be jammed by other network transmissions. To avoid that jamming, it is recommended to scan all the channels to choose the channel with less energy.

Scan channels

List of channels to scan for all Active and Energy Scans as a bitfield:

bit 0: 0x0B bit 4: 0x0F bit 8: 0x13 bit 12: 0x17

bit 1: 0x0C bit 5: 0x10 bit 9: 0x14 bit 13: 0x18

bit 2: 0x0D bit 6: 0x11 bit 10: 0x15 bit 14: 0x19

bit 3: 0x0E bit 7: 0x12 bit 11: 0x16 bit 15: 0x1A

Setting this parameter to 0xFFFF will cause all the channels to be scanned.

The API functions store the list in a related array called scanChannels.

Example of use:

{
xbee802.setScanningChannels(0xFF,0xFF); // Sets all channels to scan
xbee802.getScanningChannels(); // Gets scanned channel list
}

Related variables:

xbee802.scanChannels[0-1] // stores the list of channels to scan

Energy scan

The maximum energy on each channel is returned, starting with the first channel selected in the Scan Channels parameter. The amount of time this energy scan is performed is specified as an API function input. This time is calculated in this way (2\^ED)*15.36 ms.

The recommended process for choosing a free channel is:

1. Change the list of channels to scan all the channels.

2. Perform an energy scan channel on those channels.

3. A channel is chosen among the scanned channels, selecting the channel with minimum energy.

Example of use:

{
xbee802.setDurationEnergyChannels(3); // Performs the energy scan
}

Related variables:

xbee802.energyChannel[0-15] // stores the energy found on each scanned channel

Energy scan example: https://development.libelium.com/802-07-energy-scan/

The amount of time specified to scan each channel may affect the detected energy. In our tests, selecting the minimum value was not sufficient to detect the energy, so it is recommended to select a higher value.

After testing, a usual energy value for a free channel is around -84 dBm and -37 dBm for an occupied one. When the energy scan is performed, these values may be used to determine whether a channel is occupied or not.

This protocol provides some parameters to diagnose the current state of the network. 802.15.4 uses CSMA-CA to avoid various nodes start transmitting at the same time. The process is described next:

1. A random delay is waited for. This time is specified by a back-off algorithm.

2. Performs a Clear Channel Assessment.

3. If the detected energy is above the CCA threshold, steps 1-3 will be repeated up to 4 times. If the detected energy is under the CCA threshold, the packet is transmitted.

4. Broadcast transmissions has already finished because ACKs are not sent. Unicast transmissions wait for ACK. If ACK is not received, steps 1-4 will be repeated up to 3 times.

Random delay

It specifies the minimum value at which the back-off algorithm starts. First time this algorithm is executed, it waits a random delay: (2\^BE-1)*0.32 ms. BE is the back-off algorithm exponent and it starts at the value 'Random Delay'. In the same attempting of sending a packet, the exponent is increased in one.

Example of use:

{
xbee802.setDelaySlots(1); // Sets the exponent to start
xbee802.getDelaySlots(); // Gets the exponent to start
}

Related variables:

xbee802.delaySlots // stores the exponent

CCA threshold

Clear Channel Assessment Threshold. Prior to transmitting a packet, a CCA is performed to detect energy on the channel. If the detected energy is above the CCA Threshold, the module will not transmit the packet. By default, this value is -44 dBm. In our tests, an occupied channel with some nodes transmitting has around -37 dBm, so it is a tighten value.

Example of use:

{
xbee802.setEnergyThreshold(0x2C); // Sets the threshold
xbee802.getEnergyThreshold (); // Gets the threshold
}

Related variables:

xbee802.energyThreshold // stores the energy threshold

CCA failures

Counter of Clear Channel Assessment in CSMA-CA process. It specifies the number of times a packet has been discarded due to the energy on the channel was above the CCA Threshold.

Example of use:

{
xbee802.getCCAcounter(); // Gets the CCA counter
xbee802.resetCCAcounter(); // Resets the CCA counter
}

Related variables:

xbee802.counterCCA[0-1] // stores the CCA counter

ACK failures

Counter of acknowledgment failures. It specifies the number of times a packet has been sent and its ACK has not been received.

Example of use:

{
xbee802.getACKcounter(); // Get the ACK counter
xbee802.resetACKcounter(); // Reset the ACK counter
}

Related variables:

xbee802.counterACK[0-1] // stores the ACK counter

Retries

Maximum number of retries the module will execute in addition to the 3 retries specified by 802.15.4 protocol. For each XBee retry, the 802.15.4 can execute up to 3 retries. If the transmitting module does not receive an ACK after 200 ms, it will re-send the packet up to 3 times. This is an upper-MAC level, so the CSMA-CA process explained before is executed each retry.

Example of use:

{
xbee802.setRetries(2); // Set the additional retries
xbee802.getRetries(); // Get the additional retries
}

Related variables:

xbee802.retries[0-1] // stores the retries

Using these parameters, a bad behaviour of a channel could be detected, and the process to choose a new channel should be executed.

Last updated