Skip to content

RAK4631 GPS Time Sync Issue 1.15 #2359

Open

Description

@sledzik1984

Hi!

Few days ago I've added GPS module to one of my repeaters (RAK4631).
Firmware version: 1.15

Device sees GPS module but doesn't sync clock to GPS time

gps on
OK
gps
on, active, fix, 19 sats

gps sync
OK

After issuing gps sync command device says OK but actual time doesn't change.

Activity

  1. cwichura commented on Apr 22, 2026

    @cwichura

    gps sync does not immediately update the clock. It just sets a flag that is only checked periodically in the NMEA processor loop. It also needs three consecutive good fix reads before it will update the clock from GPS as well. So give it a bit and then check the clock.

  2. nsa-hq commented on Jun 5, 2026

    @nsa-hq

    gps sync does not immediately update the clock. It just sets a flag that is only checked periodically in the NMEA processor loop. It also needs three consecutive good fix reads before it will update the clock from GPS as well. So give it a bit and then check the clock.

    That doesn't work for me. I have a RAK4631 with the GPS module and I just ran a test of the gps sync and it's still showing the boot-up clock time plus one hour now. Below is a reprint of the commands I entered and the replies I received.

    ver
    v1.15.0-dee3e26 (Build: 19-Apr-2026)
    clkreboot
    gps
    on, active, fix, 18 sats
    clock
    11:00 - 15/5/2024 UTC
    gps sync
    ok
    clock
    11:00 - 15/5/2024 UTC
    clock
    12:01 - 15/5/2024 UTC

    I finally entered the 'clock sync' command and now the repeater is showing today's date (6/5/2026 UTC) and the correct time. So the clock doesn't appear to pull time from the gps at all, unless I'm missing something.

    Any help or suggestions would be appreciated. Thanks!

  3. ik1iyu commented on Jun 16, 2026

    @ik1iyu

    Hi!
    I have the same behavior on my Heltec T114 repeater since fw v1.15 and now v1.16.

    GPS module running ok, but gps sync command has no effect.

    Thank you.

  4. LennertVA commented on Jun 17, 2026

    @LennertVA

    Same behaviour here. Heltec T114, currently 1.15. Active GPS with fix and 15+ sats. After 10+ hours the clock is still on 2024. gps sync does not sync it. clock sync does.

  5. IoTThinks commented on Jul 25, 2026

    @IoTThinks
    Contributor

    "gps sync" only sets a flag to push the GPS trying to get time sync.
    It may take a while to get time sync.
    Please note, you need to put the GPS module OUTDOOR or at least besides the windows in clear sky.

    It works on my variant and it should work on your MeshCore 1.16 too.
    If MeshCore 1.16 doesnt, try this and use CLI "powersaving on", then "gps on" then "gps" to see the last sync.
    You may force synce "gps sync".

    I have tested RAK4631 and RAK12501 (L76K).
    https://github.com/IoTThinks/EasySkyMesh/releases/tag/PowerSaving16.1

  6. rinodods commented on Aug 10, 2026

    @rinodods

    On RAK WisBlock boards (RAK 4631, RAK 4631, etc.) with a RAK12500 I2C GPS module, gps sync returns OK but the system clock never updates from the boot default (May 2024). GPS position data works correctly.

    Root Cause
    EnvironmentSensorManager::gpsIsAwake() detects the RAK12500 via I2C and swaps _location from MicroNMEALocationProvider to RAK12500LocationProvider. The NMEA provider has full clock sync logic, but the RAK12500 provider had none — it read GPS epoch data but never wrote it to the RTC clock. Additionally, the RTC clock reference was stored only in the NMEA provider and lost during the swap.

    The RAK12500's ublox_GNSS.getUnixEpoch(2) can also return garbage values before GPS time is fully initialized, even though getGnssFixOk(8) (position fix) returns true. Position lock happens faster than time sync on the u-blox, so raw epoch values must be validated before use.

    This affects all RAK boards using the RAK12500 I2C GPS (tracked in issues #2359 and #2786).

    Changes

    1. LocationProvider.h: Moved _clock from individual providers to the base class with setClock()/getClock() accessors. This allows the clock reference to survive provider swaps.

    2. MicroNMEALocationProvider.h: Removed its own _clock member; now uses the inherited base class _clock via setClock().

    3. EnvironmentSensorManager.cpp:

    • RAK12500LocationProvider::loop() now syncs GPS epoch to the RTC clock when _time_sync_needed is true
    • Requires 3 consecutive valid fix readings before writing clock (matching NMEA provider behavior)
    • Epoch must be monotonically increasing between loop iterations (rejects static garbage from uninitialized GPS)
    • Auto-re-sync every 30 minutes when GPS has a valid fix
    • gpsIsAwake() saves the clock reference from the original provider before swapping to RAK12500_provider and passes it via setClock()
  7. github-actions commented on Nov 2, 2026

    @github-actions
    Contributor

    This issue is stale because it has been open for 60 days with no activity. Remove the stale label or add a comment if this issue is still relevant, otherwise this issue will automatically close in 7 days.

  8. bcdouglas commented on Nov 14, 2026

    @bcdouglas

    Ping. Someone with the know-how, please fix.

  9. recrof commented on Nov 14, 2026

    @recrof
    Member

    @fdlamotte does your refactor touch this issue?

  10. fdlamotte commented on Nov 14, 2026

    @fdlamotte
    Collaborator

    I've had no feedback from people using rak12500 (I don't (can't)) even know if gps still works on those devices while doing the refactor ... (I've asked for tester through github PR and in discord)

    The old path has not been changed, and I've just verified, there is nothing in RakLocationProvider that deals with time sync (it will work for nmea version because all the calls are forwarded to NMEALocationProvider)

    If we are testers here. First please report if GPS works with latest changes ... then I'll propose an implementation for time syncing

  11. fdlamotte commented on Nov 14, 2026

    @fdlamotte
    Collaborator

    there is also a gps guard provided by @AlexandrTyshchenko that is not applied to Rak I2C gps ... but as the rak12500 is EOL, I would rather provide minimal support ... time sync is needed though

  12. fdlamotte commented on Nov 14, 2026

    @fdlamotte
    Collaborator

    Well ... it should be as simple as #3843

    Please someone with a rak board and I2C gps, test this and report if it work ...

    It would both confirm that GPS refactor didn't break those gps and that the sync is ok

    edit: adding a repeater firmware for 4631 built against dev+PR

    firmware.zip

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions