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?

10
  • 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, 2016 at 8:47
  • @joan: Added the details requested.
    – Dr.Viper
    Sep 29, 2016 at 9:08
  • Possible duplicate of real time clock puzzle with new rasbian jessie
    – Milliways
    Sep 29, 2016 at 10:33
  • @Milliways: But there, he is getting a response with sudo hwclock. Here, I am not.
    – Dr.Viper
    Sep 29, 2016 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, 2016 at 10:42

2 Answers 2

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.

1
  • The “hwclock -s” added to “rc.local” sets the system time from the RTC module May 6, 2020 at 16:58
0

Use:

sudo hwclock -r
sudo hwclock -w
3
  • 3
    Kindly provide a brief outline of what these commands do. :)
    – tlhIngan
    Feb 23, 2017 at 7:16
  • Also, explain how this addresses the problem. Feb 23, 2017 at 7:23
  • 1
    On Raspberry Pi 3, sudo hwclock -r says hwclock: Cannot access the Hardware Clock via any known method. hwclock: Use the --verbose option to see the details of our search for an access method.
    – Algoman
    Nov 20, 2020 at 12:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.