docs: BUG-18 plan — DS3231 (I²C) + SIM868 CR1220 RTC backup

This commit is contained in:
Mathieu Moran
2026-08-13 16:13:51 -04:00
parent f94c50b2ee
commit c44026e511
2 changed files with 15 additions and 4 deletions
+13 -3
View File
@@ -38,9 +38,19 @@ When CLOSED, move the entire entry to Resolved — don't duplicate.
- **Phase**: 29
- **Problem**: the Pi 3 has no real-time clock. Without internet (no NTP) the system clock
is wrong across power cycles, corrupting tracking/trip timestamps (BUG-16/BUG-17).
- **Fix direction**: add a battery-backed RTC (DS3231) on I²C so time survives power-off,
and/or derive time from the SIM868 GNSS fix (GPS time) while offline. Keep
`systemd-timesyncd` for online sync and fall back to the RTC/GNSS source when offline.
- **Fix plan (both, they complement each other)**:
1. **DS3231 RTC module (primary)** — battery-backed RTC on the free I²C bus (SDA pin 3,
SCL pin 5, 3.3V pin 1, GND pin 6). Enable `dtparam=i2c_arm=on` +
`dtoverlay=i2c-rtc,ds3231` in `/boot/firmware/config.txt`, install `i2c-tools`, disable
`fake-hwclock`. Use a **CR2032** and first **desolder the module's charging resistor +
diode** (cheap ZS-042-style boards charge the coin cell — unsafe for a CR2032; the
well-known DS3231 charging-circuit issue). Gives correct time instantly at boot, ±2 ppm.
2. **SIM868 CR1220 RTC backup (secondary)** — the HAT has a CR1220 holder on the back
(item 20). A CR1220 keeps the SIM868's internal RTC alive across power-off, enabling
faster GNSS warm starts and letting the Pi optionally read the module time at boot
(`AT+CCLK`) as an offline fallback.
- Keep `systemd-timesyncd` for online NTP; fall back to the RTC (DS3231) and optionally
GNSS time when offline.
---