Apr 30, 2021
08:18 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 30, 2021
08:18 PM
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.
"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.
Solved! Go to Solution.
1 Solution
May 06, 2021
04:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 06, 2021
04:44 AM
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
I could confirm the values are as expected from the register values. Let me know if I missed anything.
Best Regards,
Vasanth
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
2 Replies
May 06, 2021
04:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 06, 2021
04:44 AM
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
I could confirm the values are as expected from the register values. Let me know if I missed anything.
Best Regards,
Vasanth
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
May 18, 2021
11:32 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 18, 2021
11:32 PM
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
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