rodan / ds3234

arduino library for DS3234 RTC

Home Page:http://www.maxim-ic.com/datasheet/index.mvp/id/4051

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A (minor) bug to fix

WheresWally opened this issue · comments

Hi, thanks for the great library.
I notice that nearly all routines for reading and writing the time follow the same process that "could" lead to invalid time/date reading. From the PDF it says the register value is copied upon CS to prevent rollover screwing with the time/date.
My suggestion is to Set CS, read/write all required registers then unset CS.
I know that it would probably be rare to be reading the time/date regs during a rollover.
But to be the best maybe a few adjustment to the code????

From the PDF ...
When reading or writing the time and date registers,
secondary (user) buffers are used to prevent errors
when the internal registers update. When reading the
time and date registers, the user buffers are synchronized
to the internal registers on the falling edge of CS
or and when the register pointer rolls over to zero. The
time information is read from these secondary registers,
while the clock continues to run. This eliminates the
need to reread the registers in case the main registers
update during a read.

I see what you mean.
problem is I don't have the AVR programmer any longer. so testing any changes would be impossible.