Repository navigation
M3C.4: compensate GPTimer START setup latency against PTP second - #229
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
2026-10-17 user-provided AUTO bench-capture checkpoint (isolated ASIX/Npcap, raw file retained by operator, not attached publicly): classic PCAP SHA-256 Diagnostic host-relative circular phase between captured canonical This PR addresses one concrete defect in the experimental first epoch arm: previously scheduled timer delay failed to subtract time spent configuring GPTimer. It does not guarantee a zero-offset physical phase, enable |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 66413ba420
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const std::int64_t pre_arm_us = esp_timer_get_time(); | ||
| const auto corrected_arm = epoch_arm.has_value() && pre_arm_us >= 0 | ||
| ? rebase_sv_ptp_second_arm( | ||
| epoch_arm->timer, epoch_arm->clock_read_after_us, | ||
| static_cast<std::uint64_t>(pre_arm_us)) |
There was a problem hiding this comment.
Move the rebase timestamp past the final lease check
When the final lease snapshot takes time or this task is preempted, remaining is computed from pre_arm_us before read_ptp_epoch_clock_lease(), while the GPTimer countdown starts only after that read and the subsequent alarm/enable calls. That unaccounted interval becomes a persistent sample-zero phase offset, and a delay exceeding the 20 ms lead can place smpCnt=0 after the intended PTP boundary while epoch_armed remains true. Capture/rebase the monotonic timestamp after the lease check and as close as possible to gptimer_start().
AGENTS.md reference: AGENTS.md:L94-L94
Useful? React with 👍 / 👎.
b57392a
into
feature/esp32p4-smv-ptp-epoch-binding-m3c-20261015
Physical capture motivation
120-second user-supplied Windows ASIX/Npcap AUTO capture: 480,279 canonical SV + 480,278 diagnostic mirror, 0 discontinuities per stream,
smpSynch=0on every SV, 120 each PTP Announce/Sync/Follow_Up. Current publicmaindoes not implement continuous PTP–SV phase authority; it cannot claim LOCK. This PR is stacked on experimental M3 Draft #166, not publicmain.Root cause and fix
Experimental
plan_ptp_epoch_arm()read EMAC PTP before GPTimer setup but used the original delay unchanged when starting GPTimer later. GPTimer setup latency thereby shifts sample-zero away from the intended integer PTP second. Retain the after-read monotonic timestamp; rebase alarm at the latest pre-arm moment; validate same PTP source-scoped clock lease at handoff. If too close to a boundary, defer one full PTP second; reject stale/nonmonotonic evidence and revert to ordinary free-running START.Guardrails
smpSynch=AUTOstays 0; SOURCE class 248 is not globally traceable.Gate
Run exact-head PTP Core gcc/clang/MSVC, ESP32-P4 firmware SOURCE/RECEIVER, and negative regression. Evaluate bench afterwards; do not auto-merge into
main.Bench checkpoint request
[run-phase-guard]
Produce separately packaged SOURCE/RECEIVER firmware for isolated ESP32-P4 P0 physical evaluation. The existing guarded CI job enables experimental phase steering and sparse MAC TX descriptor evidence, disables the broadcast mirror, and retains fail-closed AUTO=0. Never publish as production firmware.