cancel
Showing results for 
Search instead for 
Did you mean: 

RTC week day

purkovic
Associate II
Posted on October 03, 2015 at 21:33

Hello,

I'm working on a STM32L053 and I have a question about RTC and ''week day''. 

When I provide a date: YYYY-MM-YY  without day of week, I would like to know if the STM32L053 RTC hardware can calculate the week day or do i self need to calculate it in SW before setting the RTC? 
3 REPLIES 3
raptorhal2
Lead
Posted on October 03, 2015 at 22:59

On reset, the date register is set to Monday. I doubt the RTC can tell the difference between a default entry for week day and an intended value. And the simplest RTC design is to increment the week day after midnight. So, I think the answer is no.

Try it and see if I need re-educating.

Cheers, Hal

purkovic
Associate II
Posted on October 04, 2015 at 14:35

It seems that there is no verification in HW on the time/ date set by the HAL driver function: 

HAL_RTC_SetTime(&RtcHandle,&stimestructure,FORMAT_BCD)

Can anybody verify this? 

I've done some testing:

If I set the RTC to 28.2.2015 @ 23:59:50. 

If I wait 10 seconds. After 00.00 the date is 01.03.2015. The compensation seems working.

If I set the RTC to 29.2.2015 @ 23:59:50. 

If I wait 10 seconds. After 00.00 the date is 01.03.2015. The compensation seems working.

But if I set the RTC to 30.2.2015 @ 23:59:50. 

If I wait 10 seconds. After 00.00 the date is 31.02.2015. The compensation is not working.

Can anybody give me some documentation on how does the compensation (for leapyear) work. I am also interested in hearing if there is any data validation in RTC HW?

Posted on October 04, 2015 at 15:17

Pretty sure there is minimum silicon used here, and expects your software to at least start it with a valid date. Without that you can expect undesirable behaviour, that might still be predictable and consistent. While understanding this behaviour might give you insight into the circuit design it's not going to be considered a flaw if it's outside the valid range to start with.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..