Aus irgendeinem Grund funktioniert die RTC DS1307 nicht.
Die beiden Widerstände zu R2 und R3 (zu SDA und SCL) wurde entfernt.
Anschluß der RTC
PHP
#---------------------------#
| RPI GPIO | RTC P1 |
|--------------|-----------|
|Pin 2 5V | VCC |
|Pin 3 SDA | SDA |
|Pin 5 SCL | SCL |
|Pin 6 GND | GND |
#--------------------------#
[/php]
Folgende Konfiguration wurden durchgeführt:
sudo raspi-config
Advanced Options I2C Enable Yes
sudo apt-get install i2c-tools
sudo nano /etc/modprobe.d/raspi-blacklist.conf
# blacklist spi-bcm2708
# blacklist i2c-bcm2708
sudo nano /etc/modules
snd-bcm2835
i2c-bcm2708
i2c-dev
rtc-ds1307
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: 50 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
sudo chmod -R a+w /sys/class/i2c-adapter/i2c-1/
sudo chmod 755 /dev/rtc
sudo nano /etc/rc.local
echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device
sudo hwclock -s
Und nach diesem Format setzte ich die Uhrzeit
sudo hwclock --set --date="MM/TT/JJJJ HH:MM:SS"
Nach der Konfiguration bekomme ich aber die Adresse 0x68 nicht mehr sondern UU
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: 50 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
Unter FHEM ist es ähnlich
[code]
####################################
define RPiI2C_1 RPII2C 1
attr RPiI2C_1 alias I²C Schnittstelle
attr RPiI2C_1 devStateIcon Ok:it_net@green initialized:it_net@yellow disconnected:it_net@red error:it_net@red
define RTC I2C_DS1307 104
attr RTC IODev RPiI2C_1
attr RTC alias Echtzeituhr
attr RTC poll_interval 300
attr RTC stateFormat datetime
attr RTC verbose 5
Alles anzeigen
Hier läst sich die Zeit nicht setzten und die I²C Schnittstelle gibt eine error Meldung.
LOG
Code
2016.09.16 10:17:03 3: RPiI2C_1: HWaccess (0x68) ioctl failure: Das Gerät oder die Ressource ist belegt
2016.09.16 10:22:03 3: RPiI2C_1: HWaccess (0x68) ioctl failure: Das Gerät oder die Ressource ist belegt
2016.09.16 10:27:03 3: RPiI2C_1: HWaccess (0x68) ioctl failure: Das Gerät oder die Ressource ist belegt
2016.09.16 10:29:49 1: PERL WARNING: Use of uninitialized value in split at ./FHEM/52_I2C_DS1307.pm line 179.
2016.09.16 10:29:49 1: PERL WARNING: Use of uninitialized value in subroutine entry at ./FHEM/52_I2C_DS1307.pm line 320.
2016.09.16 10:29:49 1: PERL WARNING: Use of uninitialized value in localtime at ./FHEM/52_I2C_DS1307.pm line 282.