Adding Realtime Clock

My WDWhite was without RTC chip and i decided to put one in.

Initially board looked like this.
flickr:8399278378
After looking datasheets for RTC chips I've decided to go with DS1307 type RTC.
The DS1307 one is slightly different from the M41T0 one originally used in WDWhite (i've used this to identify original chip).
The M41T0 does not have dedicated backup battery pin, in WDWhite they used dual diodes to alternate between battery and 3.3 rail (based on the same picture).
Initially I was thinking to power up the DS1307 from 3.3 rail.
flickr:8398369293
But unfortunately the DS1307 require the VCC rail to be 1.25 x VBAT which is not true in our case (power line, in our case +3.3 volts x 1.25 = 4,125 > ~ 3.4 V of battery) so i decided to power the DS1307 from 5 volt rail (in fact, the DS1307 datasheet states minimal working voltage as 4 volts but the chip was working from 3.3 volts too).
And here is the final layout/mod.
flickr:8399481332
If You don't want to bother with changing the power rail, You may use M41T00 or M41T00SM41T00S (note the last 0 and 0S, according to ST's site M41T00S is the newer and preferred one) and power it directly from +3.3V rail.

Additionally when You power on the chip on board You'll need to initialise the RTC (put current date in) with following:

root@storage:~# hwclock -w -u -D --noadjfile
hwclock from util-linux-ng 2.17.2
Using /dev interface to clock.
Assuming hardware clock is kept in UTC time.
Time elapsed since reference time has been 0.826719 seconds.
Delaying further to reach the new time.
Setting Hardware Clock to 18:47:42 = 1358707662 seconds since 1969
ioctl(RTC_SET_TIME) was successful.

And then You can read the date with:

root@storage:~# hwclock -r
Sun 20 Jan 2013 10:49:34 PM AMT  -0.855473 seconds
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License