I am using beagle Bone Black with debian image. Could any please suggest how to automatically set the system time (on every reboot) by external RTC module DS3231. Once internet is connected, i want to update both system time and DS3231 with the network time.
I am controlling a relay based on system time, my application should take DS3231 time and run perfectly even if internet is disconnected and not available for so many days.
Few things i have tried, the following content has been kept in the script and running @reboot script in crontab. The system time has been changed if we enter this command manually after boot but not in auto start script. Please advice.
echo ds3231 0x68 > /sys/class/i2c-adapter/i2c-1/new_device
hwclock -r -f /dev/rtc1