[time-nuts] Maxim DS3232 and I2C

Hal Murray hmurray at megapathdsl.net
Sat Feb 15 15:14:44 EST 2014


michael.cook at sfr.fr said:
> So if you do a multi-byte read to get the lot at once, then it should be
> coherent. I saw some code to do this somewhere, but I have lost track of it.

For things like that, I tend to write some test code to sanity check my 
understanding.  Then I let it run overnight to see if it will find any 
problems.  Often it does.  In this context, I'd have a loop that reads the 
time and checks to see that it is the same as the last time or has advanced 
by exactly one second.  The same case means you did two reads within the same 
second.  The advance-by-1 will fail if it takes more than a second to do a 
read.

Sometimes adding a few counters and printing them out occasionally (say every 
hour, or million times around the test loop) is interesting.


-- 
These are my opinions.  I hate spam.





More information about the time-nuts mailing list