Other Parts Discussed in Thread: SYSBIOS
How to use RTC in cc2650 launchpad. I want to on and off LED after every 5 min using RTC only.
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.
Hi Ashwini,
Please refer to the aon_rtc Driverlib documentation and this relevant E2E thread.
Regards,
Ryan
Thank you Ryan for your reply, Now i am following this link (https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/859344/cc2650-by-using-always-on-domain-how-to-print-current-date-and-time)
#include <xdc/std.h>
#include <ti/sysbios/BIOS.h>
#include <driverlib/aon_rtc.h>
#include <driverlib/aon_batmon.h>
#include <time.h>
#include <ti/sysbios/hal/Seconds.h>
Char func;
Char func1;
uint32_t func2;
uint32_t func4;
uint32_t seconds;
uint32_t batt;
time_t t1;
uint32_t t;
struct tm *ltm;
char *curTime;
char seconds1;
char str;
uint8_t str1;
uint8_t str2;
int main()
{
/* Start kernel. */
AONRTCEnable();
func=AONRTCActive();
AONRTCEventClear(AON_RTC_CH1);
AONRTCCompareValueSet(AON_RTC_CH1, 0x5dddcc54);
AONRTCChannelEnable(AON_RTC_CH1);
AONRTCChannelEnable(AON_RTC_CH0);
func1=AONRTCChannelActive(AON_RTC_CH1);
AONRTCCombinedEventConfig(AON_RTC_CH0 | AON_RTC_CH1);
func4= AONRTCCompareValueGet(AON_RTC_CH1);
seconds = AONRTCSecGet();
System_printf("seconds=%s %d\r\n", seconds, seconds);
System_flush();
Seconds_set(func4);
t =Seconds_getTime(func4);
t1 = time(t);ltm = localtime(&t1);
curTime = asctime(ltm);
System_printf("Time(GMT): %s\n", curTime);
System_flush();
BIOS_start();
return 0;
}
i get result but that is not current time and date.
seconds=(null) 0
Time(GMT): Wed Nov 27 01:07:32 2019
when i calll this function i get null or 0 output.
please correct me where i do wrong.
There is no clock on the CC2650, including the RTC, which retains its value during a power outage. Thus the time stamp you are getting without a reference cannot reasonably be the current date. It is most likely factory programming settings (i.e. Unix time cannot be before the device was created). You will need to set the current value manually, store time information in non-volatile flash, keep the device on, include a battery backup, and account for time during which the device is powered down.
https://e2e.ti.com/f/1/t/484591
https://e2e.ti.com/f/1/t/697119
Regards,
Ryan