The Correct way to add a RTC


61 posts   Page 1 of 3   1, 2, 3
by PeterO » Fri Aug 29, 2014 7:13 am
One of my Pis runs as a network server, providing DHCP and DNS services. To add more resilience to my home network I decided to get an I2C RTC module for it and add configure it to be the NTP server for my network (*).

I read several blogs and howtos about adding RTCs to PIs and nearly all of them get it wrong. They fudge some stuff into /etc/rc.local to set the system clock from the I2C RTC and don't remove the fake-hwclock or install a proper hwclock driver.

SO .... here's what to do. I've only tried this using a ds1307 based RTC module, but it should work (with appropriate changes) for RTCs based on other I2C clock chips.

Step 1: Follow the instructions on the Adafruit site https://learn.adafruit.com/adding-a-real-time-clock-to-raspberry-pi?view=all to get your I2C RTC connected and tested, but DO NOT make the suggested changes to /etc/rc.local

Step 2:Make the changes to /etc/init.d/hwclock.sh as described here http://www.elevendroids.com/2012/12/setting-up-hardware-rtc-in-raspbian/

Step 3: Ignore the first part of http://blog.remibergsma.com/2013/05/08/ ... pberry-pi/ but do follow the instructions on removing the fake-hwclock.

Your PI now has a proper RTC that can be used as a fall back by the NTP server incase the internet is unavailable, and which will also be kept accurate by being updated by the kernel.

PeterO


(*) Since I also run the DHCP server it was a simple matter to set that up to configure its clients to use my NTP server.
Discoverer of the PI2 XENON DEATH FLASH !
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson
User avatar
Posts: 2861
Joined: Sun Jul 22, 2012 4:14 pm
by fruit-uk » Fri Aug 29, 2014 8:41 am
This last section on this page has worked for me on several RPis
http://wiki.sysadminblog.net/Rasbian
Posts: 607
Joined: Wed Aug 06, 2014 4:19 pm
Location: Suffolk, UK
by PeterO » Fri Aug 29, 2014 8:51 am
fruit-uk wrote:This last section on this page has worked for me on several RPis
http://wiki.sysadminblog.net/Rasbian


I wish I had found that earlier :roll: ! But it still says to put stuff into /etc/rc.local ! Instead it should say to run "update-rc.d hwclock.sh enable" to do it properly.

PeterO
Discoverer of the PI2 XENON DEATH FLASH !
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson
User avatar
Posts: 2861
Joined: Sun Jul 22, 2012 4:14 pm
by itsmedoofer » Thu Nov 06, 2014 4:07 pm
Hi,

Really useful post thanks, I've consolidated into a list of instructions to save darting about all over the net....
----------------------

Enable the Kernel modules:-
Code: Select all
sudo nano /etc/modules

Add the following:-
Code: Select all
i2c-bcm2708
i2c-dev

Save

Remove them from the blacklist by adding #
Code: Select all
sudo nano /etc/modprobe.d/raspi-blacklist.conf

Make sure you see:-
Code: Select all
#blacklist spi-bcm2708
#blacklist i2c-bcm2708

Save & reboot

Install the i2c tools for testing:-
Code: Select all
sudo apt-get install i2c-tools

Run a test to see if all is well... for a rev 1 pi :
Code: Select all
sudo i2cdetect -y 0

or for later, rev 2 Pi's :
Code: Select all
sudo i2cdetect -y 1

You should see something like:-
Code: Select all
pi@raspberrypi ~ $ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --


load up the RTC module and test by running :
Code: Select all
sudo modprobe rtc-ds1307

Code: Select all
sudo bash

For older rev 1 pi's :
Code: Select all
echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device
exit

or for newer, rev 2 pi's :
Code: Select all
echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device
exit

Check the clock is running and can be read:-
Code: Select all
sudo hwclock -r

Make sure pi is connected to internet so correct time is set....

Write the current system time to the hardware clock:-
Code: Select all
sudo hwclock -w


