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 - Sensor Controller Engine Part 3: Wake Up Options
  • 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: 11 Nov 2016 6:09 PM Date Created
  • Views 1500 views
  • Likes 2 likes
  • Comments 4 comments
Related
Recommended
  • sub-1ghz
  • cc1310
  • texas_instruments
  • simplelink
  • ti_rt

SimpleLink™︎ Sub-1 GHz Wireless Microcontroller - Sensor Controller Engine Part 3: Wake Up Options

Jan Cumps
Jan Cumps
11 Nov 2016

Complexity: medium

What do you need:

  • two CC1310 LaunchPads
  • Code Composer Studio
  • TI RTOS
  • Sensor Controller Studio

 

This blog digs into the sub-module that manages communication with sensors. A dedicated part of the IC that takes care that Radio and CPU can sleep until something meaningful happens in sensor land.

 

image


You'll learn how to run the system low power and let the Sensor Controller module wake up the rest of the CC1310 only when needed.

 

In part 3, we check out how we configure the wake-up options in Sensor Controller Studio and CCS.

 

Sensor Controller Engine: WSN Node example (cont.)

The previous article showed how the Sensor Controller Engine (SCE) integrates with TI-RTOS.

It also explained how the SCE wakes up the ARM Cortex core and how that core then wakes up the Radio.

This time we check out when the SCE decides to wake up the application.

 

The application will have to wake up at a defined-by-us time, or faster if the analog input value changed beyond a threshold.

The code in the Sensor Controller Studio defines the mechanism for the two decisions.

In Code Composer Studio we set the configurations at the start of the program.

 

Sensor Controller Studio

The SCE code has a data structure to hold the configuration items.

image

There's a wizard to set up that structure.

In our Execution code, we make decisions based on the settings.

 

changes outside our sample value changeMask window

If the sampled value is inside our 'window of expected values' we just update a counter and continue to the next decision point.

If the analog value changed outside the window, we wake up the application and reset our counter

// Alert the driver if outside of change mask
U16 adcMaskedBits = adcValue & cfg.changeMask;
if (adcMaskedBits != state.oldAdcMaskedBits) {
  fwGenAlertInterrupt();
  state.samplesSinceLastReport = 0;
} else {
  state.samplesSinceLastReport = state.samplesSinceLastReport + 1;
}

 

changes inside our sample value changeMask window

The next part of the code executes every time the samplesSinceLastReport reaches minReportInterval.

//Alert driver if minimum report interval has expired
if(cfg.minReportInterval != 0) {
    if(state.samplesSinceLastReport >= cfg.minReportInterval) {
        fwGenAlertInterrupt();
        state.samplesSinceLastReport = 0;
    }
}

 

These two chunks define that the code wakes up the RTOS if we move the ADC with more delta than defined in the mask, else after a certain number of ticks.

What it doesn't say is what that mask is or how many ticks to wait. That happens in TI-RTOS.

 

Code Composer Studio

The parameters are set in NodeTask.c. In an RTOS program, it's common to define the configurations at the start of an RTOS task, before it starts looping.

/* A change mask of 0xFF0 means that changes in the lower 4 bits does not trigger a wakeup. */
#define NODE_ADCTASK_CHANGE_MASK                    0xFF0

/* Minimum slow Report interval is 50s (in units of samplingTime)*/
#define NODE_ADCTASK_REPORTINTERVAL_SLOW                50
/* Minimum fast Report interval is 1s (in units of samplingTime) for 30s*/
#define NODE_ADCTASK_REPORTINTERVAL_FAST                1
#define NODE_ADCTASK_REPORTINTERVAL_FAST_DURIATION_MS   30000

 

 

When the RTOS runs our NodeTaskFunction() for he first time, it will prime the SCE.

