RAIL_CsmaConfig_t Struct Reference

A configuration structure for the CSMA transmit algorithm.

#include <rail_types.h>

Data Fields

uint8_t csmaMinBoExp
 The minimum (starting) exponent for CSMA random backoff (2^exp - 1).
 
uint8_t csmaMaxBoExp
 The maximum exponent for CSMA random backoff (2^exp - 1).
 
uint8_t csmaTries
 The number of backoff-then-CCA iterations that can fail before reporting RAIL_EVENT_TX_CHANNEL_BUSY.
 
int8_t ccaThreshold
 The CCA RSSI threshold, in dBm, above which the channel is considered 'busy'.
 
uint16_t ccaBackoff
 The backoff unit period in RAIL's microsecond time base.
 
uint16_t ccaDuration
 The minimum desired CCA check duration in microseconds.
 
RAIL_Time_t csmaTimeout
 An overall timeout, in RAIL's microsecond time base, for the operation.

A configuration structure for the CSMA transmit algorithm.

One of RAIL's schemes for polite spectrum access is an implementation of a Carrier-Sense Multiple Access (CSMA) algorithm based on IEEE 802.15.4 (unslotted).
In pseudo-code it works like this, showing relevant event notifications:

RAIL_Event_t performCsma(const RAIL_CsmaConfig_t *csmaConfig)
{
bool isFixedBackoff = ((csmaConfig->csmaMinBoExp == 0)
&& (csmaConfig->csmaMinBoExp == 0));
int backoffExp = csmaConfig->csmaMinBoExp; // Initial backoff exponent
int backoffMultiplier = 1; // Assume fixed backoff
int try;
// Start overall timeout if specified:
if (csmaConfig->csmaTimeout > 0) {
StartAbortTimer(csmaConfig->csmaTimeout, RAIL_EVENT_TX_CHANNEL_BUSY);
// If timeout occurs, abort and signal the indicated event.
}
for (try = 0; try < csmaConfig->csmaTries; try++) {
if (try > 0) {
}
// Determine the backoff multipler for this try:
if (isFixedBackoff) {
// backoffMultiplier already set to 1 for fixed backoff
} else {
// Start with the backoff exponent for this try:
if (try > 0) {
backoffExp++;
if (backoffExp > csmaConfig->csmaMaxBoExp) {
backoffExp = csmaConfig->csmaMaxBoExp;
}
}
// Pick random multiplier between 0 and 2^backoffExp - 1 inclusive:
backoffMultiplier = pickRandomInteger(0, (1 << backoffExp) - 1);
}
// Perform the backoff:
delayMicroseconds(backoffMultiplier * csmaConfig->ccaBackoff);
// Perform the Clear-Channel Assessment (CCA):
// Channel is considered busy if radio is actively receiving or
// transmitting, or the average energy detected across duration
// is above the threshold.
if (performCca(csmaConfig->ccaDuration, csmaConfig->ccaThreshold)) {
// CCA (and CSMA) success: Transmit after Rx-to-Tx turnaround
StopAbortTimer();
} else {
// CCA failed: loop to try again, or exit if out of tries
}
}
// Overall CSMA failure: Don't transmit
StopAbortTimer();
}

Definition at line 1817 of file rail_types.h.

Field Documentation

uint16_t RAIL_CsmaConfig_t::ccaBackoff

The backoff unit period in RAIL's microsecond time base.

It is multiplied by the random backoff exponential controlled by csmaMinBoExp and csmaMaxBoExp to determine the overall backoff period. For random backoffs, any value above 511 microseconds will be truncated. For fixed backoffs it can go up to 65535 microseconds.

Definition at line 1849 of file rail_types.h.

uint16_t RAIL_CsmaConfig_t::ccaDuration

The minimum desired CCA check duration in microseconds.

Note
Depending on the radio configuration, due to hardware constraints, the actual duration may be longer.

Definition at line 1856 of file rail_types.h.

uint8_t RAIL_CsmaConfig_t::csmaMaxBoExp

The maximum exponent for CSMA random backoff (2^exp - 1).

It can range from 0 to RAIL_MAX_CSMA_EXPONENT and must be greater than or equal to csmaMinBoExp.
If both exponents are 0, a non-random fixed backoff of ccaBackoff duration results.

Definition at line 1830 of file rail_types.h.

uint8_t RAIL_CsmaConfig_t::csmaMinBoExp

The minimum (starting) exponent for CSMA random backoff (2^exp - 1).

It can range from 0 to RAIL_MAX_CSMA_EXPONENT.

Definition at line 1822 of file rail_types.h.

RAIL_Time_t RAIL_CsmaConfig_t::csmaTimeout

An overall timeout, in RAIL's microsecond time base, for the operation.

If the transmission doesn't start before this timeout expires, the transmission will fail with RAIL_EVENT_TX_CHANNEL_BUSY. A value 0 means no timeout is imposed.

Definition at line 1863 of file rail_types.h.

uint8_t RAIL_CsmaConfig_t::csmaTries

The number of backoff-then-CCA iterations that can fail before reporting RAIL_EVENT_TX_CHANNEL_BUSY.

It can range from 1 to RAIL_MAX_LBT_TRIES; other values are disallowed.

Definition at line 1836 of file rail_types.h.


The documentation for this struct was generated from the following file:
  • common/rail_types.h