Add the clock to the Kernel modules:-
Code: Select all
sudo nano /etc/modules

Add:-
Code: Select all
rtc-ds1307

Save

Reconfigure the hwclock.sh script:-
Code: Select all
sudo nano /etc/init.d/hwclock.sh

After "unset TZ" at top add..
Code: Select all
init_rtc_device()
{
  [ -e /dev/rtc0 ] && return 0;

  # load i2c and RTC kernel modules
  modprobe i2c-dev
  modprobe rtc-ds1307

  # iterate over every i2c bus as we're supporting Raspberry Pi rev. 1 and 2
  # (different I2C busses on GPIO header!)
  for bus in $(ls -d /sys/bus/i2c/devices/i2c-*);
  do
    echo ds1307 0x68 >> $bus/new_device;
    if [ -e /dev/rtc0 ];
    then
      log_action_msg "RTC found on bus `cat $bus/name`";
      break; # RTC found, bail out of the loop
    else
      echo 0x68 >> $bus/delete_device
    fi
  done
}


Find "case "$1" in" and edit as per:-
Code: Select all
case "$1" in
   start)
       # If the admin deleted the hwclock config, create a blank
       # template with the defaults.
       if [ -w /etc ] && [ ! -f /etc/adjtime ] && [ ! -e /etc/adjtime ]; then
           printf "0.0 0 0.0\n0\nUTC" > /etc/adjtime
       fi
      init_rtc_device

            # Raspberry Pi doesn't have udev detectable RTC
       #if [ -d /run/udev ] || [ -d /dev/.udev ]; then
      #return 0
       #fi

Save

Update the real HW Clock and remove the fake:-
Code: Select all
sudo update-rc.d hwclock.sh enable
sudo update-rc.d fake-hwclock remove


Now that real hardware clock is installed, remove the fake package and it’s crons:-
Code: Select all
sudo apt-get remove fake-hwclock
sudo rm /etc/cron.hourly/fake-hwclock
sudo rm /etc/init.d/fake-hwclock

Reboot
Posts: 209
Joined: Wed Sep 25, 2013 8:43 am
by DirkS » Sun Nov 30, 2014 1:37 pm
Thanks for this great guide!

One additional (potential) issue: check /etc/default/hwclock and delete or comment out any lines with
Code: Select all
HWCLOCKACCESS=no

It could save you a few hours of frustration :roll:

I (now) know raspbian-ua-netinst adds this line, but there could be other distros that do this too.

Gr.
Dirk.
Posts: 6435
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK
by purchasemail » Sat Dec 06, 2014 8:15 pm
Great help, itsmedoofer, but some clarification, please.
You wrote "load up the RTC module and test by running, i2c-0 for and old Pi:-"
Specifically how do you modify the command "sudo modprobe rtc-ds1307" if using an old Pi?
Posts: 9
Joined: Sat Apr 27, 2013 1:06 am
by DirkS » Sat Dec 06, 2014 8:43 pm
purchasemail wrote:Specifically how do you modify the command "sudo modprobe rtc-ds1307" if using an old Pi?

It's the same command, the 'magic' has already been done here:
Code: Select all
sudo bash
echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device
exit

For a B rev 1 you have to change this to
Code: Select all
sudo bash
echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device
exit


Gr.
Dirk.
Posts: 6435
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK
by LT_irobot » Mon Dec 08, 2014 12:09 pm
Hi,

according this step by step, my Raspi 's RTC DS3231 works.

But I found a problem: the time will delay after reboot.

I guess the reason is that when shutdown the system, the system will write date back to RTC, the process will cause the time delay about 1~2 sends.
Linux raspberrypi 3.12.28+ #709 PREEMPT Mon Sep 8 15:28:00 BST 2014 armv6l GNU/Linux
RaspBerry Pi Model B+ | Sandisk Extreme microSDHC UHS-I 16GB Read:18.8M/s Write:18.2M/s | Sagem XG760N USB Dongle WiFi
Posts: 1
Joined: Mon Dec 01, 2014 4:33 am
by itsmedoofer » Mon Dec 08, 2014 12:29 pm
Hi,

