element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
RoadTests & Reviews
  • Products
  • More
RoadTests & Reviews
Blog SimpleLink™︎ Sub-1 GHz Wireless Microcontroller - Create a Transmitter with SmartRF Studio Part 2
  • Blog
  • RoadTest Forum
  • Documents
  • RoadTests
  • Reviews
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join RoadTests & Reviews to participate - click to join for free!
  • Share
  • More
  • Cancel
  • Author Author: Jan Cumps
  • Date Created: 27 Jul 2016 1:30 PM Date Created
  • Views 2421 views
  • Likes 5 likes
  • Comments 9 comments
Related
Recommended
  • sub-1ghz
  • smartrf studio
  • cc1310
  • transmitter
  • radio
  • texas_instruments
  • iot
  • simplelink
  • feature_tutorial
  • ti_rt

SimpleLink™︎ Sub-1 GHz Wireless Microcontroller - Create a Transmitter with SmartRF Studio Part 2

Jan Cumps
Jan Cumps
27 Jul 2016

Time to create our first Radio project. A transmitter. Part 2 and final.

 

image

 

We continue with the project we created in part 1. At the end of this blog, we 'll have our transmitter running. And we'll be able to test it.

 

 

Change our Source

 

We only need to change our main source file (mine is calles aes.c). We'll include the radio API, create variables for our task handle and payload, and the radio task.

That's really it. Fairly simple.

We borrow the TX code from the TI-RTOS rfPacketTx example.

 

Include the header file generated by SmartRF Studio, and stdlib.h (we use the rand() function to generate random payload).

 

#include "smartrf_tx.h"
#include <stdlib.h>

 

 

Then we add our handles and constants. I've also created a prototype for our task function.

 

/***** Defines *****/
#define TX_TASK_STACK_SIZE 1024
#define TX_TASK_PRIORITY   2


/* TX Configuration */
#define PAYLOAD_LENGTH      30
#define PACKET_INTERVAL     (uint32_t)(4000000*0.5f) /* Set packet interval to 500ms */

/***** Prototypes *****/
static void txTaskFunction(UArg arg0, UArg arg1);

/***** Variable declarations *****/
static Task_Params txTaskParams;
Task_Struct txTask;    /* not static so you can see in ROV */
static uint8_t txTaskStack[TX_TASK_STACK_SIZE];

static RF_Object rfObject;
static RF_Handle rfHandle;

uint32_t time;
static uint8_t packet[PAYLOAD_LENGTH];
static uint16_t seqNumber;

 

Our task initialisation function (we prototyped our task declaration because it's used in this function, before the implementation).

This function first primes our TI-RTOS parameters with defaults. We override  where needed.

 

void TxTask_init()
{
    Task_Params_init(&txTaskParams);
    txTaskParams.stackSize = TX_TASK_STACK_SIZE;
    txTaskParams.priority = TX_TASK_PRIORITY;
    txTaskParams.stack = &txTaskStack;
    txTaskParams.arg0 = (UInt)1000000;  // we don't use this :)

    Task_construct(&txTask, txTaskFunction, &txTaskParams, NULL);
}

 

Our TI-RTOS task will do the actual sending.

It's worth checking out the documentation of the RF API to see why we're using the time variable.

 

static void txTaskFunction(UArg arg0, UArg arg1)
{
    uint32_t time;
    RF_Params rfParams;
    RF_Params_init(&rfParams);

    RF_cmdPropTx.pktLen = PAYLOAD_LENGTH;
    RF_cmdPropTx.pPkt = packet;
    RF_cmdPropTx.startTrigger.triggerType = TRIG_ABSTIME;
    RF_cmdPropTx.startTrigger.pastTrig = 1;
    RF_cmdPropTx.startTime = 0;

    /* Request access to the radio */
    rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioDivSetup, &rfParams);

    /* Set the frequency */
    RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);

    /* Get current time */
    time = RF_getCurrentTime();
    while(1)
    {
        /* Create packet with incrementing sequence number and random payload */
        packet[0] = (uint8_t)(seqNumber >> 8);
        packet[1] = (uint8_t)(seqNumber++);
        uint8_t i;
        for (i = 2; i < PAYLOAD_LENGTH; i++)
        {
            packet[i] = rand();
        }

        /* Set absolute TX time to utilize automatic power management */
        time += PACKET_INTERVAL;
        RF_cmdPropTx.startTime = time;

        /* Send packet */
        RF_EventMask result = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropTx, RF_PriorityNormal, NULL, 0);
        if (!(result & RF_EventLastCmdDone))
        {
            /* Error */
            while(1);
        }

    }
}

 

Our main() is simple. We init TI-RTOS, and kick it off.

 

int main(void)
{
    /* Call board init functions */
    Board_initGeneral();

    TxTask_init();

    /* Start BIOS */
    BIOS_start();

    return (0);
}

 

