Basic RX and TX - Getting started with the RF driver for CC13xx/CC26xx devices#

Introduction#

The purpose of this exercise is to familiarize the users with the RF driver, Code Composer Studio and SmartRF™ Studio 7, by importing and modifying existing RX & TX example applications.

Task 1: Send and receive packets with SmartRF Studio 7.

Task 2: Import and run an existing TX example with Code Composer Studio.

Task 3: Export RF settings from SmartRF Studio 7 to Code Composer Studio example application.

Task 4: Send data from firmware, receive it using SmartRF Studio 7.

Task 5: Import and modify an existing RX example with Code Composer Studio.

Task 6: Send data from SmartRF Studio 7 and receive it with the firmware.

Task 7: Test two LaunchPads with the flashed TX and RX firmware.

Note

Technical support

For any questions you may have, please have a look at the relevant E2E forums: TI Sub-1 GHz E2E Forum, TI 2.4 GHz Proprietary E2E Forum.

Prerequisites#

Background#

  • Basic RTOS and CCS knowledge.

  • Some basic familiarity with embedded programming.

Software#

In order to start with this exercise you will need to download the correct Software Development Kit (SDK) and Tools.

For CC13xx/CC26xx:

Hardware#

  • 2 x CC13xx LaunchPads OR 2 x CC26xx LaunchPads

Choose from the following:

In case you need to use LaunchPads from different CC13xx/CC26xx families, make sure the correct projects are downloaded to the devices.

Warning

This lab can be performed using a variety of LaunchPads. For simplicity, only one LaunchPad variation is showcased in the following training material.

Group training additional requirements#

Make sure to always use your designated frequency, to avoid interfering with other students’ operations.

Warning

Frequency Allocation

If you are part of a group training, please ask the instructor for a unique frequency to use during this lab.

For simplicity, it is possible to use a base frequency (e.g. 2440.0, 915.0, 868.0, or 433.0 MHz), allocate a running number to each of the students and have each student multiply their number by 100 kHz channel spacing. For example, student #5 would then use 868 + 0.1*5 = 868.5 MHz.

Documentation and SmartRF Studio 7#

This lab introduces SmartRF Studio 7 and explains the basic usage of the RF driver.

Documentation#

The main documentation related to the RF core is in the Technical Reference Manual. It contains detailed information about the CC13xx and CC26xx devices as well as how to use the peripheral units. The “Radio” chapter focuses on the radio core, and we recommend to read it before doing the training.

SmartRF Studio 7#

SmartRF Studio 7 is used to test and evaluate RF settings on the CC13xx and CC26xx devices. It can also send and receive packets when connected to a device. SmartRF Studio 7 uses radio operation commands as described in the Radio section of the Technical Reference Manual.

For example, if we send one single packet in SmartRF studio (don’t worry, you’ll learn how to do this later) then the content of the Command View will look like the image below:

../../../_images/intro_tx_command_view.png

Resource Explorer#

In the bottom part of this picture we can see exactly which commands were sent. In the top view we can explore the content of those commands.

Please note that the content of the command in the top view correlate exactly to that of the documentation. If you click on a specific field, then even the bit fields are shown and easy to edit.

Code Export#

In order to use a specific RF configuration in an application, the settings must be exported as command structures in C code. This is done via the Code Export button in SmartRF Studio 7.

../../../_images/intro_tx_command_export.png

Resource Explorer#

Using SysConfig#

SysConfig allows you to directly generate the radio settings (we will discuss this later in this lab). The radio settings are directly written in ti_radio_config.h/.c. As a consequence there is no point to use SmartRF Studio 7 to do so.

Warning

Do not edit the configuration files. As the config files are generated at each build by SysConfig it is useless to modify the content of those files (your modification will be overwritten at each build). If you need to modify the files generated by SysConfig (to use the configuration files provided by SmartRF Studio 7 for example), please follow the procedure described in the Proprietary RF User’s Guide in the SysConfig chapter.

