Différences entre versions de « RASP-PCF8523-Fixer-Heure »
Ligne 4 : | Ligne 4 : | ||
== Introduction == | == Introduction == | ||
− | + | Maintenant que nous avons un module RTC branché sur le Raspberry-Pi et que nous avons vérifié qu'il est bien présent sur le bus I2C (avec i2cdetect); nous pouvons configurer notre système pour qu'il exploite l'horloge RTC. | |
− | {{ambox-stop|text= | + | {{ambox-stop|text=Il est essentiel que la configuration I2C soit en ordre de fonctionnement. |
+ | |||
+ | Assurez-vous d'avoir complété le point précédent! }} | ||
== Raspbian Jessie (Systemd) == | == Raspbian Jessie (Systemd) == |
Version du 21 août 2017 à 20:03
En cours de traduction/élaboration. |
Introduction
Maintenant que nous avons un module RTC branché sur le Raspberry-Pi et que nous avons vérifié qu'il est bien présent sur le bus I2C (avec i2cdetect); nous pouvons configurer notre système pour qu'il exploite l'horloge RTC.
Il est essentiel que la configuration I2C soit en ordre de fonctionnement. Assurez-vous d'avoir complété le point précédent! |
Raspbian Jessie (Systemd)
You can add support for the RTC by adding a device tree overlay. Run
sudo nano /boot/config.txt
to edit the pi configuration and add whichever matches your RTC chip:
dtoverlay=i2c-rtc,ds1307
or
dtoverlay=i2c-rtc,pcf8523
or
dtoverlay=i2c-rtc,ds3231
to the end of the file
Crédit: AdaFruit Industries www.adafruit.com
Save it and run sudo reboot to start again. Log in and run sudo i2cdetect -y 1 to see the UU show up where 0x68 should be
Crédit: AdaFruit Industries www.adafruit.com
sudo apt-get -y remove fake-hwclock sudo update-rc.d -f fake-hwclock remove
Disable the "fake hwclock" which interferes with the 'real' hwclock
Crédit: AdaFruit Industries www.adafruit.com
Now with the fake-hw clock off, you can start the original 'hardware clock' script.
Run sudo nano /lib/udev/hwclock-set and comment out these three lines:
#if [ -e /run/systemd/system ] ; then # exit 0 #fi
Crédit: AdaFruit Industries www.adafruit.com
Fixer l'heure de la RTC
When you first plug in the RTC module, it's going to have the wrong time because it has to be set once. You can always read the time directly from the RTC with sudo hwclock -D -r
Crédit: AdaFruit Industries www.adafruit.com
You can see, the date at first is invalid! You can set the correct time easily. First run date to verify the time is correct. Plug in Ethernet or WiFi to let the Pi sync the right time from the Internet. Once that's done, run sudo hwclock -w to write the time, and another sudo hwclock -r to read the time
Crédit: AdaFruit Industries www.adafruit.com
Once the time is set, make sure the coin cell battery is inserted so that the time is saved. You only have to set the time once
That's it! Next time you boot the time will automatically be synced from the RTC module
Raspbian Wheezy ou autres systèmes pré-systemd
Si ce point vous intéresse en particulier, vous pouvez poursuivre votre lecture depuis la page "Raspbian Wheezy or other pre-systemd Linux"
Source: Adding real time clock to Rasberry-Pi
Tutoriel créé par Ada pour AdaFruit Industries. Tutorial created by Lady Ada for AdaFruit Industries
Traduit avec l'autorisation d'AdaFruit Industries - Translated with the permission from Adafruit Industries - www.adafruit.com
Toute référence, mention ou extrait de cette traduction doit être explicitement accompagné du texte suivant : « Traduction par MCHobby (www.MCHobby.be) - Vente de kit et composants » avec un lien vers la source (donc cette page) et ce quelque soit le média utilisé.
L'utilisation commercial de la traduction (texte) et/ou réalisation, même partielle, pourrait être soumis à redevance. Dans tous les cas de figures, vous devez également obtenir l'accord du(des) détenteur initial des droits. Celui de MC Hobby s'arrêtant au travail de traduction proprement dit.