Skip to content

Fix I2C RTC on rak3x72 variant #2836

Description

@MoLeKni

The rak3x72 variant does not read an attached I2C RTC such as the RAK12002. It never starts the I2C bus, and has the RTC begin() call commented out. Tested the following modified version of v1.16. repeater FW on a RAK 3372 with a RAK12002 RTC attached. It Mirrors the rak4631 variant's approach. Without RTC it falls back to VolatileRTCClock.

Suggested fix

in variants/rak3x72/target.h

  • add #include <helpers/AutoDiscoverRTCClock.h>
  • change extern VolatileRTCClock rtc_clock;extern AutoDiscoverRTCClock rtc_clock;

in variants/rak3x72/target.cpp

  • replace the single VolatileRTCClock rtc_clock; with VolatileRTCClock fallback_clock; and AutoDiscoverRTCClock rtc_clock(fallback_clock);
  • in radio_init(), add Wire.begin(); and uncomment rtc_clock.begin(Wire);
--- a/variants/rak3x72/target.h
+++ b/variants/rak3x72/target.h
@@ includes @@
   #include <helpers/ArduinoHelpers.h>
+  #include <helpers/AutoDiscoverRTCClock.h>
   #include <helpers/SensorManager.h>
@@ externs @@
-  extern VolatileRTCClock rtc_clock;
+  extern AutoDiscoverRTCClock rtc_clock;

--- a/variants/rak3x72/target.cpp
+++ b/variants/rak3x72/target.cpp
@@ globals @@
-  VolatileRTCClock rtc_clock;
+  VolatileRTCClock fallback_clock;
+  AutoDiscoverRTCClock rtc_clock(fallback_clock);
@@ radio_init() @@
   bool radio_init() {
-  //  rtc_clock.begin(Wire);
+    Wire.begin();
+    rtc_clock.begin(Wire);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions