# rfEasyLinkListenBeforeTalk

SysConfig Notice

All examples will soon be supported by SysConfig, a tool that will help you graphically configure your software components. A preview is available today in the examples/syscfg_preview directory. Starting in 3Q 2019, with SDK version 3.30, only SysConfig-enabled versions of examples will be provided. For more information, click here.


Project Setup using the System Configuration Tool (SysConfig)

The purpose of SysConfig is to provide an easy to use interface for configuring drivers, RF stacks, and more. The .syscfg file provided with each example project has been configured and tested for that project. Changes to the .syscfg file may alter the behavior of the example away from default. Some parameters configured in SysConfig may require the use of specific APIs or additional modifications in the application source code. More information can be found in SysConfig by hovering over a configurable and clicking the question mark (?) next to it's name.

EasyLink Stack Configuration

Many parameters of the EasyLink stack can be configured using SysConfig including RX, TX, Radio, and Advanced settings. More information can be found in SysConfig by hovering over a configurable and clicking the question mark (?) next to it's name. Alternatively, refer to the System Configuration Tool (SysConfig) section of the Proprietary RF User's guide found in <SDK_INSTALL_DIR>/docs/proprietary-rf/proprietary-rf-users-guide.html.

Example Summary

This example includes the EasyLink API and uses it to configure the RF driver to assess the communication channel before transmitting any packets, i.e. Listen Before Talk (LBT); the radio will first enter RX mode to assess the channel, if it is idle (RSSI below a set threshold) for 5ms it proceeds to transmit a packet. If the channel is busy (RSSI above the set threshold), at any point in the channel sense window, the radio will back off for a random period before assessing the channel again; it will do this a certain number of times before failing altogether.

This project can be run in conjunction with the rfEasyLinkRx project; a third board, managed by SmartRF Studio, emitting a continuous carrier wave may be used as a jammer to simulate high load networks.

For more information on the EasyLink API and usage refer to the Proprietary RF User's guide

Peripherals Exercised

Resources & Jumper Settings

If you're using an IDE (such as CCS or IAR), please refer to Board.html in your project directory for resources used and board-specific jumper settings. Otherwise, you can find Board.html in the directory <SDK_INSTALL_DIR>/source/ti/boards/<BOARD>.

Example Usage

The example code can be tested with a receiver managed by SmartRF Studio, or one board running the rfEasyLinkRx example as the receiver, and another board connected to SmartRF Studio, acting as a jammer at 868.0 MHz (433.92 MHz for the CC1350-LAUNCHXL-433 board).

The transmitter will attempt to transmit a packet every 100 ms. Board_PIN_LED1 will toggle each time a packet is successfully transmitted. Board_PIN_LED2 will toggle if the Clear Channel Assessment (CCA) fails and the packet is not transmitted. If the macro RFEASYLINKLBT_RETRANSMIT_PACKETS is set to 1 the application will attempt to retransmit any failed packets indefinitely; if set to 0 it will skip the failed packet and move on to the next packet in sequence. This cycle will continue.

Before running this application you should first start the rfEasyLinkRx on a second board to see that the transmitted packets are received.

Application Design Details

This example shows how to use the EasyLink API to access the RF driver, set the frequency, assess the channel and transmit packets. The TX API used is asynchronous (non-blocking).

The rfEasyLinkListenBeforeTalk example will transmit a packet every 100 ms if the channel is idle. The TX API used will run a Clear Channel Assessment (CCA) algorithm to determine if the channel is idle for a specified time window (EASYLINK_CHANNEL_IDLE_TIME_US); it does this by comparing the channel RSSI against a set threshold, if it is lower than the threshold the channel is considered to be idle, else it is busy. If the channel is busy, at any point in the channel sense window, the radio will back off for a certain time period before reassessing the channel, it does this a certain number of times before giving up and declaring a "channel busy" failure. Board_PIN_LED2 will indicate when this condition occurs. For every successful transmission Board_PIN_LED1 will be toggled. An error has occurred if both Board_PIN_LED1 and Board_PIN_LED2 are toggled.

A single task, "rfEasyLinkLbtFnx", configures the RF driver through the EasyLink API and transmits messages.

EasyLink API

Overview

The EasyLink API should be used in application code. The EasyLink API is intended to abstract the RF Driver in order to give a simple API for customers to use as is or extend to suit their application[Use Cases] (@ref USE_CASES).

General Behavior

Before using the EasyLink API:

The following is true for receive operation:

The following apply for transmit operation:

Error Handling

The EasyLink API will return EasyLink_Status containing success or error code. The EasyLink_Status codes are:

Power Management

The power management framework will try to put the device into the most power efficient mode whenever possible. Please see the technical reference manual for further details on each power mode.

The EasyLink Layer uses the power management offered by the RF driver Refer to the RF Driver documentation for more details.

Supported Functions

| Generic API function          | Description                                        |
|-------------------------------|----------------------------------------------------|
| EasyLink_init()               | Init's and opens the RF driver and configures the  |
|                               | specified settings based on EasyLink_Params struct |
| EasyLink_transmit()           | Blocking Transmit                                  |
| EasyLink_transmitAsync()      | Non-blocking Transmit                              |
| EasyLink_transmitCcaAsync()   | Non-blocking Transmit with Clear Channel Assessment|
| EasyLink_receive()            | Blocking Receive                                   |
| EasyLink_receiveAsync()       | Non-blocking Receive                                |
| EasyLink_abort()              | Aborts a non blocking call                         |
| EasyLink_enableRxAddrFilter() | Enables/Disables RX filtering on the Addr          |
| EasyLink_getIeeeAddr()        | Gets the IEEE Address                              |
| EasyLink_setFrequency()       | Sets the frequency                                 |
| EasyLink_getFrequency()       | Gets the frequency                                 |
| EasyLink_setRfPower()         | Sets the Tx Power                                  |
| EasyLink_getRfPower()         | Gets the Tx Power                                  |
| EasyLink_getRssi()            | Gets the RSSI                                      |
| EasyLink_getAbsTime()         | Gets the absolute time in RAT ticks                |
| EasyLink_setCtrl()            | Set RF parameters, test modes or EasyLink options  |
| EasyLink_getCtrl()            | Get RF parameters or EasyLink options              |
| EasyLink_getIeeeAddr()        | Gets the IEEE address                              |

Frame Structure

The EasyLink implements a basic header for transmitting and receiving data. This header supports addressing for a star or point-to-point network with acknowledgements.

Packet structure:

 _________________________________________________________
|           |                   |                         |
| 1B Length | 1-64b Dst Address |         Payload         |
|___________|___________________|_________________________|

Note for IAR users: When using the CC1310DK, the TI XDS110v3 USB Emulator must be selected. For the CC1310_LAUNCHXL, select TI XDS110 Emulator. In both cases, select the cJTAG interface.