zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.06k stars 6.18k forks source link

DS3231 Century bit meaning #40810

Open 2Eagle2 opened 2 years ago

2Eagle2 commented 2 years ago

Current implementation of counter for DS3231 thread century bit following way: 0 - it is 1900 century 1 - it is 2000 century

The documentation of DS3231 does not specify the meaning of the bit, it only says that it will toggle when the years register overflows from 99 to 00

The problem is when you sync DS3231 in external linux machine (e.g. RaspberryPi ) using hwclock -w it will ignore this century bit. Then reading time from Zephyr application will indicate wrong date.

My suggestion is set the meaning of zero in CENTURY bit in menuconfig: e.g. CONFIG_DS3231_CENTURY=20
would be for CENTURY bit. 0 - it is 2000 century 1 - it is 2100 century

It would make it much easier for applications when you sync RTC clock by PC connected to ntp server and then use it in your embedded project with proper real time clock. It would also be more flexible and accurate implementation according to datasheet of DS3231.

zephyrbot commented 5 months ago

Hi @bjarki-trackunit,

This issue, marked as an Enhancement, was opened a while ago and did not get any traction. It was just assigned to you based on the labels. If you don't consider yourself the right person to address this issue, please re-assing it to the right person.

Please take a moment to review if the issue is still relevant to the project. If it is, please provide feedback and direction on how to move forward. If it is not, has already been addressed, is a duplicate, or is no longer relevant, please close it with a short comment explaining the reason.

@2Eagle2 you are also encouraged to help moving this issue forward by providing additional information and confirming this request/issue is still relevant to you.

Thanks!