nuttx-apps/system/ptpd
Daniel P. Carvalho d9cb21d909 netutils/ptpd: fix drift divergence and post-jump bootstrap
1. Post-jump drift bootstrap: on the first Sync packet following a step
   jump, do not compute frequency drift against a synthesized zero delta,
   which previously caused the entire residual phase offset (~ms) to be
   mistaken for frequency drift (~million ppb) and immediately absorbed.
2. Drift rate formula: normalize the adjustment contribution by the actual
   measurement interval instead of the adjtime slew period, and compute
   natural delta rate as (delta - last_delta + last_adjtime) / interval.
3. Remove broken last_delta > delta comparison that prevented offsets from
   converging and applied inverted corrections on negative overshoots.
4. Correct ptp_adjtime() invocation to always pass adjustment_ns for
   CLOCK_REALTIME slewing rather than dropping drift compensation when
   delta exceeds threshold. Clamp adjustment_ns to the hardware slew limit
   so last_adjtime_ns accurately mirrors the true slew applied.
5. Enable Delay_Req in E2E mode once clock is tracking (not jumping) and
   allow software timestamping latency in ptp_process_delay_resp().
6. Propagate initialization return code from ptpd_start() and avoid
   unconditional failure print in do_ptpd_start().

Assisted-by: Claude:claude-sonnet-5
Assisted-by: Gemini:gemini-3.8-flash-medium
Signed-off-by: Daniel P. Carvalho <danieloak@gmail.com>
2026-09-15 09:09:00 -03:00
..
CMakeLists.txt system: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
Kconfig system/ptpd/Kconfig: cosmetics 2023-10-23 22:26:13 +08:00
Make.defs system: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
Makefile system: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
ptpd_main.c netutils/ptpd: fix drift divergence and post-jump bootstrap 2026-09-15 09:09:00 -03:00