Skip to content

fix(mstp): conform master token and PFM transitions to Clause 9.5.6 - #465

Closed
bbartling wants to merge 4 commits into
jscott3201:devfrom
bbartling:fix/mstp-clause956-token-pfm
Closed

fix(mstp): conform master token and PFM transitions to Clause 9.5.6#465
bbartling wants to merge 4 commits into
jscott3201:devfrom
bbartling:fix/mstp-clause956-token-pfm

Conversation

@bbartling

Copy link
Copy Markdown
Contributor

Summary

Fixes multi-master coexistence: Rust MAC 3 must not PFM/Token in ways that rebuild the ring as 0→3→0 and exclude FEC MAC 7.

Depends on #464 (Clause 9 CRC + USB stream). This branch is stacked on that tip. Prefer review/merge after #464, or treat as follow-up commits on the same train.

Design (Clause 9.5.6)

  • done_with_token(); no unconditional pass_token() on DoneWithToken
  • NextStationUnknown → PFM to TS+1 (never Token TS→TS)
  • Maintenance PS advances from TS toward NS only
  • PassToken failure → PFM after Nretry_token (no blind Tokens)

Tests

Mandatory A–E regressions (clause956_tests.rs), including 2000-rotation ring 0→3→7→0.

Made with Cursor

bbartling and others added 4 commits August 29, 2026 18:24
Host async serial reads arrive in multi-millisecond chunks; treating
inter-read gaps as Clause 9 T_frame_abort (~1.56ms @ 38400) discarded
partial frames mid-assembly. Add decode_frame_stream (Complete/NeedMore/
Invalid), preserve trailing lone 0x55 on preamble miss, and replace wire
T_frame_abort with a host stale-partial timeout based on max frame wire
time plus USB scheduling slack.

Co-authored-by: Cursor <cursoragent@cursor.com>
Replace incorrect reflected polynomials (0xE0 / Modbus 0xA001) with
Clause 9.6 values (0x81 / 0x8408). Add literal golden vectors including
the live Token 0<-7 frame (CRC 0x37) and data frame 01 00 → 9F 16 so
self-round-trip tests cannot mask interoperability failures.

Co-authored-by: Cursor <cursoragent@cursor.com>
Move Clause 9 golden / stream tests into mstp_frame_tests.rs so
mstp_frame.rs stays under the upstream file-size CI gate.

Co-authored-by: Cursor <cursoragent@cursor.com>
DONE_WITH_TOKEN no longer reverse-scans from NS+1 or emits Token TS→TS.
Add done_with_token(), FindNewSuccessor via PFM after Nretry_token, and
regression tests A–E for multi-master coexistence.

Co-authored-by: Cursor <cursoragent@cursor.com>
@bbartling

Copy link
Copy Markdown
Contributor Author

Closing: keeping this work on the bbartling fork only (vibe13-mstp). Not pursuing merge into upstream.

@bbartling bbartling closed this Aug 30, 2026
@bbartling
bbartling deleted the fix/mstp-clause956-token-pfm branch August 30, 2026 16:32
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