Skip to content

fix(mstp): Clause 9 CRCs + USB stream reassembly - #464

Closed
bbartling wants to merge 3 commits into
jscott3201:devfrom
bbartling:fix/mstp-clause9-crc
Closed

fix(mstp): Clause 9 CRCs + USB stream reassembly#464
bbartling wants to merge 3 commits into
jscott3201:devfrom
bbartling:fix/mstp-clause9-crc

Conversation

@bbartling

Copy link
Copy Markdown
Contributor

Summary

  • Correct MS/TP header/data CRC polynomials to BACnet Clause 9.6 (0x81 / 0x8408); prior 0xE0 / 0xA001 passed self-round-trip but rejected live trunk frames (e.g. Token 55 FF 00 00 07 00 00 37).
  • Preserve partial frames across USB host read chunk gaps (do not treat async read() gaps as Clause 9 T_frame_abort).
  • Add literal golden vectors and residual checks (0x55 / 0xF0B8).

Commits

  1. a9912b8 fix(mstp): USB chunk gaps must not trigger T_frame_abort
  2. 6a70b85 fix(mstp): use BACnet Clause 9 header and data CRCs

Test plan

  • cargo test -p bacnet-transport (343 unit + 2 integration)
  • upstream CI green
  • Vibe13 passive sniff against live BASRT/FEC trunk (follow-on)

Made with Cursor

bbartling and others added 3 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>
@jscott3201

Copy link
Copy Markdown
Owner

Let me have my agent check this against my roadmap work for 1.0 and I'll get this rolled in!

@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-clause9-crc 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.

2 participants