I dont think so, if I boot without the RTC attached my Pi boots with a date in the 1970's.

It sounds to me like the fake hardware clock may still be running OR that your RTC and internet time do not match...

Make sure pi is connected to internet so correct time is set....

Write the current system time to the hardware clock:-

sudo hwclock -w

Martin.
Last edited by itsmedoofer on Mon Dec 08, 2014 12:32 pm, edited 1 time in total.
Posts: 209
Joined: Wed Sep 25, 2013 8:43 am
by itsmedoofer » Mon Dec 08, 2014 12:30 pm
DirkS wrote:
purchasemail wrote:Specifically how do you modify the command "sudo modprobe rtc-ds1307" if using an old Pi?

.


Thanks Dirk, noticed several typos after reading back but I cannot edit now :(
Posts: 209
Joined: Wed Sep 25, 2013 8:43 am
by DirkS » Mon Dec 08, 2014 12:49 pm
itsmedoofer wrote:Thanks Dirk, noticed several typos after reading back but I cannot edit now :(

Are you sure? AFAIK you should be able to edit your own posts. You should see an 'edit post' link or edit button (depending on the theme / style).

Gr.
Dirk.
Posts: 6435
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK
by texy » Mon Dec 08, 2014 12:51 pm
itsmedoofer wrote:
DirkS wrote:
purchasemail wrote:Specifically how do you modify the command "sudo modprobe rtc-ds1307" if using an old Pi?

.


Thanks Dirk, noticed several typos after reading back but I cannot edit now :(

I've tided up a few bits in your post, see if I need to make any more, or I made any mistakes.
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555
Forum Moderator
Forum Moderator
Posts: 4694
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England
by itsmedoofer » Wed Dec 10, 2014 8:25 am
texy wrote:I've tided up a few bits in your post, see if I need to make any more, or I made any mistakes.
Texy


Nice one thanks a lot texy appreciated !
Posts: 209
Joined: Wed Sep 25, 2013 8:43 am
by RBISWASX » Sun Jan 18, 2015 3:35 pm
Hi All,

Here is my updated Blog on Interfacing RaspberryPi with RTC, DS1307. Everything, from configuring and building the Kernel to enable RTC, DS1307 to Circuit diagram, to the Installation of I2C Tools like i2cdetect, i2cget, i2cset, et al. has been covered in detail. Apart, from changes to be done in etc.modules script, rc.local and config script to register the RTC-DS1307 to I2C Bus.

Here is my Blog Page:

http://blogsmayan.blogspot.in/p/adding.html

Thanks,
Rajiv.
Posts: 29
Joined: Thu Jan 09, 2014 5:30 pm
by itsmedoofer » Mon Jan 19, 2015 12:33 pm
Hi

RBISWASX wrote:Here is my updated Blog on Interfacing RaspberryPi with RTC, DS1307.


A couple of points,

a) The screen shots were Ubuntu, why not the Pi ?
b) With Raspbian you do not need to mess with the Kernel.
c) i2c-tools is available via apt-get, no need to download or compile.
d) There was no mention of this thread as a reference and the work PeterO done finding the correct info.....

Martin.
Posts: 209
Joined: Wed Sep 25, 2013 8:43 am
by RBISWASX » Sun Jan 25, 2015 3:56 pm
Hi Martin,

I shall try to answer the queries to the best of my means:
a) The screen shots were Ubuntu, why not the Pi ?

Since, i was accessing my RaspberryPi via RS232toUSB Serial Adapter(PL203), connected via a MAX232 circuit to the Expansion header Tx, Rx, Vcc and Gnd, Pins P1-8, P1-10, P1-2 and P1-6, respectively. In this way, i was able to see the RaspberryPi Board shell instance via a Serial Program, Minicom, or Putty, by setting the port as ttyUSB0 and baudrate at 115200,8N1.

