You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AutoDiscoverRTCClock adopts any device that ACKs at an RTC address, then reads it as the clock and writes it on every sync #13
AutoDiscoverRTCClock::begin() adopts an RTC on an I2C ACK alone. Any other device that answers at one of the four RTC addresses becomes the node's clock. Its registers are then read as the time, and written on every time sync. Upstream has already hit this twice, and fixed each board by hand with DISABLE_DS3231_PROBE. The probe itself still has the defect for every other board and device.
Code references are at upstream dev3e3150c8. The libraries are at the versions MeshCore builds against: Adafruit RTClib 2.1.4 and Melopero RV3028 1.2.0.
The defect
begin() runs i2c_probe() for each RTC address, which only checks for an ACK. It then marks the chip found:
The clock is wrong.getCurrentTime() returns whatever the foreign device's registers decode to.
The foreign device gets written. Every sync overwrites its registers. Syncs come from the CLI clock and time commands, from app and peer timestamps, and from GPS every 30 minutes (TIME_SYNC_INTERVAL, L247).
The order makes it worse. The DS3231 is checked first and wins, so an IMU at 0x68 hides a real RTC elsewhere on the bus.
Address conflicts are ordinary:
0x68 is the default address of the common IMUs (MPU-6050, ICM-20948, ICM-42607).
0x50-0x57 is the 24-series I2C EEPROM range, which covers both 0x51 (PCF8563) and 0x52 (RV3028).
0908b034 "Fix: Do not misidentify IMU as an RTC on Heltec T1", and variants/heltec_t1/variant.h L11-L15: "the IMU gets misidentified as a DS3231 and its unrelated registers get read/written as if they were time/status registers, producing a bogus, unfixable clock."
Both opt-outs are per board, so any board not yet found still has the defect, and so does any device at the other three addresses.
Proposed fix
Adopt an RTC only if its time registers read like that RTC's. Each of these chips has bits that always read as 0 in its seconds-to-year registers, which its datasheet documents. A device that shows any of those bits set, on two reads, is not that chip, and is skipped. That covers an erased EEPROM reading 0xFF and an IMU's WHO_AM_I register. A failed read proves nothing, so it keeps today's behaviour. The existing DISABLE_DS3231_PROBE opt-outs stay. The fix and the per-chip masks, each cited from the vendor's datasheet, come in a separate PR.
Related: #10 / #11, the RV3028 EEPROM configuration fix. #11 gates only its own new EEPROM writes with the same kind of check for the RV3028. This issue is the pre-existing adoption defect for all four chips.
Activity
ptr727 commentedon Oct 4, 2026
Filed upstream as meshcore-dev#3546, proposed fix meshcore-dev#3544.