Repository navigation
Conversation
…aults and GPTimer wrap
…ample epoch with safe timer teardown
…teness accounting truthful
…ions and fail-closed steering
…ART; preserve default-off baseline
…SOURCE-only matrix
…timeout in test matrix
…timeout in test matrix
…dence and physical limits
… corrupted shell grep suffix
…mware and assert lock-free phase state
… phase corrections
…rialized timer lifetime
…ve/negative self-test
…ulk reader parity
…sequence; add negative PCAP cases
… in one ESP32-P4 checkpoint
…ss and STOP/START
…se command handoff
…l-closed validation
…ce restart and SV loss
…Hz power-profile cadence
…fied TAI-UTC offset
|
CI integration checkpoint (2026-10-15): synchronized Draft routing from merged PR #158 (main merge e6b798c) onto this stacked M2/M3 branch in a single fast-forward commit |
Milestone M2A: Continuous software PTP-to-SV phase authority
Stacked on Draft PR #153 (base branch:
feature/esp32p4-ptp-sv-epoch-m1-20261014); not an independent merge to main. Work toward #154.What actually changed
SvPtpPhaseAuthority: 1 MHz GPTimer / EMAC PTP cross-clock bracket, PTP phase-error normalization, source epoch validation, 32-bit wrap handling, clock-step rejection, bounded PI correction.SvBoundedSlewCursorcan distribute +/-400 µs per second as no more than +/-1 GPTimer tick per interval (4000/4800 fps), no abruptsmpCntreset or catch-up burst.CONFIG_AR_SMV_PTP_PHASE_SERVO_EXPERIMENTAL=nby default. When explicitly enabled in LAB_SOURCE (started before SV), a CPU0 background observer captures PTP/GPTimer time once per epoch 250 ms after ISR sample zero and publishes a bounded correction for the remaining intervals. Existing realtime publisher stays canonical; no PTP ioctl/mutex/heap/log in 4kHz ISR.docs/PTP_SV_PHASE_AUTHORITY_M2A.md.Acceptance and limits
M2B — Combined PTP/SV wire-evidence checkpoint (2026-10-14)
SampledValuesStreamSupervisor(no duplicate parser).ariec61850_ptp_sv_wire_auditfor one classic PCAP, explicit APPID/svID/counter modulus/PTP domain, source identity, counts of Announce/Sync/FollowUp/PdelayResp andsmpSynch.PcapReader::for_each_packet; preserveread_all()by calling the SAME streaming parser and moving packets into the legacy vector; tool processes one frame at a time, suitable for multi-hour high-rate capture.Documentation:
docs/PTP_SV_WIRE_AUDIT_M2B.md. Current M2B code checkpoint:3370c7dbc7e38729ae78b56c6a8ba45254d8ef94.M2B targeted validation evidence — 2026-10-14
0c8372b01883ed80ce523e590026b8ce8763179b: same one-job Linux compile + CTest, mismatched Follow_Up sequence and missing Follow_Up both rejected.M2A.1 — loss-aware phase authority, verified checkpoint (2026-10-14)
986ca6c1567e70827b56e88a0ad79fc4037a4349: targeted run #38537488220 —Portable strict phase regression: success,Compile guarded ESP32-P4 SOURCE firmware: success; full two-role matrixskippedas intended.CONFIG_AR_SMV_PTP_PHASE_SERVO_EXPERIMENTALstill defaults OFF. The evidence proves portable algorithm regression + buildability of firmware SOURCE, not IED lock, clock accuracy, actual EMAC SV egress timestamps, or absence of alarms.M2C — sparse canonical SV hardware TX descriptor evidence (2026-10-14)
68151cafa43478ff411576bb61aa74d4e2c41813: optional (default OFF) ESP32-P4 SOURCE diagnostic that timestamps the actual canonical SV frame at one out of every 16smpCnt=0sample epochs. Normal 4k/4.8kHz frames retainesp_eth_transmit; the sparse selected frame uses ESP-IDF v5.5.4esp_eth_transmit_ctrl_vargswith a MAC DMA-descriptor timestamp.SvTxEgressEvidencerecords measured/missing/failed/rejected frames,smpCnt, sample epoch and scheduled GPTimer deadline ticks, PTP egress seconds/phase, and CPU TX submit blocking. Failed or missing hardware timestamps are explicitly UNAVAILABLE (never replaced with software timing). A descriptor wait exceeding the scheduled sample interval is marked unqualified to expose instrumentation disturbance.smpSynchAUTO promotion. Correct PTP whole-second phase does NOT prove GM traceability, per-frame SV scheduling or relay sync alarm clearance.tests/test_sv_tx_egress_evidence.cppand existing phase authority suite. Verified PASS on exact commit: M2C one-job portable tests and guarded ESP32-P4 SOURCE firmware build. The full two-role matrix is skipped as intended.docs/PTP_SV_HARDWARE_TX_EVIDENCE_M2C.md, including pinned ESP-IDF DMA wait semantics and the possible inability to timestamp non-PTP SV EtherType on physical silicon.M2D — timestamp continuity & PTP SOURCE restart reliability (2026-10-14)
Verified code checkpoint:
e871b54261e39f1468a030d72c2e35351395ad0c; single targeted ESP32-P4 + portable regression run — SUCCESS (portable strict phase/evidence CTest and ESP32-P4 SOURCE firmware), unrelated two-role matrix SKIPPED.SvTxEgressEvidenceno longer treats one near-zero-phase MAC descriptor timestamp as proof of a good window. First observation is baseline only. A measured value requires the next selected frame to advance exactly 16 SV sample-zero epochs AND the nearest integer PTP second by 16, with unchanged SV session, publisher fault-generation and PTP SOURCE generation. A missing TX timestamp, missed slot, failed canonical TX, unexpected epoch jump, PTP 1-second step or source restart invalidates/rebases observations and is not included in accepted min/mean/max.ar_ptp_lab_source_generation()is zero when SOURCE is not ready. Both sparse egress audit and ongoing software phase observer reject PTP source transitions and clear stale PI/phase evidence before reacquiring. No extra per-sample EMAC IOCTL, heap or locking in the GPTimer ISR.smpSynch=1/2, no claim that a relay has locked or sync alarms disappeared.The one-time Draft CI opt-in was removed after the successful exact-head checkpoint. Subsequent Draft pushes do not automatically schedule expensive firmware builds.
M2E — PTP SOURCE health and fixed-cadence power profile (2026-10-14)
Checkpoint: GitHub Actions run #38545619492 SUCCESS, exact code SHA
a035744c6ab87e0fec31648ff13050a1eb9b708a. Exactly one targeted job ran: portable strict C++ phase/egress/PTP runtime/source readiness tests SUCCESS and ESP32-P4 SOURCE build (ESP-IDF 5.5.4) SUCCESS. Full SOURCE/RECEIVER matrix and unrelated Draft jobs skipped as intended.g_ptp_readyafter a failed Sync/FollowUp because lifetime Announce/Sync/FollowUp counters remained nonzero. NewPtpSourceReadinessGaterequires fresh Announce AND complete hardware-timestamped Sync/Follow_Up since the most recent source/peer-delay TX fault; Pdelay success alone cannot qualify SOURCE. A new PTP SOURCE generation only begins after the fresh gate is satisfied.PtpPublisherRuntime::poll_due()advances from the previous monotonic deadline, not from delayed task wake time; a 7ms late poll does not phase-shift subsequent nominal one-second Announce/Sync deadlines. Long stalls skip missed periods, never send burst catch-up messages.CONFIG_AR_PTP_ALLOW_NONSTANDARD_LAB_CADENCE=y). Domain and VLAN remain configurable for the target IED. Portable positive/negative tests cover readiness on Pdelay/Sync/Announce failures, recovery, 1Hz delayed polls, long missed intervals, and independent 250ms generic cadence.docs/PTP_SOURCE_HEALTH_M2E.md. Source time quality remains truthful (clockClass=248, unknown accuracy, internal oscillator). This does not assert IEC/IEEE 61850-9-3 certification, GM traceability, a measured physical SV/PTP clock, or absence of IED synchronization alarms.M2F — fail-closed SOURCE freshness and truthful timescale, verified 2026-10-14
Code commit:
90062f391a9c97cb1ff20d072b7f15ba4a777fac. Exact-head verified CI: ESP32-P4 PTP Lab Profile, one-job run #38551623186 — portable strict phase/power-profile/runtime/TX-evidence regression SUCCESS, guarded ESP32-P4 SOURCE firmware build SUCCESS, two-role matrix SKIPPED. Checkpoint opt-in was removed from PR immediately after initiation; ordinary Draft pushes do not trigger heavy jobs.READYindefinitely when its FreeRTOS PTP task stalled. New zero-allocation portablePtpSourceEvidenceFreshnesschecks both a recent successfully transmitted Announce and a recent complete hardware-TX-timestamped Sync/FollowUp pair using monotonic microseconds. Default 1Hz power profile expires after 3 seconds. Stale timestamps, zero timestamps, backwards clock and STOP/START all fail closed.ar_ptp_lab_source_generationuse the same live, age-qualified health check. On a stale SOURCE loop, previous readiness is revoked before fresh sends, and a newly verified cycle starts a new generation, preventing PTP/SV phase and MAC TX evidence from inheriting a stale clock authority.ptpTimescalefrom a plausible RTC alone: bothptpTimescaleandcurrentUtcOffsetValidflags now require an actual EMAC seed and explicit operator verification of TAI–UTC offset/RTC epoch. Otherwise both remain false.timeTraceableandfrequencyTraceableremain false;clockClass=248, unknown accuracy and internal oscillator unchanged. The strict IED may reject a lab clock with unknown provenance, which is appropriate.0x0000versus0x000c. Documentation:docs/PTP_SOURCE_FRESHNESS_M2F.md.