OpenSprinkler › Forums › Hardware Questions › OpenSprinkler Pi (OSPi) › DS1307 W RPI Wheezy Softfloat
- This topic is empty.
-
AuthorPosts
-
March 22, 2013 at 6:52 pm #22376
pauldyParticipantI have the OpenSprinkler PI setup at home and tried to get the RTC working. I can see it registered on the i2c bus and the appropriate kernel modules are loaded but I can’t seem to read the clock. Any pointers? I’ve included what I believe to be relevant output to show what I’m able to see here.
#i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
#lsmod
Module Size Used by
bnep 10514 2
rfcomm 33663 0
bluetooth 157711 10 rfcomm,bnep
binfmt_misc 6888 1
snd_bcm2835 12808 0
snd_pcm 74834 1 snd_bcm2835
snd_seq 52536 0
snd_timer 19698 2 snd_seq,snd_pcm
snd_seq_device 6300 1 snd_seq
snd 52489 5 snd_seq_device,snd_timer,snd_seq,snd_pcm,snd_bcm2835
snd_page_alloc 4951 1 snd_pcm
rtc_ds1307 6710 0
i2c_dev 5587 0
spidev 5136 0
8192cu 485042 0
i2c_bcm2708 3681 0
spi_bcm2708 4401 0
#hwclock -r
hwclock: ioctl(RTC_RD_TIME) to /dev/rtc0 to read the time failed: Invalid argument
#cat /sys/class/rtc/rtc0/time
cat: /sys/class/rtc/rtc0/time: Invalid argument
March 23, 2013 at 3:50 pm #23445
RayKeymasterA while back Dan in CA sent me some instructions on how to use RTC with RPi. I tried and they seem to work. I’m posting his instructions here, hope these help:
FYI
after a few different iterations, here are the settings I used to access the RTC:1. added following lines to /etc/modules (sudo nano /etc/modules)
i2c-bcm2708
rtc-ds1307
2. added following line to /etc/rc.local
echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device3. Reboot
must be root or use sudo: hwclock -r to read clock.
set the hardware clock from the current system time: hwclock -w
set the system time from the hardware clock: hwclock -sFollowing up on the RTC stuff:
You must ‘sudo -s’ before you can set the RTC.
March 23, 2013 at 3:54 pm #23446
RayKeymasterAnother useful resource is the RTC for RPi tutorial by adafruit:
http://learn.adafruit.com/adding-a-real-time-clock-to-raspberry-pi/overviewMarch 23, 2013 at 4:43 pm #23447
pauldyParticipantI actually figured it out late last night. According to the man page it doesn’t really make sense the -s is supposed to sync the system clock form the hwclock but the following is form my terminal session and it solved the invalid argument. I really just ran these out of desperation as I had already been poking around reading the NVRAM on the ds1307 and knew it was at least communicating with the device.
hwclock: ioctl(RTC_RD_TIME) to /dev/rtc0 to read the time failed: Invalid argument
#hwclock -w
hwclock: ioctl(RTC_RD_TIME) to /dev/rtc0 to read the time failed: Invalid argument
#hwclock -s
#hwclock -r
Sat 22 Mar 2013 11:34:45 PM CDT -0.925138 seconds
#cat /sys/class/rtc/rtc0/time
4:34:49
-
AuthorPosts
- You must be logged in to reply to this topic.
OpenSprinkler › Forums › Hardware Questions › OpenSprinkler Pi (OSPi) › DS1307 W RPI Wheezy Softfloat