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.

CC2340R5: RTC Alarm setting

Part Number: CC2340R5
Other Parts Discussed in Thread: CC2650, CC2640

Hi 

I am working on CC2340R5 with simplelink_lowpower_f3_sdk_7_10_00_35 sdk.

I would like to use RTC alarm with callback function. Can anyone please guide me for this requirement by giving some example to this.

  • Hello Krishna,

    I am sending this to the relevant expert. 

    Kind Regards,

    Rogelio

  • Hi,

    Thank you for reaching out. Can you clarify what you mean by RTC alarm? Do you mean you would like to have a timer with an interrupt? Or specifically that you want to set a time and date and a callback triggers when that time is reached?

    Best Regards,

    Jan

  • I specifically want a RTC to set a time and include a callback function. 

  • Hi,

    Got it. Thank you for clarifying. The CC2340R5 device does have an RTC that can be used for this purpose. You can find some useful information on how the RTC works and how to interact with it on the register level in the CC23XX Technical Reference Manual in Chapter 12 RTC (shown below):

    You may also find some useful information in the hw_rtc.h file present in the SDK that may be helpful.

    Best Regards,

    Jan

  • Previously for CC2650 to use the ti-rtos It had a aon_rtc.c source to call in APIs https://dev.ti.com/tirex/explore/content/tirtos_cc13xx_cc26xx_2_21_00_06/products/cc26xxware_2_24_03_17272/doc/driverlib/group__aonrtc__api.html 

    I was expecting for such a doc regarding rtc in CC2340 , where I can call functions to reset , set RTC time, since my application requires these needs.

  • Hi,

    My apologies for any confusion, there are some differences between the RTC on the F2 devices and the CC23XX devices so the same functions are not available in both devices. 

    You should be able to perform the standard RTC operations directly through the registers detailed in the TRM. If you run into any  issues setting up the RTC, then please let me know and I would be more than happy to help!

    Best Regards,

    Jan

  • Hi Jan 

    This is the RTC registers for CC2640 where SEC in 0x00000008U base position can be used to set the RTC real time in secounds and SUBSEC for setting sub seconds .

    This is the RTC registers for CC2340 where I couldn't find any register to set time for RTC. 

    And I hope you are clear with my requirement.

    Requirement

    1) should be able to set RTC time 

    2) I need to keep an alarm at every 24th hour and enable a wakeup and callback function . 

    I went through the TRM and couldnt find relevant data considering my requirement. I am aware with setting interrupt in register . Apart from this, if you could give me little more clarity , I would be grateful

  • Hi,

    Given your requirements, we should use the RTC.TIME524 register as this provides a range of up to 71.4 years with the LSB representing 524 milliseconds. You should be able to set a compare time (in the proper units) for when you want the interrupt to trigger and then attach a callback to the interrupt. In this case, you wont be able to set a specific date, but you should be able to tell them at what time (compared to the present time) you want the interrupt to trigger.

    Best Regards,

    Jan

  • Hi Jan 

    I have been trying to work on RTC for my application. Since there is no such driver present for the application, I was working on configuring the Register. The overlapping registers with 8 microseconds tick and 524 milliseconds tick alignment is creating a bit of confusion. If possible, you could share an example to get hands-on support with this? 

    Also,  why RTC is accessing the clock from the system ( 48MHz) clock instead of the 32KHz crystal?

    I do have one more query to be clarified, As you said earlier, yeah right I can set a compare time against the RTC Time slice value in case of setting an interrupt, if Im right, in CH0CC8U register this work can be done.

    But my application requires  RTC TIME524 for a 24th-hour wake-up or above. For this purpose, I expect to find a compare register with the value compared against TIME524M.VAL, since no such register is addressed here, I need help from your end to clear this. 

  • Hi Krishna,

    Thank you for reaching out. I will look into this and get back to you as soon as possible. Expect an update by Monday (July 10th) with any findings or roadblocks I may have run into.

    Have a great weekend!

    Best Regards,

    Jan

  • Hi Krishna,

    Based on the information in the TRM, the design itself sources the low frequency clock for its operation.

    To set the value at the time registers, you would need to use the HWREG() functions as follows:

    HWREG(RTC_BASE + RTC_O_TIME524M) = temp;
    Where temp is a variable with the desired value or you can place the defines and values themselves directly on the right side of the assignment operator. Can you share how you are reading and writing the registers?
     
    I will look into the compare register and how it works with the upper time slice and get back to you as soon as possible.
     
    Best Regards,
    Jan
  • Hi,

    I have looked into the compare register and I have confirmed that it only looks at TIME8U.VAL. This means that the RTC's longest period between interrupt would be around 9 and a half hours. If you want to do some processing based on a timescale present in the upper values, then you would need to wake up every 9 and a half  hours, then view the TIME524M.VAL to determine if it is time to do some additional processing or if you should go back to standby.

    Best Regards,

    Jan

  • Hi Jan,

    Yeah, I am known to set and read values in the register. 

    sorry for the confusion,

    the example which you have shown is RTC_O_TIME524M, which is a readable register as per the TRM.

  • Hi,

    Got it! No worries! Did my previous response answer your question on the compare register?

    Best Regards,

    Jan