darkmaterial
Posts: 2
Joined: Thu Oct 01, 2015 12:53 pm

RTC DS1307 Read Error

Thu Oct 01, 2015 2:03 pm

Hi everyone :)

i am trying to integrate an Ds1307 RTC to my Raspberry PI Project. I integrated it into the /boot/config.txt with the line :dtoverlay=rtc-i2c,ds1307. The Problem is that if i run hwclock -r most time i get hwclock:

Code: Select all

ioctl(RTC_RD_TIME) to /dev/rtc0 to read the time failed: Invalid argument
, sometimes i get: hwclock:

Code: Select all

 ioctl(RTC_RD_TIME) to /dev/rtc0 to read the time failed: Input/Output error
and sometimes i get the correct time. After a complete restart i sometimes get the error:

Code: Select all

hwclock: The Hardware Clock registers contain values that are either invalid (e.g. 50th day of month) or beyond the range we can handle (e.g. Year 2095).
until i rewrite the time with hwclock -w. I2C is working probably because of other devices that are on it. It ist also possible to read the clock with i2cdump with no problems, if dtoverlay is deactivated. Is anyone able to help me? Thank you :)

User avatar
MattHawkinsUK
Posts: 538
Joined: Tue Jan 10, 2012 8:48 pm
Location: UK
Contact: Website

Re: RTC DS1307 Read Error

Thu Oct 01, 2015 2:46 pm

Have you tried different batteries?

I had loads of problems with my DS1307. Some of which I think might have been down to the quality of the battery holder. I wrote a tutorial on it which I had to abandon because the devices were so unreliable. In the end I went for a DS3231 and instantly made more progress. The setup is the same but without the stress!
My Raspberry Pi blog and home of the BerryClip Add-on board : http://www.raspberrypi-spy.co.uk/
Follow me on Google+, Facebook, Pinterest and Twitter (@RPiSpy)

darkmaterial
Posts: 2
Joined: Thu Oct 01, 2015 12:53 pm

Re: RTC DS1307 Read Error

Thu Oct 01, 2015 2:57 pm

I measured the battery, it seems to be ok. It delivers about 3.8V to the Vbat pin on the Ds1307 Chip...

PiUser10
Posts: 12
Joined: Mon Dec 30, 2013 9:20 am

Re: RTC DS1307 Read Error

Thu Oct 01, 2015 3:24 pm

Check out this thread viewtopic.php?p=692662#p692662
for a possible fix, had the same issue earlier today but after working through the above all is working fine now.
Hope it also solves your problem.

Return to “Interfacing (DSI, CSI, I2C, etc.)”