At this point our firmware is finished. Yes, it's virtually the same as the rfPacketTx example.

But we started from an empty frame. And we're using radio settings that we defined ourselves in SmartRF Studio.

So now, build the code and fire up the debugger. Don't execute the code yet, because first we'll...

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

Create the Test Bed

 

You don't know that your radio is transmitting if you can't measure the results.

We'll use our second LaunchPad as receiver, and SmartRF Studio as our console.

So plug in your second LaunchPad and fire up SmartRF Studio for that one.

 

image

 

It doesn't matter what firmware you have loaded to that second CC1310. SmartRF will talk to the radio sub-module directly.

 

Navigate to the Packet RX tab, set as shown above, and push Start.

Then Start your code in the CCS debug session.

The radio will start beaming, and our test bed shows the received packets.

You can see that the signal strength is different than you used to see with the standard SmartRF TX/RX test.

That's because we used a lower TX Power in the previous blog, when we asked SmartRF Studio to generate our sources.

Proof that we were able to build our own radio, from zero (but with help of some nice tools and examples).

 

I'm not going to write a blog post for the receiver. You can follow the same process as for this transmitter.

Just use the SmartRF Studio Packet RX tab, and use the TI-RTOS rfPacketRx example as inspiration.

 

My next blog will try to send encrypted data from our own sender app to our own receiver....

 

 

SimpleLinkTm Sub-1 GHz Wireless Microcontroller - Check  Received Signal Strength
SimpleLinkTm Sub-1 GHz Wireless Microcontroller - Use SmartRF to Try Radio Configs
SimpleLinkTm Sub-1 GHz Wireless Microcontroller - Debug 2 LaunchPads at the Same Time
SimpleLinkTm Sub-1 GHz Wireless Microcontroller - Side Note: Recognise your PuTTY Sessions
SimpleLinkTm Sub-1 GHz Wireless Microcontroller - Side Note: Recognise your Code Composer Studio Sessions
SimpleLinkTm Sub-1 GHz Wireless Microcontroller - Debug a Sender to Receiver Conversation
SimpleLinkTm Sub-1 GHz Wireless Microcontroller - Side Note: Start a Fresh Project
SimpleLinkTm Sub-1 GHz Wireless Microcontroller - Create a Transmitter with SmartRF Studio Part 1
SimpleLinkTm Sub-1 GHz Wireless Microcontroller - Create a Transmitter with SmartRF Studio Part 2
SimpleLinkTm Sub-1 GHz Wireless Microcontroller - Sensor Controller Engine Part 1: Dry Run
SimpleLinkTm Sub-1 GHz Wireless Microcontroller - Sensor Controller Engine Part 2: RTOS Integration
SimpleLinkTm Sub-1 GHz Wireless Microcontroller - Sensor Controller Engine Part 3: Wake Up Options
SimpleLinkTm Sub-1 GHz Wireless Microcontroller - Side Note : Measure Power Use of Sensor Controller Engine
SimpleLinkTm Sub-1 GHz Wireless Microcontroller - ToolKit for Range Testing

on TI E2E community: How to connect a CC1310 LaunchPad to the SIGFOX network

Attachments:
CC1310_LAUNCHXL_TI_CC1310F128_Sender.zip
  • Sign in to reply

Top Comments

  • DAB
    DAB over 9 years ago +2
    Another great blog Jan. I like your step by step approach. You do a great job of making it look simple. DAB
  • mads391i
    mads391i over 8 years ago +2
    Good explained
  • manu_gc
    manu_gc over 8 years ago in reply to mads391i +2
    Thank you for your valuable time Sir. I debugged the error . The mistake what i done was, i saved the sdk code instead of ti rtos version of cc1310.
  • manu_gc
    manu_gc over 8 years ago in reply to mads391i

    Thank you for your valuable time Sir. I debugged the error . The mistake

    what i done was,  i saved the sdk code instead of ti rtos version of

    cc1310.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • mads391i
    mads391i over 8 years ago

    Good explainedimage

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 8 years ago in reply to manu_gc

    Ah, manu, it's related to the newest SimpleLink for 432 release.

    This person on twitter (Eric) has the solution: https://twitter.com/spirilis/status/842057374546436101

    You could check with him...

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 8 years ago in reply to manu_gc

    I have never seen this issue, Manu.

    A few checks:

    - are you using CCS?

    - have you started the project in the exact same way?

    - can you show a screenprint of the SmartRF Studio setup you used to generate the smartrf files?

     

    Thank you.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • awneil
    awneil over 8 years ago in reply to manu_gc

    "You must define DEVICE_FAMILY at the project level as one of cc26x0, cc26x0r2, cc13x0, etc."

     

    So do that, then!

     

    As we're talking about CC1310, surely cc13x0 must be the obvious choice ?

     

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube