RTC inconsistent weekday

Report here problems in any of ChibiOS components. This forum is NOT for support.
Thargon
Posts: 95
Joined: Wed Feb 04, 2015 5:03 pm
Location: CITEC, Bielefeld University, germany
Has thanked: 7 times
Been thanked: 14 times

RTC inconsistent weekday

Postby Thargon » Thu Feb 21, 2019 1:16 pm

Hi,

I noticed an issue that the weekday is reported differently for the same date written to the RTC on various platforms.
Specifically, I compared a STM32F1 (RTCv1) and STM32F4 (RTCv2) and the latter reports one day off, e.g. stating that a date is a Friday although it ought to be Thursday.
Is it just me (so I have to check my configs once again), or can others reproduce this behavior?
In case I missed something in my code, the thread can be closed ;)
Otherwise it should be moved to bug reports, though.

Best regards,
Thomas

User avatar
Giovanni
Site Admin
Posts: 11649
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 488 times
Been thanked: 409 times
Contact:

Re: RTC inconsistent weekday

Postby Giovanni » Thu Feb 21, 2019 3:02 pm

It could be a bug, RTCv1 hasn't been used much, just F1 used it.

Giovanni

Thargon
Posts: 95
Joined: Wed Feb 04, 2015 5:03 pm
Location: CITEC, Bielefeld University, germany
Has thanked: 7 times
Been thanked: 14 times

Re: RTC inconsistent weekday

Postby Thargon » Mon Feb 25, 2019 3:40 pm

Hi,
I did some more investigation and it seems, that it's just the other way around.

I am using the C tm structure only and the interface functions rtcConvertStructTmToDateTime(), rtcSetTime(), rtcGetTime(), and rtcConvertDateTimeToStructTm(). So everything that interacts with the hardware and does the calculation is on the ChibiOS-Level. When interpreting the well-defined struct tm data, the weekday is actually correct only for the F1 platform. I've tested an F4 and L4 and both have the offset of one weekday in "the future".
For me this seems as if RTCv2 has some issues, not v1. Or you optimized for the buggy v1 at the HAL level level and thereby broke the correct v2 ;)

Best regards,
Thomas

PS: For the C tm structure the weekday is defined to be a value in [0..6] as the number of days after Sunday (thus Monday = 1). The RTCDateTime struct defines the weekday just as a value in [1..7] with no further information. I could imagine that the error has something to do with that imprecise specification.


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 3 guests