Summary#

  • The Technical Reference Manual describes radio operation commands.

  • SysConfig allows to directly generate the radio operation commands. SmartRF Studio can be used to configure, test and export the radio operation commands as C structs.

  • The application overwrites application-specific command fields and executes the commands using the RF driver.

RF Driver (rflib)#

The RF core is accessed exclusively via the RF driver. This driver provides functions to set up the RF core and to execute various radio commands which are divided into three groups:

  • Immediate commands

  • Direct commands

  • Radio operation commands

Immediate and direct commands execute immediately and return a result upon completion. They are protocol-independent and often used to configure the RF core and to interact with running radio operation commands. Radio operation commands, in contrast, are more complex. They support various triggers and may also be chained together to create more sophisticated commands. In this tutorial, we will only use radio operation commands.

Note

API

The RF driver documentation is installed as part of the MCU SDK. To access it, please refer to your SDK installation folder. If you chose the default settings during the installation process, then the location would be similar to this:

<SDK folder>\docs\\docs\rflib\html\index.html

You can also access it online here.

For convenience, the RF Driver APIs are briefly listed here:

API function

Description

RF_open()

Open client connection to RF driver and return a command handle

RF_close()

Close client connection to RF driver

RF_postCmd()

Execute a radio operation command asynchronously or append it to the command queue if another command is already running

RF_scheduleCmd()

Schedules a radio operation into the command queue based on the given scheduling parameters. Only available as part of the “multi-mode” RF Driver.

RF_pendCmd()

Wait for previously posted command to complete

RF_runCmd()

Execute a radio operation command synchronously and wait for its completion

RF_cancelCmd()

Abort a currently running command

RF_flushCmd()

Abort a currently running command and clear the command queue

RF_runDirectCmd()

Execute a direct command synchronously

RF_runImmediateCmd()

Execute an immediate command synchronously

Task 0: Label your LaunchPads#

  • Label each of your LaunchPads with its XDS Device ID (or serial number). To find this, refer to this.

  • Additionally, label one LaunchPad as “RX” and the other as “TX”. These labels will be referred to throughout this lab. It is recommended to use a non-permanent marking for this (e.g. sticky notes), as these labels may only be relevant for this specific lab.

Task 1: SmartRF Studio 7 ↔ SmartRF Studio 7#

SmartRF Studio 7 can be used to test RF settings and to evaluate those settings by sending and receiving packets. This task will take you through the process of testing a complete TX / RX link by sending packets between two CC13xx (or CC26xx) LaunchPads using only SmartRF Studio 7. No additional software or firmware is needed.

Connecting SmartRF Studio 7#

  • Have both LaunchPads connected to the PC and powered on. Make sure that no other program, such as CCS or a serial port monitor, is currently accessing the LaunchPads.

Hint

Check this: The green LED of the LaunchPads’ XDS Emulator (the LED closer to the USB connector) should light up, to indicate that the boards are powered on.

  • Open SmartRF Studio 7

  • The devices should automatically show up in the device listing at the bottom. If not, click on the green arrow next to Refresh list. If everything works and both boards are detected then you will see two boards in the device listing.

../../../_images/task1_studio_detected_device.png

Resource Explorer#

  • Double-click on one of the devices in the device listing. A pop-up will open, asking you to select the operation mode:

../../../_images/task1_SmartRFStudio_mode_selection.png

Resource Explorer#

Select Proprietary mode, and this should open up the Device Control Panel.

../../../_images/task1_studio_control_panel_overview.png

Resource Explorer#

  • Navigate back to the SmartRF Studio main window and double click on the other device as well. The one that is already connected will say Device Control Panel Open, so double-click on the other one. Select Proprietary mode, if several modes are available (depends on the device).

Hint

Congratulations! You have successfully connected SmartRF Studio 7 to two different targets. You should see one main SmartRF Studio 7 window as well as two Device Control Panel windows.

