Skip to content

feat(hal): GPS PPS timestamp sync via lgw_gps_* for SX1303#66

Open
iceice400 wants to merge 4 commits into
KMX415:mainfrom
iceice400:feat/gps-pps-hal-sync
Open

feat(hal): GPS PPS timestamp sync via lgw_gps_* for SX1303#66
iceice400 wants to merge 4 commits into
KMX415:mainfrom
iceice400:feat/gps-pps-hal-sync

Conversation

@iceice400
Copy link
Copy Markdown
Contributor

Summary

Follow-up to #65: adds Semtech HAL GPS/PPS bindings so the SX1302/SX1303 concentrator can align internal packet timestamp_us with GPS time on RAK Pi HATs (u-blox on /dev/ttyAMA0, PPS into the concentrator).

This is orthogonal to location.source: uart / gpsd, which only feed dashboard coordinates and NodeInfo.

Changes

HAL (src/hal/)

  • sx1302_gps_types.pyTimespecS, TrefS, CoordS, GPS message constants.
  • sx1302_gps_signatures.py + apply_gps_signatures() from apply_signatures().
  • sx1302_gps.pyHalGpsPpsSync: lgw_gps_enable, background UBX/NMEA parser, lgw_gps_sync on UBX-NAV-TIMEGPS, sx1302_gps_enable, optional lgw_cnt2utc.
  • SX1302Wrapper.start_gps_pps() / stop_gps_pps(); ConcentratorCaptureSource starts PPS after lgw_start() when configured.

Config

  • radio.gps_pps_enabled, gps_pps_tty_path, gps_family, gps_pps_target_baud.
  • validate_config_consistency() rejects gps_pps_enabled + location.source: uart on the same TTY.

API

  • GET /api/device/gps-pps-status — sync count, last error, reference counter.
  • radio_advanced in GET /api/config exposes PPS fields.

Docs

  • CONFIGURATION.md — GPS PPS section + uart/PPS matrix.
  • docs/plans/gps-pps-follow-up-issue.md — issue template for trackers.

Why

#65 fixed lgw_start() on RAK/SX1303 and wired UART for map GPS. Operators running SX1303 with PPS still need concentrator-time alignment for accurate packet timestamps — that path lives in lgw_gps_*, not in NMEA GGA parsing.

Operator notes

Need Config
Live map from HAT UART location.source: uart, gps_pps_enabled: false
PPS timestamps + USB gpsd map location.source: gpsd, gps_pps_enabled: true
PPS only, fixed coords location.source: static, gps_pps_enabled: true

Requires libloragw built with loragw_gps.c. If symbols are missing, Meshpoint logs once and continues without PPS.

Type

  • Feature
  • Hardware change
  • Docs
  • Bug fix
  • UI (status API only; no dashboard card in this PR)

Testing

  • Local unit tests
  • Tested on RAK hardware (needs reviewer / field)
python -m unittest tests.test_hal_gps_pps tests.test_sx1302_wrapper_hal_guard -v

Depends on

Closes

@iceice400 iceice400 force-pushed the feat/gps-pps-hal-sync branch from 2033516 to 7861cd1 Compare June 6, 2026 03:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant