Skip to content

RTC probe: field checks skip real RTCs, and only the RV3028 has an identity mask #38

Closed

Description

@ptr727

rtc_probe() (dev f9d01cf) decides whether the device at a declared address is the RTC it expects. Three of its checks can skip a real RTC, and only one chip type is checked for the bits that would rule a device out. MeshCore's equivalent work, meshcore-dev/MeshCore#3544 (issue meshcore-dev/MeshCore#3546), grounds every rule in the vendor documents. This issue applies the same rules to ZephCore.

What is wrong

Proposed rules (as meshcore-dev/MeshCore#3544)

  1. A per-descriptor always-zero mask for the seven time registers:
    • DS3231 {80,80,80,F8,C0,60,00}: Maxim DS3231 19-5170 Rev. 10, Figure 1, p. 11.
    • RV3028 {80,80,C0,F8,C0,E0,00}: RV-3028-C7 Application Manual Rev. 1.4, §3.2, p. 12.
    • RX8130CE {80,80,C0,80,C0,E0,00}: Epson ETM50E-10, §13.2.1, Table 12, p. 22.
    • PCF8563: none.
  2. All seven bytes reading 0xFF (an erased EEPROM), as today.
  3. Seconds, minutes, date and month valid BCD in range, unless the power-loss flag is set. Never check the year or the hours.
  4. A device is ruled out only on two reads that agree; a failed read never rules it out.

#35 refuses an RV3028 only when the same register shows an always-zero bit on both reads. meshcore-dev/MeshCore#3544 accepts two reads that rule the device out for different reasons. Both need two consecutive corrupted reads to misfire; this issue should state which it uses.

Hardware to test on

The second RAK4631 on this host carries two extra I2C modules, including an LPS22HB at 0x5C and a Bosch environment sensor at 0x76. meshcore-dev/MeshCore#3544's read-only test there found the LPS22HB passes the DS3231 rule (its WHO_AM_I value sits where OSF lives), which is a limit of flag-based identity.

Refs meshcore-dev/MeshCore#3544, #34, #35

Activity

  1. ptr727 commented on Oct 10, 2026

    @ptr727
    OwnerAuthor

    Fixed upstream by liquidraver#99, merged 2026-10-05: per-descriptor always-zero masks for DS3231, RV3028 and RX8130CE (none for the PCF8563), identity checks only seconds, minutes, date and month and never the year or hours, all-0xFF is skipped, and a device is ruled out only when two reads each rule it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions