Open main menu

Changes

X728-script

1,558 bytes removed, 00:54, 23 July 2023
===Set and Read the RTC time===
PS: We only test this step on Raspberry Pi OS; 1. To enable RTC module, first add <code>dtoverlay=i2c-rtc,ds1307</code> Refer to /boot/config.txt under [all] or the end of file and reboot: sudo nano /boot/config.txtSave and exit. In nano, you do that by hitting CTRL + X, answering Y and hitting Enter when prompted. 2. Run the commands [How to disable the "fake hwclock" which interferes with the 'real' hwclock sudo apt-get -y remove fake-hwclock sudo update-rc.d -f fake-hwclock remove sudo systemctl disable fake-hwclock3. Then run the following command to comment out 7-12 line in file <code>/lib/udev/hwclock-set</code>: sudo nano /lib/udev/hwclock-set<!-- [[File:X728-7.png|noneenable RTC]] --><syntaxhighlight lang="python" line highlight="7-12">#!/bin/sh# Reset the System Clock to UTC if the hardware clock from which it# was copied by the kernel was in localtime. dev=$1 #if [ -e /run/systemd/system ] ; then# exit 0#fi##/sbin/hwclock --rtc=$dev --systz#/sbin/hwclock --rtc=$dev --hctosys?</syntaxhighlight> PS: Inserting a `# `at the beginning of a line means to comment the line 4. Reboot the Raspberry Pi sudo reboot5. Run the command to verify the time is correct. Plug in Ethernet or WiFi to let the Pi sync the right time from the Internet date6. Run the command to write the time sudo hwclock -w7. Run the command to read the time sudo hwclock -rOnce the time is set, make sure the batteries are 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 shield.
==Support==