-
1Configuring the RTC
To use the DS3231 RTC first add "i2c0" to overlays= in /boot/dietpiEnv.txt without quotes and separated by a space, for example:
overlays=usbhost2 usbhost3 i2c0
Create a systemd service to sync the system time automatically during the boot process. Create /etc/systemd/system/add-rtc.service and add the following:
[Unit] Description=Sync system time to RTC Requires=sysinit.target [Service] Type=oneshot ExecStart=/usr/bin/bash -c 'echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device' ExecStart=/bin/sleep 2 ExecStart=/sbin/hwclock -f /dev/rtc1 -s [Install] WantedBy=sysinit.target
Enable the service:
sudo systemctl daemon-reload sudo systemctl enable add-rtc
Use dietpi-config to disable the fake hardware clock and set time synchronization to custom.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.