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.

CC1310 wake up based on RTC absolute time

Other Parts Discussed in Thread: CC1310

Hi,

I would like to wake up the CC1310 at an absolute time based on a reading of the current time.  So basically the program would read the current RTC time and set an interrupt for a absolute tick count and then go to sleep. 

The example code I've seen only seems to set up the clock to interrupt based on a delay not a tick count of the RTC.  Is it possible to do this?

Thanks,

Jake

  • Can't you just use something like:

    //Remember to set:
    RF_cmdPropTx.startTrigger.pastTrig = 0;

    time = RF_getCurrentTime();
    RF_cmdPropTx.startTime = time + aTimeInTheFuture;

  • It was my understanding that used the RAT timer in the RF domain which I would like to leave powered down as much as possible due to power concerns. 

    Is this true or did I misunderstand?

  • Hi yes that correct -> my bad - disregard my answer.
  • my original thought was to set up an hwi using one of the other compare channels the RTC has but never seemed to be able to track down how this would be done.
  • Hi, yes so I read your question in the context of doing a future wake up in the RF domain, but you are thinking of waking up the M3 from 'sleep' based on the RTC?

    The term sleep is not in the terminology of this device.
    Do you mean standby or shutdown mode? I guess the latter since in standby, RTC is available (Possible wake-up sources are events from I/O, JTAG, RTC, and the sensor processor).
    While in shutdown mode, RTC is shut down and only an enabled pin interrupt or reset pin can wake up the device.
    If so, you would like to set a future wake up time based on RTC, set the device into Shutdown mode, wake up device based on an IRQ from ?.

    As far as I know, this is not possible.

  • When the radio is powered down, the RAT module is not counting. To keep a consistent time base over time the RAT can be synchronized with the RTC. This is a very important feature in low-power synchronous systems as it allows the RAT state to be saved, and the 24 MHz clock to be turned off in Standby mode, and then restore the state of the RAT again when powered up.

    The way this works is that the first time the RAT is started, it starts asynchronously. Every time the RAT is shut down, it waits and is turned off on an RTC edge, saving the current count of the RAT. Next time the RAT is turned on, it is restored to what the RAT would have been if it was running all along. This is done exactly on the RTC clock edge as well. This means that to the end application, it looks like the RAT was running while in Standby all along.

    When using TI-RTOS and our RF drivers, all this is used automatically so you can safely use Fred's approach for scheduling packets.

    Siri

  • Thanks Siri!

    This is a huge help. A couple of follow up questions:

    1. Can I use this same approach to schedule an RSSI check?

    2. In not all instances of waking up do I need to access the radio. Is there a similar approach for outside the radio domain?
  • Hi

    All radio operations provide a start trigger and can be scheduled with a delayed start. It brings the command from PENDING state into ACTIVE state and starts the actual command execution.

    You cannot schedule the CMD_GET_RSSI but you can schedule an RX command and then chain it with the RSSI command. Alternatively you can use the CS command to find out if a channel I available or not.

    Siri

  • Hi Jacob,

    since this forum focuses on Sub-1 GHz RF communication, all previous answers refer to the RF driver.

    If you just want to wait a few milliseconds, seconds or minutes, use Task_sleep() :

    #include <ti/sysbios/knl/Clock.h>
    #include <ti/sysbios/knl/Task.h>
    
    // Sleep inside a task for 47 milliseconds
    Task_sleep(47000/Clock_tickPeriod);

    The scheduler will proceed with another task of lower priority or put the controller into standby if possible.

    If you want more flexibility, for instance, a callback on timeout, then have a look at the Clock module.

    In both cases, you set the "wakeup" time indirectly by specifying a duration starting "now".

  • Hi Richard,

    I've seen the clock module. I want to be able to set a wake up based on the absolute tick time. From my understanding the CC1310 has several compare registers for the RTC. Is there a way to get the tick value of the RTC and then set up a compare register to run an HWI?

    Regards,
    Jake
  • Hi,

    the clock module uses the RTC. What accuracy do you need? Why can't you set a time relative to now? If you are fine with a couple of microseconds, then it's enough to do something like that:

    // Set up a one-shot clock object that posts a semaphore on timeout
    Clock_construct(...);
    
    // Let nobody disturb the calculation
    lockInterrupts();
    timeout = futureTime - currentRtcValue();
    Clock_setTimeout(timeout/Clock_tickPeriod);
    Clock_start();
    restoreInterrupts();
    
    // Wait until the clock times out
    Semaphore_pend();

    This is only some pseudo code.