This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS/CC2642R: Which "Timer" to use?

Part Number: CC2642R
Other Parts Discussed in Thread: CC2541

Tool/software: TI-RTOS

When Bluetooth advertising is started, if no one connects within 45 seconds, I want to disable advertising again.  So I just need a basic one-shot software timer that lets me do something when it expires a long (by processor standards) time later with an accuracy that only needs to be good enough for human perception; I definitely don't want to commandeer an actual hardware timer every time I want to do something like this.

So what's the difference between all the different ways there are to create a timer?

  1. Timer Module (http://dev.ti.com/tirex/explore/content/simplelink_cc13x2_26x2_sdk_3_10_00_53/docs/tirtos/sysbios/docs/Bios_User_Guide.pdf, section 5.4
    1. This seems like exactly what I DON'T want, because it grabs a hardware resource.
  2. Clock Module (http://dev.ti.com/tirex/explore/content/simplelink_cc13x2_26x2_sdk_3_10_00_53/docs/tirtos/sysbios/docs/cdoc/index.html#ti/sysbios/knl/Clock.html)
    1. This looks like once it's set up, you can create multiple software clock objects based on it, but does it still require you to grab a hardware timer first, or does TI_RTOS already have one for its system tick that it would just use?
  3. Util_constructClock() (util.c, included in SimplePeripheral example project)
    1. This appears to just be a sample procedure for the Clock Module above.
  4. GPTimerCC26XX (http://dev.ti.com/tirex/content/simplelink_cc13x2_26x2_sdk_3_10_00_53/docs/tidrivers/doxygen/html/_g_p_timer_c_c26_x_x_8h.html)
    1. This... I don't know; yet another timer.

I'm basically looking for something like the old osal_start_timerEx() from the CC2541.  Which of these should I use, or is there something else out there that I'm missing?  And what are the others for?

  • 1. The System Clock Manager is responsible for all timing services in SYS/BIOS. It generates the periodic system tick. The tick period is configurable. The timeout and period for all Clock Instances and timeout values in other SYS/BIOS modules are specified in terms of Clock ticks.

    2. Seconds module provides a way to set and get the number of seconds elapsed since Jan 1 00:00:00 GMT 1970 (the Unix epoch).

    3. Util_constructClock initializes a TIRTOS Clock instance and the assigned callback would be triggered when time is up. It's an utility wrap of TIRTOS Clock.

    4. Most use for generating PWM or doing pulse count.

    In your case, I would suggest you to use Util_constructClock.

  • And can you confirm that simply creates a software objects that would all make use of the RTOS's single underlying hardware resource? This doesn't appropriate new hardware timers, and I could theoretically create as many of them as software/RAM would allow?
  • Yes, that’s it.