Please refer my first blog, in the first part " The Setup", of "Programming Interrupts in Raspberry Pi using a simple Kernel Character Device Driver", http://blogsmayan.blogspot.in/p/program ... ry-pi.html

b) With Raspbian you do not need to mess with the Kernel.
We need to modify the .config file, in order to enable the RTC-DS1307 module, which is otherwise set to 'm', manual.
After, that set tht config, and build new kernel image, and edit the /etc/modules to load the modules at runtime.

c) i2c-tools is available via apt-get, no need to download or compile.
If, one wants to try with different flavors of the latest linux Kernel, then it may or may not be present. better, we are able to
'configure' the package source, and then do 'make' and 'make install' to install the i2c-tools package.

d) There was no mention of this thread as a reference and the work PeterO done finding the correct info.....
Sorry, i shall add the references, from which all i have collated and compiled this work in total.

Regards,
Rajiv.
Posts: 29
Joined: Thu Jan 09, 2014 5:30 pm
by rpdom » Sun Jan 25, 2015 4:22 pm
RBISWASX wrote:b) With Raspbian you do not need to mess with the Kernel.
We need to modify the .config file, in order to enable the RTC-DS1307 module, which is otherwise set to 'm', manual.
After, that set tht config, and build new kernel image, and edit the /etc/modules to load the modules at runtime.

This is incorrect.
"m" means "module", not "manual". It means the driver has been built as a module and all you need to do is add it to /etc/modules.
If you change it to "y", then the driver will be built into the kernel, not as a module and adding it to /etc/modules is pointless.

So you don't need to mess with the kernel.
User avatar
Posts: 9881
Joined: Sun May 06, 2012 5:17 am
Location: Essex, UK
by kazzttor » Tue Jan 27, 2015 12:10 am
Hi, people,

I made this procedure (edit file /boot/config.txt, but the best way to change it is by raspi-config > 8. Advanced options > A6. I2C), but i had a trouble and my rtc with chip pcf8563 conected to my Pi.

When I try to use the command to update time of rtc this error occours:

Code: Select all
pi@raspberrypi ~ $ sudo hwclock -w
hwclock: select() to /dev/rtc0 to wait for clock tick timed out: Arquivo ou diretório não encontrado


I also used the dmesg command to find any error. This is the message related of i2c and pcf8563:

Code: Select all
pi@raspberrypi ~ $ dmesg|grep i2c
[    5.503791] bcm2708_i2c_init_pinmode(0,0)
[    5.666925] bcm2708_i2c_init_pinmode(0,1)
[    5.674016] bcm2708_i2c 20205000.i2c: BSC0 Controller at 0x20205000 (irq 79) (baudrate 100000)
[    5.991503] bcm2708_i2c_init_pinmode(1,2)
[    6.206989] bcm2708_i2c_init_pinmode(1,3)
[    6.213990] bcm2708_i2c 20804000.i2c: BSC1 Controller at 0x20804000 (irq 79) (baudrate 100000)
[   12.084975] i2c /dev entries driver
[   39.789832] i2c i2c-1: new_device: Instantiated device pcf8563 at 0x51


Code: Select all
pi@raspberrypi ~ $ dmesg|grep rtc
[   39.782178] rtc-pcf8563 1-0051: chip found, driver version 0.4.3
[   39.789131] rtc (null): invalid alarm value: 2015-2-6 62:47:0
[   39.789709] rtc-pcf8563 1-0051: rtc core: registered rtc-pcf8563 as rtc0


The rtc module is loaded and detected, in according with i2cdetect command:

Code: Select all
pi@raspberrypi ~ $ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- UU -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --



I don't know why rtc chip is not working. Is it necessary any configuration or the issue is with rtc chip (ex. low battery)?
Kazzttor

Diadema-SP, Brazil
Linux-Windows-Mac User
Raspberry Pi Lover
User avatar
Posts: 4
Joined: Wed Jan 21, 2015 2:57 am
Location: Diadema - São Paulo, Brazil
by DougieLawson » Tue Jan 27, 2015 8:29 am
Please post the output from a uname -a command.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
RPi owner since '12.
Twitter: @DougieLawson

