RobotGuide

Hardware & electrical · topic E15 · 20 hours

Encoding & clock recovery

When the receiver has no separate clock line, how does it know where each bit starts and ends? Encoding is the answer. NRZI, Manchester, and 8b/10b look like a jumble, but they all solve the same two problems: make the signal carry its own rhythm, and keep it DC-free.

Specialization stage · Hardcore
System software · Aware Embedded & controls · Proficient

Tools
Tools

What to learn

  • Why encoding is mandatory: DC content breaks AC coupling; long runs of 0s or 1s make the receiver lose clock
  • NRZI + bit stuffing (used by both USB and EtherCAT): a 0 is force-inserted after 6 consecutive 1s — how the receiver strips it out
  • Manchester encoding: clock comes for free, at the cost of doubling bandwidth (10M Ethernet, some industrial buses)
  • 4B5B / 8B10B / 64B66B: trading redundancy for DC balance and error detection
  • Clock recovery: how a PLL rebuilds the clock from transitions; why the sampling point sits mid-bit
  • Breaking down jitter: periodic jitter, duty-cycle distortion, intersymbol interference, random jitter
  • Be able to compute: 8b/10b's encoding overhead (25%), bit stuffing's worst-case overhead (about 20%)

The lesson · plain words

As serial links get faster, the question shifts from «is the voltage right» to «where does the clock come from and how are bits encoded». 8b/10b encoding and clock recovery are the key to understanding every high-speed interface (Ethernet / PCIe / SATA).

Clock recovery: digging the beat out of the data

High-speed serial links no longer carry a separate clock wire — the receiver uses a PLL to recover the clock from the data's transition edges. The precondition: the data must transition often. Drag the jitter slider below: the edges wobble, the eye closes, and the decisions go wrong.

This explains why you cannot just send 1111110 (no transitions for too long and the clock drifts) — hence encoding.

Interactive figure · drag it and see

What this figure shows: an eye diagram of an 8b/10b-coded link with a jitter slider — as jitter grows the eye narrows and finally closes, and the panel explains clock recovery from data edges and the 25% overhead that buys DC balance and enough transitions; it also notes the same scheme runs under Ethernet / PCIe / SATA and successors like 128b/130b. Takeaway: clock recovery digs a clock out of data edges and jitter is its enemy — an open eye means every bit is judged right; too much jitter and the eye closes, and everything becomes a guess.

8b/10b: 25% overhead buys three things

Map 8 bits into 10 transmitted bits, and you get: ① enough transition density (the clock is never lost); ② DC balance (1s and 0s stay even, so capacitor-coupled links do not drift); ③ control characters (K codes, used to mark frame boundaries).

The cost is 25% bandwidth. The successors all squeeze this overhead: 64b/66b (10G Ethernet, 3% overhead), 128b/130b (PCIe). Same idea, one lineage: spend bandwidth to buy reliability.

The eye diagram: one physical-exam chart for link health

Overlay all bit periods on one display; an open «eye» means ample decision margin. The leaderboard of eye-closing causes: jitter, intersymbol interference (channel bandwidth too low), noise, reflections (E14). Reading an eye diagram to localize problems is a high-speed hardware engineer's daily routine.

Field triage order: check the eye opening first → if small, check equalization settings → then impedance and termination → last, power-supply noise. Instruments: scope plus protocol analyzer.

How deep to go

Be able to explain why encoding exists (clock content and DC balance); compute a link's real bandwidth including encoding overhead; read an eye diagram (open eye = pass). These three carry you through every interface in E14/E18/E19.

Three questions — do you really get it?

1. Clock recovery requires the data to transition frequently — what was invented for this?

  • ADifferential signaling
  • BHigher voltage
  • CLine codes such as 8b/10b
Show answer

C. Encoding guarantees transition density and DC balance; only then can the clock be recovered from the data.

2. What is the bandwidth overhead of 8b/10b?

  • A10%
  • B25%
  • C3%
Show answer

B. 10 bits carry 8 = 25%. 64b/66b squeezes it to 3% with the same idea.

3. What is the main cause of a closed eye in an eye diagram?

  • AJitter / ISI / noise stacking up until decision margin vanishes
  • BInsufficient voltage
  • CEncoding errors
Show answer

A. Eye height = decision margin. Closed eye = bit errors. Triage in the order jitter → ISI → noise.

Keep going deeper

Links without a marker stay on this site; the rest point to the Chinese edition until its translation batch lands.

How it fails in the field

  • Skipping encoding as a «protocol detail»: you read only the parsed packet output and cannot read the actual waveform
  • Thinking bit stuffing is error checking: it only guarantees transitions; it detects nothing
  • Computing bandwidth from payload only: encoding overhead is 20%–25%, and one multiplication blows the budget

You have learned enough when

You can hand-draw a 12-bit NRZI waveform and mark where bit stuffing inserts bits, then explain how a wider vs narrower receiver PLL bandwidth affects jitter tolerance; and you can give a one-sentence answer to «why you cannot keep transmitting 1s».

The Chinese edition carries the full topic page for Encoding & clock recovery, including the complete outline, depth requirements per career track, and further derivations: robotguide.dev/k/E15/.