Configuring RX and TX#

PHY Modes#

The RF modes which have been characterized by Texas Instruments can be seen in SmartRF Studio.

Packet format#

The RF core on the CC13xx and CC26xx provides a flexible packet engine which allows to:

  • Adjust length and content for both preamble and syncword

  • Use packets with fixed or variable length (through a length field)

  • Apply address filters to the packet (with the address field following the length byte)

  • Configure a CRC check

 

Preamble

Sync word

Length

Payload

CRC

Size

4 bytes

4 bytes

1 byte

N bytes

2 bytes

Content

0x55555555

0x930b51de

N (max 255)

Application specific

0xXXYY

SmartRF Studio inserts a 2 byte sequence number as the first two bytes of the payload. This is optional and is used to calculate the Packet Error Rate ( PER). The rest of the payload consists of either random or user-supplied data.

Apply the settings#

Next we will configure one SmartRF Studio 7 in RX and the other in TX.

  • Both instances of the Device Control Panel should be displaying the Packet TX tab. This tab is used to transmit packets using the selected setting.

Warning

Change Frequency

If in a group, before doing anything else, please change the frequency (in the RF Parameters section) to your allocated frequency. Do this in both instances of the Device Control Panel.

  • Find the Device Control Panel that is connected to the “RX” LaunchPad, switch it to the Packet RX tab and press the Start button. This will set up the device in RX mode.

Warning

Which board is it? To tell which LaunchPad is connected to which Device Control Panel, look at the window’s title - it should specify the XDS Device ID of the connected device.

  • Next, switch to the Device Control Panel that is connected to the “TX” LaunchPad. The Packet TX tab should already be selected. Press Start. This will cause the device to send 100 packets.

  • Switch back to the Device Control Panel that is in RX mode, and watch the packets coming in.

../../../_images/task1_studio_received_packets.png

Resource Explorer#

Hint

Observe the results. On the right side in the Packet RX tab you should see:

  • The average RSSI.

  • How many packets were received OK / Not OK.

  • The PER (Packet Error Rate) and BER (Bit Error Rate).

Task 2: Importing and running the rfPacketTx example#

In this task we will use Code Composer Studio to import, build, flash and run an existing CC13xx or CC26xx project.

The content of this lab is based on Code Composer Studio projects, but projects for IAR and GCC are also installed with the SDK.

Import an Existing Example Project#

Follow these steps to import an existing example, rfPacketTx, into a Code Composer Studio workspace. When selecting SDK, make sure to select the SDK that relates to the device that is used.

  • Select ProjectImport CCS Projects... to open the import dialog.

  • Browse to the path of the example as the search directory. Click Select Folder.

  • Select the example project, and click Finish to import the example application.

Hint

You have now imported the rfPacketTx example project. There should now be a new project in the Project Explorer called rfPacketTx:

../../../_images/task2_css_new_project_explorer.png

Resource Explorer#

Build and Run the Project#

The rfPacketTx example illustrates how to do simple packet transmission using the RF driver.

This example is meant to be used in cooperation either with the rfPacketRx example or with SmartRF Studio, as will be demonstrated in the following tasks. In the current task, we will verify its operation by watching the on-board LED.

Error

When trying to program or debug a connected target in Code Composer Studio, while the same target is opened in SmartRF Studio 7, CCS may occasionally crash. To prevent this, it is recommended to close SmartRF Studio 7 at this point (if it is open).

  • Connect the “TX” LaunchPad to the PC, if not already connected.

  • Update the target of the rfPacketTX project to associate it with the “TX” LaunchPad - as explained here.

  • In CCS, build and download the example: Make sure that the rfPacketTx project is selected in the project explorer, and then click “Debug” (shortcut F11):

../../../_images/task2_css_debug_bar.png

Resource Explorer#

Note

