Skip to content

M3.H: Stop measured SV smpSynch flapping at PTP Follow_Up TX epochs - #298

Closed
masarray wants to merge 10 commits into
fix/m3f-usb-hotplug-session-recovery-20261024from
fix/m3h-ptp-source-readiness-epoch-stability-20261024
Closed

masarray wants to merge 10 commits into
fix/m3f-usb-hotplug-session-recovery-20261024from
fix/m3h-ptp-source-readiness-epoch-stability-20261024

Conversation

@masarray

@masarray masarray commented Oct 24, 2026 •

Copy link
Copy Markdown
Owner

Field regression confirmed from raw PCAP (54,979 SV frames)

  • 21,325/54,979 samples advertised smpSynch=0 (38.8%) while 33,654 were 2; 9 transitions within 16.37 seconds. The 4 downward 2→0 transitions at smpCnt=3675 occur 22, 49, 35, 46 microseconds after actual PTP Follow_Up, with the same active GM clock identity and intact 1Hz Announce/Sync/FUP sequence 743–758. Recovery after ~331ms (smpCnt=999). Board flight recorder: REVOKED reason=PTP_LEASE_OR_GM_CHANGE, then ACQUIRED; serial reports PTP SOURCE still running, no alternate GM. Captured SV STOPPED at end → physical acceptance false. This is demonstrably a firmware sync gating fault; GUI USB-only code cannot repair it.

Root-cause class and minimal firmware change

  • ptp_lab_task.cpp invalidated both positive PTP core TX timestamps whenever ANY batch TX status failed, including independent peer-delay events. ptp_lab_is_running() maps TX freshness onto the PTP clock lease, so one transient runtime failure revoked a real 4kHz grid even though no GM/timebase changed.
  • Separate cold acquisition (requires fresh Announce AND completed HW Sync/Follow_Up) from running continuity (previously acquired SOURCE, both last independently successful TX timestamps still younger than the existing finite PTP freshness timeout, SOURCE still started and not stopped). Single error invalidates the cold gate but does not destroy measured successful frames. Persistent missing packets, expiry, physical link/phase/timer failure, role change and stop still revoke automatically. No forced smpSynch=2 and no changing ISR at 4kHz.
  • Added regression test: 100 simulated 1Hz epochs with isolated TX failure every seventh, cold-start negative, stale timestamp and stop/link fault gates. Studio static checks prevent timestamp-zeroing regression.

USB

Acceptance

Wait for complete PTP Core, ESP-IDF firmware, Qt, Windows native and lifecycle CI at the exact HEAD. Hardware FAT: 120s continuous SV 4k fps, 0 sync transitions and 0 missed samples, repeated SV STOP/START, USB reconnect (including same COM), real PTP message sequences and device failure logs. Do not merge to main or claim certified UTC traceability; simulated GM is not a physical GPS source.

Verified matched M3.H FAT candidate artifacts — head a922e9b

  • GitHub run https://github.com/masarray/arstack61850/actions/runs/40061206222: Windows Native Preview SUCCESS, full 10/10 workflows SUCCESS at exact head a922e9bdba4e57a4e88406eb83344455dd8ff142.
  • Setup EXE 31,059,935 bytes, SHA-256 4902e8bf44e78fc55a139ce84a1273f0768ef6fe10000f5d0f85d75d2f6c736e.
  • Portable ZIP 48,335,087 bytes, SHA-256 ca01424e4102aa65e353737024ebf3258b4d2f614fa60d932c95c353ee228d8f.
  • Identical packaged/standalone firmware BIN SHA-256 61c508e9bf1357eb964d2b817b260b6a0e985446ddd68de1d45d9467e25c4607, build ID a922e9bdba4e57a4, boot Sim Global GM yes, PTP INTERNAL_GM_ONLY, phase servo yes; physically-proven external GM traceability false.
  • Windows installer clean install, upgrade, uninstall and previous NSIS migration SUCCESS. Firmware FLASH required to test PTP correction; installing GUI alone does not update the source readiness policy.
  • Do not mark FAT PASS until actual board 120s SV capture shows zero 2->0 sync transitions and bounded USB reconnect, with no runtime fault. Keep draft and never merge to main until hardware pass.

…rst errors; never discard actual EMAC clock lease per packet
…xpires and fails closed after real stop/clock fault
…isolated TX fault without hardcoding smpSynch
@masarray
masarray marked this pull request as ready for review October 24, 2026 04:04
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T04:06:17.613002Z 604ac5b Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copy link
Copy Markdown
Owner Author

Integrated into main through PR #299 — stacked review closed. Exact PR HEAD a922e9bdba4e57a4e88406eb83344455dd8ff142 is now an ancestor of main (GitHub compare: 0 behind). Main commit ad2ebd0e7696dcbc389f1241fedbec5ecf504881 was merged after 14/14 CI success on c90a979.... M3.H tested source a922e9bd... and release tag a4b6e53d... are both contained in main, without modifying published firmware/binary. This PR had an intermediate base branch, so it is closed as already integrated via #299, not claimed as separately merged through this PR. Preserve historical commits and branch; full 120-second endurance/physical IED relay acceptance still not claimed.

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