2B, B+, A+, 5Bs, zero, 3B

Please post ALL technical questions on the forum.Do not send private messages.
User avatar
Posts: 24078
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
by kazzttor » Tue Jan 27, 2015 12:51 pm
Code: Select all
pi@raspberrypi ~ $ uname -a
Linux raspberrypi 3.18.3+ #741 PREEMPT Fri Jan 23 13:32:52 GMT 2015 armv6l GNU/Linux
Kazzttor

Diadema-SP, Brazil
Linux-Windows-Mac User
Raspberry Pi Lover
User avatar
Posts: 4
Joined: Wed Jan 21, 2015 2:57 am
Location: Diadema - São Paulo, Brazil
by DougieLawson » Tue Jan 27, 2015 3:23 pm
Well done, you've shot yourself in the foot by running rpi-update when it wasn't needed.

Edit /boot/config.txt add
Code: Select all
device_tree_param=i2c1=on
then reboot.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
RPi owner since '12.
Twitter: @DougieLawson

2B, B+, A+, 5Bs, zero, 3B

Please post ALL technical questions on the forum.Do not send private messages.
User avatar
Posts: 24078
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
by RBISWASX » Thu Jan 29, 2015 3:34 pm
rpdom wrote:
RBISWASX wrote:b) With Raspbian you do not need to mess with the Kernel.
We need to modify the .config file, in order to enable the RTC-DS1307 module, which is otherwise set to 'm', manual.
After, that set tht config, and build new kernel image, and edit the /etc/modules to load the modules at runtime.

This is incorrect.
"m" means "module", not "manual". It means the driver has been built as a module and all you need to do is add it to /etc/modules.
If you change it to "y", then the driver will be built into the kernel, not as a module and adding it to /etc/modules is pointless.

So you don't need to mess with the kernel.


"m" means "module", not "manual"
Yes, i made a Typo mistake while typing. i failed to check it.

"If you change it to "y", then the driver will be built into the kernel, not as a module and adding it to /etc/modules is pointless.
So you don't need to mess with the kernel."

Incorrect. You will in that case need to do
# modprobe rtc-ds1307

That's why, one can add it in /etc/modules and the module is loaded, as the Kernel starts up,and one does not
need to load it, manually using #modprobe.
Thus, better, change the .config file and make it to "y", and add "rtc-ds1307" in /etc/modules, to ensure that the
Module would be loaded at Kernel initialization startup time.

Also, say, if One needed to implement the RTC Clock using DS-1302, or DS1331, clearly, one needs to look into
the Kernel Config file, and enable the Module, since not all of them are enabled by Default. My main, purpose was
to explain, where it needs to be done to do so. Thus, u do need to look into the Kernel a Bit. Mess is the wrong word
here, when all one, can do is to share and learn. Hope, u get my point.

Regards,
Rajiv.
Posts: 29
Joined: Thu Jan 09, 2014 5:30 pm
by RBISWASX » Thu Jan 29, 2015 3:49 pm
kazzttor wrote:Hi, people,

I made this procedure (edit file /boot/config.txt, but the best way to change it is by raspi-config > 8. Advanced options > A6. I2C), but i had a trouble and my rtc with chip pcf8563 conected to my Pi.

When I try to use the command to update time of rtc this error occours:

Code: Select all
pi@raspberrypi ~ $ sudo hwclock -w
hwclock: select() to /dev/rtc0 to wait for clock tick timed out: Arquivo ou diretório não encontrado


I also used the dmesg command to find any error. This is the message related of i2c and pcf8563:

