2

I have done almost everything from numerous tutorials to get the RTC to work, but when I run sudo hwclock -r, i still get the following error.

hwclock: Cannot access the Hardware Clock via any known method. hwclock: Use the --debug option to see the details of our search for an access method.

My sudo i2cdetect -y 1 is detecting the RTC DS3231 as below:

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: -- -- -- -- -- -- -- 57 -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                 

EDIT: What I have done till now

Connected the RTC to the RasPi 3. Enabled i2c in sudo raspi-config

My /etc/modules is now

snd-bcm2835
i2c-bcm2835
i2c-bcm2708
i2c-dev
rtc-ds1307

Added the following lines to /boot/config.txt

# Support for rtc ds3231
dtoverlay=i2c-rtc,ds3231
dtoverlay=i2c-rtc,ds1307
dtparam=i2c_arm=on
dtparam=i2c1=on
device_tree=

My /etc/rc.local has the following lines

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

But i do get an INVALID ARGUMENT ERROR when i run sudo echo ds3231 0x68 > /sys/class/i2c-adapter/i2c-1/new_device.

At the end, sudo hwclock or hwclock gives the error : hwclock: Cannot access the Hardware Clock via any known method. hwclock: Use the --debug option to see the details of our search for an access method.

Can somebody suggest me on a fix for this.

EDIT:

Tried the fix suggested on a fresh install of NOOBS v1.9.2 after sudo apt-get update and sudo apt-get dist-upgrade

Same issue remain.enter image description here

ADDED on 03.Oct.2016

As per inputs from joan and Milliways, I have added dtoverlay=i2c-rtc,ds3231 only, and got the hwclock to give date and time, bu the problem is that hwclock runs like internal clock now, it doesn't keep time across reboots.

Any inputs?

Dr.Viper
  • 209
  • 2
  • 7
  • 1
    Could you edit your question and include the details of what you have done. Please don't point to a tutorial, give the salient details. – joan Sep 29 '16 at 08:47
  • @joan: Added the details requested. – Dr.Viper Sep 29 '16 at 09:08
  • @Milliways: But there, he is getting a response with sudo hwclock. Here, I am not. – Dr.Viper Sep 29 '16 at 10:35
  • The real problem is you followed a number of (probably uninformed) tutorials - which you have not detailed, so we can't guess what. Undo all of that (or restore image before it was modified) and apply the single line solution. You are getting no response because you have disabled Device Tree. @joan is correct, but this is just a variant of the question, complicated because you have done lots of other "stuff". – Milliways Sep 29 '16 at 10:42
  • I just connected up a 3231 and it works fine with the dtoverlay=i2c-rtc,ds3231=1 line. sudo hwclock -r gave Thu 29 Sep 2016 11:48:27 BST -0.607987 seconds. dmesg|grep rtc gave [4.791545] rtc-ds1307 1-0068: SET TIME! [4.793978] rtc-ds1307 1-0068: rtc core: registered ds3231 as rtc0. – joan Sep 29 '16 at 10:53
  • Thanks for the inputs: joan and Milliways. Both of you are correct. I have tried too many tutorials one after the other, and that is complicating my situaiton.

    Due to power interruption, the device now blinks GREEN LED once on boot, and I think i have to reload the SD Card. I will correct that, and test with the oneline solution, and give an update by tomorrow. Thank you for the suggestions.

    – Dr.Viper Sep 29 '16 at 11:00
  • Performed a fresh install of NOOBS v1.9.2 and then did a sudo apt-get update && dist-upgrade.

    Then added just dtparam=i2c_arm=on dtoverlay=i2c-rtc,ds3231 to /boot/config.txt.

    Same error continues. hwclock: Cannot access the Hardware Clock via any known method. hwclock: Use the --debug option to see the details of our search for an access method.

    – Dr.Viper Sep 30 '16 at 17:04
  • What does i2cdetect -y 1 report? – joan Sep 30 '16 at 17:36
  • It shows below:

    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: -- -- -- -- -- -- -- 57 -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --

    – Dr.Viper Oct 01 '16 at 07:51

2 Answers2

3

You should be using device tree now.

I suggest the following changes.

Remove the following lines from `/etc/modules'

snd-bcm2835
i2c-bcm2835
i2c-bcm2708
rtc-ds1307

I.e. /etc/modules should only contain

i2c-dev

Remove the following line from /etc/rc.local

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

I'm not sure if hwclock -s is needed or not.

Remove the following lines from /boot/config.txt

# Support for rtc ds3231
dtoverlay=i2c-rtc,ds1307
dtparam=i2c1=on
device_tree=

I.e. of those lines only leave

dtparam=i2c_arm=on
dtoverlay=i2c-rtc,ds3231

See /boot/overlays/README for general information.

joan
  • 71,024
  • 5
  • 73
  • 106
0

Use:

sudo hwclock -r
sudo hwclock -w
tlhIngan
  • 3,372
  • 5
  • 19
  • 33