rfEasyLinkEchoTx Example

Example Summary

This example demonstrates the use of the EasyLink API in doing bi-directional communication. It will require the use of two boards, one running the rfEasyLinkEchoTx project that will originate the packets, while another board running the rfEasyLinkEchoRx project will re-transmit (echo) them back to the originator.

For more information on the EasyLink API and usage refer to https://processors.wiki.ti.com/index.php/SimpleLink-EasyLink

Peripherals Exercised

For the rfEasyLinkEchoTx (Board_1) project,

For the rfEasyLinkEchoRx (Board_2) project,

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 user will require two launchpads, one running rfEasyLinkEchoTx (Board_1), another running rfEasyLinkEchoRx (Board_2). Run Board_2 first, followed by Board_1. Board_1 is set to transmit a packet every second while Board_2 is set to receive the packet and then turnaround and transmit it after a delay of 100ms. Board_PIN_LED1 on Board_1 will toggle when it’s able to successfully transmits a packet, and when it receives its echo. Board_PIN_LED2 on Board_2 will toggle when it receives a packet, and then when its able to re-transmit it (see figure 1).

perfect_echo_ref

If the receiver (Board_2) is turned off and the rfEchoTx (Board_1) begins transmitting, Board_1 switches over to the receiver mode waiting for an echo that will never come; in this situation a timeout timer is started and if no packet is received within 300ms the receiver operation is aborted. This condition is indicated by Board_PIN_LED1 being cleared and Board_PIN_LED2 being set (see figure 2).

missed_first_ref

If the receiver continues to stay turned off then the rfEchoTx example will alternate between transmitting and aborted receiver operations. Board_PIN_LED1 and Board_PIN_LED2 will start alternating, as seen in figure 3.

missed_first_few_ref

An error in transmission of a packet, or the reception of its echo, is indicated by both LEDs going high on Board_1, while an error on Board_2 will cause it to set Board_PIN_LED1 high and Board_PIN_LED2 low (see figure 4).

echo_error_ref.

Application Design Details

This example shows how to use the EasyLink API to access the RF driver, set the frequency and transmit packets. The RFEASYLINKTX_ASYNC define is used to select between the Blocking or Async TX/RX API.

The rfEasyLinkEchoTx example will transmit a packet every second while the rfEasyLinkEchoRx will echo all received packets after a delay of 100ms. If Board_1 aborts a packet reception Board_PIN_LED2 is set while Board_PIN_LED1 is cleared. An error condition on Board_1 is indicated by both LEDs going high. An error condition on Board_2 is indicated by Board_LED_1 going high while Board_LED_2 is cleared.

A single task, “rfEasyLinkEchoFnx”, configures the RF driver through the EasyLink API and transmits and receives messages.

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()       | Nonblocking 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.