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.

LAUNCHXL-CC1352P: RTC calendar parameter

Part Number: LAUNCHXL-CC1352P
Other Parts Discussed in Thread: CC1352P

Hello,

I am using CC1352P. 

I want to use RTC of cc1352p.

I want to read calendar data(sec, min, hour, day, month, day of week ,day of month etc.) from that RTC.

But i can not find API from TI sdk 4.10.

I also check TRM (https://www.ti.com/lit/ug/swcu185d/swcu185d.pdf)  but there a no register for min, hour,day,month,year etc.

so how can i get calendar data?

help me to solve this problem.

Thanks,

Dinkar

  • Hi,

    I used the following code in a personal project to leverage the RTC:

    /* For RTC */
    #include <time.h>
    #include <ti/sysbios/hal/Seconds.h>
    #include "ti/devices/cc13x2_cc26x2/driverlib/aon_rtc.h"
    
    void init(void)
    {
        Seconds_set(0); // this should be set to the current time
    }
    
    void get()
    {
        uint32_t currTime = AONRTCCurrentCompareValueGet();
        uint16_t seconds   = (uint16_t)((currTime >> 16) & 0xFFFF);
        uint16_t m_seconds = (uint16_t)((uint64_t)((currTime & 0xFFFF) * 1000) / 65535);
    }

    Let me know if it helps :)

    Kind regards,

  • Hello,

    Thanks for quick reply. 

    I already checked this API. But i need real time from RTC.

    In code i need to set current time , date in RTC. and then when ever I read RTC then it gives me real time date and time.

    Thanks,

    Dinkar

  • Hi Dinkar,

    You can use the function Seconds_set() to set any date (i.e. you can set the current date). Then you need to convert the result in order to compute the date you want. Here is a thread showing this.

    Regards,