When you click “Debug”, the following operations are performed automatically:

  • Open the CCS Debug view

  • SysConfig generates the config files

  • Build the project if there has been any changes

  • Flash the target

  • Halt at the beginning of main()

  • To run the program, wait for the build and download process to finish, then press the Resume button in the debug toolbar or RunResume ( F8).

../../../_images/task2_css_debug_bar_resume.png

Resource Explorer#

  • Verify the program operation:

Hint

Watch the on-board LEDs. The green LED on the LaunchPad toggles when data is transmitted over the RF interface.

  • Stop the debug session by pressing the Terminate button in the CCS’ debug toolbar (or from the Run drop down menu). CCS will automatically return to the Edit view.

Task 3: Generating and using RF configuration using SysConfig or SmartRF Studio 7#

For the following tasks, instead of using the default packet configuration, we will generate our own packet configuration. We will increase the symbol rate from 50 kbps to 100 kbps, which will in turn require modification of other parameters too.

These modifications can be done using SmartRF Studio 7 (works for all the devices, require to export the new configuration from SmartRF Studio 7 and include it in the application) or using SysConfig.

Note

CC26xx LaunchPads operates on 2.4 GHz modulations, so will have higher symbol rates than CC13xx. Make adjustments to symbol rate accordingly.

Using SysConfig#

SysConfig can be used to tune the RF Stacks parameters. At build time, SysConfig automatically generates the content of the configuration files (ti_devices_config.c, ti_radio_config.h/.c and ti_drivers_config.h/.c).

By default, the rfPacketTx/Rx examples have the following configuration:

Description

Value

Address

aa-bb

Frequency

868.00000 MHz

Data Format

Serial mode disable

Deviation

25.000 kHz

Packet Length Config

Variable

Max Packet Length

128

Packet Length

30

RX Filter BW

98 kHz

Symbol Rate

50.00000 kBaud

Sync Word Length

32 Bits

TX Power

10 dBm

Whitening

No whitening

Follow the next steps to set the required configuration. Once done, don’t forget to save your changes, rebuild the project and download it on the device:

  • In CCS, in the corresponding project, open the *.syscfg file by double-clicking it (here the file is named rfPacketTx.syscfg).

../../../_images/task3_ccs_open_sysconfig.png

Resource Explorer#

  • SysConfig opens in the main window. Here we want to modify the RF Stacks settings (here we are using the Custom RF Stacks). So click on Custom, then open the Custom PHY Setting interface by clicking it.

../../../_images/task3_sysconfig_open_custom_phy_settings.png

Resource Explorer#

  • Now you can modify the PHY properties as follows:

    • Type in 100 in the Symbol Rate text box

    • Type 50 in the Deviation text box

    • Choose 195.9 from the RX Filter BW drop down list

    • Choose 14 from the TX Power drop down list

../../../_images/task3_sysconfig_modify_PHY_properties.png

Resource Explorer#

Note

Now you are ready to test your application. Remember to save your changes, rebuild the project and download the image on the device.

  • Build and run the program on the “TX” LaunchPad.

Hint

Does it work? Verify that the green LED toggles as expected.

Task 4 [optional]: Firmware TX → SmartRF Studio 7 RX#

In this task we will use SmartRF Studio 7 to receive packets sent from the rfPacketTx application.

Complete the next steps to configure SmartRF Studio 7 into RX mode, so that it can receive the packets sent by the rfPacketTX example.

  • Start up a SmartRF Studio 7 instance and connect to the “RX” LaunchPad.

  • Set up SmartRF Studio 7 with the same settings used for TX:

In the section Typical Settings, double-click on 50 kbps, 2-GFSK, 25 KHz deviation (or 100 kbps, 2-GFSK, 50 kHz deviation if using CC2640R2).

../../../_images/task3_studio_typical_settings.png

Resource Explorer#

This is to ensure that you start with the recommended settings closest to the ones we are implementing in this task.

