AnsweredAssumed Answered

RTC clock get time and date from LPC54618

Question asked by Manikanta G on Feb 23, 2019
Latest reply on Feb 25, 2019 by ZhangJennie

I'm trying to use the internal RTC clock module as per configuration below. Initialization seems okay. 

But variable "date" does not increment seconds and so is the variable "mydate".

What could be wrong?

 

Here is my RTC config - 

 

rtc_datetime_t date;

rtc_datetime_t mydate;

 

In Main

{

   RTC_Config();

   while(1)

   {

      RTC_GetDatetime(RTC,&date);      // seconds should be incrementing at 1 sec rate but it doesn't

      mydate = date;

   }

}

 

void RTC_Config(void)
{

/* Enable the external RTC 32K Oscillator */
SYSCON->RTCOSCCTRL |= SYSCON_RTCOSCCTRL_EN_MASK;
/* Init RTC */
RTC_Init(RTC);
/* Set a start date & time */
date.year = 2019U;
date.month = 2U;
date.day = 9U;
date.hour = 9U;
date.minute = 0;
date.second = 0;
/* RTC time counter has to be stopped before setting the date & time in the TSR register */
RTC_StopTimer(RTC);
/* Set RTC time to default */
RTC_SetDatetime(RTC, &date);
/* Start the RTC time counter */
RTC_StartTimer(RTC);
}

 

-Gmk

Outcomes