static void nodeTaskFunction(UArg arg0, UArg arg1)
{
    // ...


    /* Start the SCE ADC task with 1s sample period and reacting to change in ADC value. */
    SceAdc_init(0x00010000, NODE_ADCTASK_REPORTINTERVAL_FAST, NODE_ADCTASK_CHANGE_MASK);
    SceAdc_registerAdcCallback(adcCallback);
    SceAdc_start();


    /* setup timeout for fast report timeout */
    Clock_setTimeout(fastReportTimeoutClockHandle,
            NODE_ADCTASK_REPORTINTERVAL_FAST_DURIATION_MS * 1000 / Clock_tickPeriod);


    /* start fast report and timeout */
    Clock_start(fastReportTimeoutClockHandle);
    // ...
    while(1) {
        // we have seen this code in the previous blog
        // ...
    }

 

The SceAdc_xxx() functions are helpers defined in SceAdc.c.

Check them out in that file. Here's SceAdc_init() as example:

void SceAdc_init(uint32_t samplingTime, uint32_t minReportInterval, uint16_t adcChangeMask) {
    // Initialize the Sensor Controller
    scifOsalInit();
    scifOsalRegisterCtrlReadyCallback(ctrlReadyCallback);
    scifOsalRegisterTaskAlertCallback(taskAlertCallback);
    scifInit(&scifDriverSetup);
    scifStartRtcTicksNow(samplingTime);

    SCIF_ADC_SAMPLE_CFG_T* pCfg = scifGetTaskStruct(SCIF_ADC_SAMPLE_TASK_ID, SCIF_STRUCT_CFG);
    pCfg->changeMask = adcChangeMask;
    //Set minimum report interval in units of samplingTime
    pCfg->minReportInterval = minReportInterval;
}

 

There's more than the things I show in this blog - in particular some nice TI-RTOS and clock techniques.

It's worth digging trough both NodeTask.c and SceAdc.c until you fully understand each line in them.

It'll up your expertise in RTOS based application development.

 

 

 

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

  • Sign in to reply

Top Comments

  • Jan Cumps
    Jan Cumps over 8 years ago in reply to DAB +2
    DAB, I'm not going to review the common (not radio-engine or sensor-engine based) wake-up options. These usual suspects are available (use dependent on the sleep mode) Real Time Clock Pin Edge Reset Pin…
  • DAB
    DAB over 8 years ago +1
    Nice update. Having good timing options is always good. Are you going to look at other hardware detection activations? DAB
  • Jan Cumps
    Jan Cumps over 8 years ago in reply to Jan Cumps +1
    This is better. 1mV is 1µA
  • Jan Cumps
    Jan Cumps over 8 years ago in reply to Jan Cumps

    This is better. 1mV is 1µA

     

    image

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

    I'm trying to get an energy profile of the Node.

    image

     

    I have removed the LED code from the firmware, so that the consumption doesn't get skewed by the activity LED.

    I replaced it with a pulse at the start of the radio emission.

    The results aren't as expected. I was supposed to see a significant instant current change when the ARM and Radio activate.

     

    I'm checking now if it's my expectations that are wrong, my measurement setup, or <anything else>

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 8 years ago in reply to DAB

    DAB, I'm not going to review the common (not radio-engine or sensor-engine based)  wake-up options.

    These usual suspects are available (use dependent on the sleep mode)

    • Real Time Clock
    • Pin Edge
    • Reset Pin

     

    image

    In this series I plan to focus on the options that are specific to this controller, and how you have to program the intelligent sub-modules to run efficiently.

     

    On another note: here's a screen print of this example working.

    PuTTY shows the Concentrator output.

    It seems that I have 3 Nodes, but that's not true. I unplugged my Node a few times and it registered as a new one.

     

    image

     

    When I turn the potentiometer, and change the voltage on the Node's analog input, it's nicely communicated to the Concentrator. Success!

    (it would be bad if it wasn't successful, because it's one of the LaunchPad's examples)

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

    Nice update.

     

    Having good timing options is always good.

     

    Are you going to look at other hardware detection activations?

     

    DAB

    • 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