In the RF Parameters section, type in 100 in the Symbol Rate text box, 50 in the Deviation text box and choose 195.9 kHz from the RX Filter BW drop down list. If using the CC2640R2 lauchpads the value of the RF Parameters should be: 200 Symbol rate, 50 kHz Deviation and 530 kHz RX Filter BW.

../../../_images/task3_studio_new_rf_parameters.png

Resource Explorer#

Warning

Change Frequency

If in a group, remember to change to your allocated frequency as described in the prerequisites section.

Warning

Don’t forget to set the frequency. If you changed your frequency in the previous section, remember to do it now too.

  • Go to the Packet RX tab and do the following:

  • Change the Expected packet count by checking the Infinite check-box

  • change Viewing format to Hexadecimal

  • Press the Start button.

Hint

What to expect

You should receive a message with the data generated by the rfPacketTx program every time the green LED toggles on the transmitting LaunchPad.

../../../_images/task1_studio_received_packets.png

Resource Explorer#

Task 5: Importing and Modifying rfPacketRx#

In this task we will use CCS to import (as in Task 2), modify (as in Task 3) and build the rfPacketRx example.

The Packet RX example illustrates how to do simple packet RX using the RF driver. This example is meant to be used with the Packet TX example or SmartRF Studio 7. For every packet received, the red LED is toggled. The frequency and other RF settings can be modified using SysConfig or SmartRF Studio 7.

Using SysConfig#

  • First, if there is an active debug session in CCS, please terminate it, e.g. by clicking the red square (Terminate) icon.

  • If SysConfig is already open, please close it.

  • If SmartRF Studio 7 is currently connected to the “RX” LaunchPad, then please disconnect it (close the respective Device Control Panel window).

  • Repeat Task 2, but choose the example rfPacketRx and use the second LaunchPad - the one labeled “RX”.

Warning

Why isn’t the LED blinking? Unlike the TX example, when running the RX example the green LED is not expected to toggle. When packets are received with CRC OK, the red LED will toggle, as you will see in the next task.

  • Now, modify the radio configuration using SysConfig. You have to basically chose the same configuration as the one you set in SmartRF Studio 7 in Task 4. The procedure is the same that the one you used previously in Task 3:

../../../_images/task5_sysconfig.png

Resource Explorer#

Note: Here you don’t need to modify the TX Power (as we will only RX)

  • To finish, save and close SysConfig. Then rebuild and run the rfPacketRx project on the “RX” LaunchPad.

Task 6 [optional]: SmartRF Studio 7 TX → Firmware RX#

Next we will send packets from SmartRF Studio 7 and receive them with the firmware application.

  • Start up a SmartRF Studio 7 instance and connect it to the “TX” LaunchPad.

  • Choose the same settings as before for the RF Parameters.

  • Go to the Packet TX tab and press Start

Hint

See it working. The red LED on the “RX” LaunchPad should now toggle for every packet being received with CRC OK. Note that when transmitting from SmartRF Studio 7, the green LED on the “TX” LaunchPad does not blink.

Task 7: Firmware TX → Firmware RX#

In this task we will use the firmware on the two LaunchPads for communication between them: the “TX” LaunchPad will send packets, which will be received by the “RX” LaunchPad.

  • At this stage, the two LaunchPads should already have the respective firmware flashed. If this is not the case, re-flash them accordingly, as described in the previous tasks.

  • Stop all debugging (if currently active), disconnect any LaunchPad from the PC, and then reconnect them to the pc to power them up.

Hint

See it working. The green LED on the TX board should toggle, indicating packet transmission and the red LED on the RX board should toggle as packets are being received.

Next Steps#

Congratulations! You now have accomplished a fundamental aspect of wireless communication. Recommended next steps would be to determine which wireless protocol you would like to use.

Standards-based protocols include:

You may also choose to create your own, proprietary protocol. For this, you can look into the Proprietary RF User’s Guide.

References#

Wireless Connectivity Overview

CC13x2/CC26x2 Technical Reference Manual

Proprietary RF User’s Guide