Since the RaspberryPi always connects to balenaCloud (and I assume it syncs the time with the server), it is quite difficult to know if the time is taken from the RTC or from NTP.
At least hwclock on the host OS is giving me this error (which lets me assume it is not enabled):
root@<id>:~# hwclock -r
hwclock: can't open '/dev/misc/rtc': No such file or directory
I think you would need to set for your device RESIN_HOST_CONFIG_dtoverlay (or BALENA_HOST_CONFIG_dtoverlay supported on newer OS versions) to "i2c-rtc,ds1307", which enables the i2c-rtc interface and that specific RTC driver…
Could you give this a try, and let us know how it goes?
Now to the first part of my question above: does this mean, chronyd will use the RTC when the device doesn’t have connection to the balenaCloud? Is there a way for me to verify this?
Unfortunately the linked documentation does not mention an external (I2C) RTC at all. My assumption is, that it will work because systemd-timesyncd manages everything and will also use the external RTC.
But I guess, I will have to test the entire setup on a separate disconnected network using a development build and SSH to 22222.
How would this work with other overlays already defined? Just getting started with my project but according to what I read I had to set RESIN_HOST_CONFIG_dtoverlay = pi3-miniuart-bt so that the serial port would work (currently reading from a sensor). I tried adding a second entry for the 'i2c-rtc,ds3231" but as expected it gave an error message saying the environment variable was already defined. Is there a way to combine the two entries in one overlay or what is the proper way of doing this?
Just a FYI for anyone else stumbling in here - if you have additional dtoverlay parameters you should group these two together separately. For example, note how I’ve separated the touch screen parameters:
I couldn’t get the hwclock to return with the time until separating them in this fashion, as opposed to stringing it all together without quotes. Also just to point out I’m using a different clock so replace ds3231 with whatever chip you’re using.