Two bits is all I can afford as overhead.
Two parity bits is cute but can't go far... and the extra degree of freedom actually increases the work on the encoder side, for a meager benefit.
March 9, 2025, 2AM : a different approach is possible !
The 16 data bits are POPCOUNTed.
- LSB is parity.
- MSB (meaning: count < 7) is the "flip" bit that will negate all 16 data bits (before going to MLT3)
This flip bit must also flip the parity of course.
This garanties that there will be a minimal activity on the line, reducing wander: 8 transitions per 16 bits minimum. The parity enables fast error detection (pins the location of a possible error) as well as keeps the behaviour of "Return to Neutral".

Now, the parity can be the last bit. It can be implemented as a sort of "reset of the MLT3 state" instead of just some more data/payload. It also clearly delimits the length of a +1 or -1 run, which is now 8 bits at worst.
The prefix is not "flipped" because a "out of band" packet (start, stop, negotiation...) must start with 11 in all cases.
If some wander can be predicted, the flip bit could be conditioned (reminiscent of some composite RLL codes...). The actual value of F is not checked, such that eventual tweaking/optimisations are possible.
Decoding is very simple, use the F bit to xor the output. And empty packets are easy to spot : if the payload is 00000... then the F bit must be set, as well as parity probably. And if payload is 11111... then F=0
Now, I have to design a POPCOUNT with 16 inputs.
Simplified versions, with occasional off-by-one results, are possible because the F bit is not strictly enforced on the receiving end. F must be set if popcount<8, but some cases of 7 or 9 are tolerable (though they relax the timing and droop requirements).
TODO: schematic of the "pipeline"
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.