Repository navigation
rs485_bridge: a framing count of zero proves nothing about the wiring - #21
Merged
Merged
Conversation
Documents a bench finding that is easy to get backwards and expensive to get backwards while debugging a silent bus. Every `errorCount_++` in RS485_non_blocking.cpp sits in the `default:` arm behind `if (!haveSTX_) break;`, so nothing is counted until a valid STX byte has been seen. A swapped A/B pair delivers inverted bytes that essentially never match STX, so the receiver never starts a frame and the counter stays at 0. A disconnected bus delivers no bytes and also stays at 0. Both are indistinguishable from a perfectly idle healthy bus. The failure mode this prevents: reading "framing errors: 0" as evidence the wiring is good, and looking elsewhere. Found at the bench 2026-08-16 on hardware whose A/B had to be swapped, then confirmed by reading the state machine rather than inferred from the symptom. Also records what DOES work for polarity: per-wire DC averaging, since with 0x55 streaming a driven pair reads ~1.6V mid-rail on both lines and matching voltages end-to-end identify each wire. Documentation only; no code change. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
aphelps
approved these changes
Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Documentation only — no code change.
What this records
Every
errorCount_++inRS485_non_blocking.cppsits in thedefault:arm behindif (!haveSTX_) break;. Nothing is counted until a valid STX byte has been seen. Therefore:All three are indistinguishable by that counter.
Why it's worth a doc change
The failure mode is reading
framing errors: 0as evidence the wiring is good and looking elsewhere — precisely when the wiring is the problem. This is a caveat that reads as reassuring and isn't.Provenance
Found at the bench on 2026-08-16, on hardware whose A/B pair had to be swapped at one end. Then confirmed by reading the state machine, rather than left as an inference from the symptom — the
if (!haveSTX_) break;guard is the mechanism, not a guess about it.The note also records what does diagnose polarity, so the caveat isn't purely negative: per-wire DC averaging. With
0x55streaming, a driven pair reads ~1.6 V mid-rail on both lines, and matching voltages end-to-end identify which wire is which.Context
This was sitting uncommitted in the working tree and is not on
main— it surfaced while syncing the repo onto current main, and would have been lost. Filing it rather than discarding it, since the RS485 bring-up it applies to is still pending.Needs a human review — this description is bot review input, not an approval.
🤖 Generated with Claude Code