PreviousNext
checkRF
Help > OS functions > RF > checkRF

Function

 

     Check currently incoming RF signal strength and preamble quality

     Specify the level of RSSI for subsequent receipts in LP and XLP modes

Purpose

 

     Incoming RF signal strength and quality detection

     Set filter level for incoming LP and XLP packets

Syntax

 

bit checkRF(uns8 level)

Parameters

 

level = RSSI_FILTER (0 to 64)

Values > 64 are not intended for signal filtration, but for special purposes. See getRSSI Preconditions for example.

Input values

 

bit _checkRFcfg_PQT     Preamble quality check enable in STD RX

     0: RF carrier strength is checked (Default)

     1: RF carrier strength and preamble quality are checked

This bit applies in STD RX mode only. In LP or XLP RX modes the preamble quality is always checked.

Return value

 

     1: If _checkRFcfg_PQT = 0 in STD RX mode: Signal with specified level or higher detected

                                   (RSSI >= RSSI_FILTER)

If _checkRFcfg_PQT = 1 or in LP or XLP RX mode:

Signal with specified level or higher detected (RSSI >= RSSI_FILTER) and correct format of packet preamble is detected

     0: Otherwise

Output values

 

     Filter for all subsequent incoming LP and XLP packets is set to specified method and level

     After checkRF finishing, RF IC stays always in RF Ready mode.

Preconditions

 

In LP and XLP RX modes, checkRF should be used only once whenever a change of filter level is needed. It should not be used repeatedly in the RX loop.

Remarks

 

     Higher filtration brings higher immunity against noise and interferences but allows a lower range. See TR datasheet, table Relative RF range vs. checkRF(level).

     checkRF(5) is recommended for immunity against weak noise.

     Checking takes about 1 ms (when _checkRFcfg_PQT=0) or 2.8 ms (when _checkRFcfgPQT=1).

     If _checkRFcfgPQT=1 and a packet transmitted in LP or XLP TX mode should be received in STD RX mode, toutRF ≥ 5 or 100, respectively, must be set.

     Unlike getRSSI and RFRXpacket, checkRF does not update the lastRSSI register.

     For reading out the RSSI value the getRSSI function is intended. See getRSSI Example.

Side effects

 

  –

See also

 

RFRXpacket, getRSSI

Example 1

 

              // Fast response receiving in STD mode

_checkRFcfg_PQT = 1;  // Check RF signal for preamble quality as well

if (checkRF(5))       // Detect signal with RSSI >= selected level

{

  if (RFRXpacket())   // Duration according to toutRF only if packet is sent.

  {                   // toutRF can be optimized for expected packet length.

    ...     

  }

}               // Otherwise only ~2.8 ms (or 1 ms if _checkRFcfg_PQT = 0) is spent.

... time-critical section can be placed here

Example 2

 

if (checkRF(10))    // Detect signal with RSSI >= selected level

   ...

Example 3

 

              // LP TX packet received in STD RX

_checkRFcfg_PQT = 1;       // Check RF signal for preamble quality as well

setRFmode(_RX_STD | _WPE); // Standard RX

toutRF = 5;                 // 5 or more is required, see Remarks

                            // Change 5 to 100 if XLP packet is expected

if (checkRF(5))             // Detect signal with RSSI >= selected level

{

  if (RFRXpacket())         // Duration according to toutRF only if packet is sent.

    ...     

 

Example 4

 

              // RF signal strength analyzer

while (1)
  if (checkRF(5)) pulseLEDR(); // LED flash if RSSI >= selected level detected