XMC1100 Real Time Clock (RTC)

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User21649
Level 1
Level 1
Reference Manual RTC, V3.2 - V1.3, 2016-08 page 11-16 and 11-17


"Days counter starts with value 0 for the first day of month." incorrect, should be writen as: Days counter starts with value 1 for the first day of month.

"Months counter starts with value 0 for the first month of year." incorrect, should be writen as : Months counter starts with value 1 for the first month of year.

Tested on XMC 2Go board.
0 Likes
1 Solution
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked
Hi,

Did you confirm this on component register values(RTC Time Register 0? If you are using RTC_GetTime() API for this purpose understand the value incremented by 1, is returned by the API.

See the code below

void RTC_GetTime(XMC_RTC_TIME_t *current_time)
{
XMC_ASSERT("RTC_GetTime: NULL pointer", current_time != NULL);

XMC_RTC_GetTime(current_time);

current_time->days = current_time->days + 1U;
current_time->month = current_time->month + 1U;
}


I could confirm the values are as expected from the register values. Let me know if I missed anything.

Best Regards,
Vasanth

View solution in original post

0 Likes
2 Replies
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked
Hi,

Did you confirm this on component register values(RTC Time Register 0? If you are using RTC_GetTime() API for this purpose understand the value incremented by 1, is returned by the API.

See the code below

void RTC_GetTime(XMC_RTC_TIME_t *current_time)
{
XMC_ASSERT("RTC_GetTime: NULL pointer", current_time != NULL);

XMC_RTC_GetTime(current_time);

current_time->days = current_time->days + 1U;
current_time->month = current_time->month + 1U;
}


I could confirm the values are as expected from the register values. Let me know if I missed anything.

Best Regards,
Vasanth
0 Likes
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked
Hi,

I hope the situation is clear from last interaction. If not please refer this .

RTC_STATUS_t RTC_SetTime(XMC_RTC_TIME_t *current_time)
{
RTC_STATUS_t status = RTC_STATUS_SUCCESS;
XMC_RTC_TIME_t time_val;

XMC_ASSERT("RTC_SetTime: NULL pointer", current_time != NULL);

/* copy to local structure to keep data safe */
time_val.year = current_time->year;
time_val.month = current_time->month;
time_val.days = current_time->days;
time_val.hours = current_time->hours;
time_val.minutes = current_time->minutes;
time_val.seconds = current_time->seconds;

if ((time_val.days != 0U) && (time_val.month != 0U))
{
time_val.days = time_val.days - 1U;
time_val.month = time_val.month - 1U;


XMC_RTC_SetTime(&time_val);
}
else
{
status = RTC_STATUS_FAILURE;
}

return (status);
}

The actual values written into the registers are as defined in the reference manual. But the updated values are used in XMCLib and Dave APP functions for the function to be more user friendly. So the register definitions are accurate,
and your observations are also accurate. Please let me know if you need more clarification.

Best Regards,
Vasanth
0 Likes