Code: Select all
pi@raspberrypi ~ $ dmesg|grep i2c
[    5.503791] bcm2708_i2c_init_pinmode(0,0)
[    5.666925] bcm2708_i2c_init_pinmode(0,1)
[    5.674016] bcm2708_i2c 20205000.i2c: BSC0 Controller at 0x20205000 (irq 79) (baudrate 100000)
[    5.991503] bcm2708_i2c_init_pinmode(1,2)
[    6.206989] bcm2708_i2c_init_pinmode(1,3)
[    6.213990] bcm2708_i2c 20804000.i2c: BSC1 Controller at 0x20804000 (irq 79) (baudrate 100000)
[   12.084975] i2c /dev entries driver
[   39.789832] i2c i2c-1: new_device: Instantiated device pcf8563 at 0x51


Code: Select all
pi@raspberrypi ~ $ dmesg|grep rtc
[   39.782178] rtc-pcf8563 1-0051: chip found, driver version 0.4.3
[   39.789131] rtc (null): invalid alarm value: 2015-2-6 62:47:0
[   39.789709] rtc-pcf8563 1-0051: rtc core: registered rtc-pcf8563 as rtc0


The rtc module is loaded and detected, in according with i2cdetect command:

Code: Select all
pi@raspberrypi ~ $ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- UU -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --



I don't know why rtc chip is not working. Is it necessary any configuration or the issue is with rtc chip (ex. low battery)?



1>
In '/etc/rc.local '.
Add the following lines, at the beginning, of the file:

echo pcf8563 0x68 > /sys/class/i2c-adapter/i2c-1/new_device
/sbin/hwclock -s

update-rc.d -f fake-hwclock remove
update-rc.d -f ntp remove

2 >
In the /etc/modules' file, which specifies the modules to be loaded at boot time,
ADD the rtc-pcf8563 Module, to be loaded during Kernel Initialization, after bootup:

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
# Parameters can be specified after the module name.

i2c-dev
i2c-bcm2708
rtc-pcf8563
snd-bcm2835

3>
After this, in the boottime parameters and bootargs of RaspberryPi, add the following argument:
rtc.i2c=pcf8563,1,0x68

In the file '/boot/cmdline.txt' in the Boot Partition,the above
lines would be added in the following way:
dwc_otg.lpm_enable=0 rtc.i2c=pcf8563,1,0x68 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1
root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

After, this power in the RTC pcf8563 circuit first using 3.3V battery, and after that
power up RaspberryPi.

Please, look into my Blog below for more detailed and elaborate Explanation:

http://blogsmayan.blogspot.in/p/adding.html

To Continue from ABOVE:
Next, we delete the current Timezone and update the Timezone using the below commands:

# rm -f /etc/localtime
# ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime

After, this set the Time, using 'date' command:
# date --set="2014-11-23 18:35:47"

and, update the HWClock using:
/sbin/hwclock --systohc

Now, check, the date and time using 'date' command:
#date

After, Date and Time has been set correctly, restart RaspberryPi.

Now, check the date and time, after restarting RaspberryPi.
#date


Thus, HOPE, it clears yours queries and doubts...
Thanks,
Rajiv.
Last edited by RBISWASX on Thu Jan 29, 2015 4:03 pm, edited 2 times in total.
Posts: 29
Joined: Thu Jan 09, 2014 5:30 pm
by itsmedoofer » Thu Jan 29, 2015 3:49 pm
All I can say is I did not need to compile my own kernel to use my ds1307 based RTC module.

The procedure above was done with a stock kernel and stock distribution.
Posts: 209
Joined: Wed Sep 25, 2013 8:43 am
by RBISWASX » Thu Jan 29, 2015 3:54 pm
itsmedoofer wrote:All I can say is I did not need to compile my own kernel to use my ds1307 based RTC module.

The procedure above was done with a stock kernel and stock distribution.


I know that.
I wanted to do away with #modprobe for my Project, and had to load, as soon as the Board bringup happened.
Also, i had to check with DS1338, DS1302 and DS1307 RTC Chips. Thus, i had to enable these Modules in the
Kernel and build the Kernel.
Posts: 29
Joined: Thu Jan 09, 2014 5:30 pm