Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Determine RTC is valid on boot #144

Open
neilh10 opened this issue Jul 31, 2023 · 0 comments
Open

Determine RTC is valid on boot #144

neilh10 opened this issue Jul 31, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@neilh10
Copy link
Owner

neilh10 commented Jul 31, 2023

The system needs to have a traceable wall time when it starts up.
On most hardware this is a piece of hardware RTC
On the Mayfly this is supplied with a hardware RTC DS3231 powered from a separate CR1220 battery. Its specification is to maintain time to +/- 2minutes per year, across potential real world temperature ranges -40C to +85C.
But how to know if the time in the RTC wall time is valid?
If the RTC is not valid, then the logging system should not start until a valid time is derived by connecting to a NIST time source.
If the RTC time is valid, (which could be the majority of cases) then the logging system can start - and normal audits performed to collect good time.

DS3231 data sheet has On the first application of power (VCC) or when a valid I2C
address is written to the part (VBAT), the time and date registers are reset to 01/01/00 01 00:00:00 (DD/MM/YY
DOW HH:MM:SS)
Status Register (0Fh)
Bit 7: Oscillator Stop Flag (OSF). A logic 1 in this bit indicates that the oscillator either is stopped or was stopped for some period and may be used to judge the validity of the timekeeping data.
This bit is set to logic 1 any time that the oscillator stops.
The following are examples of conditions that can cause the OSF bit to be set:

  1. The first time power is applied.
  2. The voltages present on both VCC and VBAT are insufficient to support oscillation.
  3. The EOSC bit is turned off in battery-backed mode.
  4. External influences on the crystal (i.e., noise, leakage,
    etc.).
    This bit remains at logic 1 until written to logic 0.

Sending an old time to a MMW server can cause it to access old time records that have been compressed, placing a lot of load on the server. WikiWatershed/monitor-my-watershed#665

@neilh10 neilh10 added the enhancement New feature or request label Jul 31, 2023
@neilh10 neilh10 self-assigned this Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant