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

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,852
  • 5
  • 76
  • 108
0

Use:

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