D125 of 14
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

D12 · Lesson 5 · Finding the bit clock

Why the receiver must decide when to sample, the eye diagram and its widest opening, clock drift between two crystals, choosing a sampling phase from the data, tracking it with transitions, and keeping transitions coming with bit stuffing and scrambling

The transmitter sends a bit every 1/1200 s by its own crystal. The receiver has a different crystal, switched on at a different moment, so it knows neither where each bit starts nor exactly how long a bit lasts. Sample at a bit's edge and the decision is a coin toss; sample near its middle and it's clean. Clock recovery finds the best sampling instant from the received signal itself and keeps adjusting it as the two clocks drift apart, which they always do.

  • Eight bits of the byte B sent as half-sine pulses, positive for 1 and negative for 0, with time in bits.
  • The dashed line is what the receiver gets by sampling each bit at phase p (a fraction of the bit) and holding the value: full height when p is near the middle, shrinking toward zero at the edges.
  • Slide p to each of the eight sample positions an 8-sample-per-bit receiver could choose. The middle two are equally good.

Predict

The receiver's crystal runs 100 parts per million fast compared with the transmitter's. After how many bits has its sampling instant slid half a bit away from where it started?

Name it

The eye

Overlaying every bit's waveform on one bit interval draws the eye diagram: the traces for 1s and 0s separate most widely at the best sampling instant and close together near the edges. Noise and interference (lesson 6) shrink the opening. A half-sine pulse sampled a fraction p into the bit gives sin⁡(πp) of its peak, so with S samples per bit, a sample taken d samples from the center keeps cos⁡(πd/S) of it.

Choosing the phase

With S samples per bit, a simple receiver tries each of the S phases over a block of bits and keeps the one with the largest average |y|, the widest eye. Its timing error is then at most half a sample, 1/(2S) of a bit.

Tracking

Clocks differ by tens of parts per million, so the phase must follow drift. Early–late detectors compare samples a little before and after the chosen instant; the Gardner detector uses the sample midway between two decisions, which should be zero at a transition when the timing is right. Either one drives a loop that nudges the sampling instant, much like the PLL in lesson 8.

Keeping transitions coming

A tracker learns nothing from a long run of identical bits. Links keep transitions coming by:

  • Bit stuffing: HDLC inserts a 0 after five 1s in a row; USB inserts one after six.
  • Scrambling: an LFSR (C7) whitens the data so long runs become rare.
  • Line codes: Manchester (lesson 6) has a transition in every bit.

Worked example

A receiver with 8 samples per bit picks the best of its 8 phases. How far off center can it be, and how much signal does that cost with half-sine pulses?

Show the solution
  1. Worst timing error. The best of 8 phases is at most half a sample off: 12×18=116bit
  2. Sample value. The half-sine pulse there is cos⁡π16=0.981 of the peak.
  3. Loss in decibels. 20log10⁡0.981=−0.17dB
  4. What matters more. Finer timing gains little; drift matters much more.

Answer at most 1/16 of a bit off center, which costs 0.17 dB.

Worked example

What does HDLC's bit stuffing (a 0 after every five 1s in a row) add in the worst case, and on random data?

Show the solution
  1. Worst case, all ones. One extra bit per five: 15=20%
  2. Random data as states. The count of consecutive 1s runs through states 0 to 4.
  3. Chance of sitting at 4. In the steady state it is P4=16/3116=131
  4. Stuffing rate. A 1 arriving there (probability 1/2) forces a stuffed bit: r=12×131=162≈1.6%

Answer 20% overhead in the worst case and about 1.6% on random data.

Worked example

The two ends' clocks differ by 100 ppm. How far does the sampling point drift over a 100-bit frame, and over 10,000 bits?

Show the solution
  1. Drift over a 100-bit frame. 100 ppm is 10−4: 100×10−4=0.01bit negligible over a short frame.
  2. Drift over 10,000 bits. 10000×10−4=1bit
  3. What that means. Long transmissions need clock recovery that keeps tracking; a single phase choice at the start isn't enough.

Answer 0.01 bit over 100 bits, and a whole bit over 10,000.

Check

Find the best sampling phase and recover the bits.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

Two clocks differ by 50 parts per million. After how many bits has a receiver's sampling instant slid half a bit?

Check

A receiver takes 16 samples per bit and samples a half-sine pulse 2 samples away from its center. What fraction of the peak does it get?

Check

A receiver takes 8 samples per bit at 300 baud and picks the best phase. What's its worst timing error?

Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.

Check

A link stuffs a 0 after every 5 1s in a row. What's the overhead, in percent, when the data is all 1s?

Check

Two clocks differ by 100 ppm, and a transmission lasts 100 bits.

(a)

How far does the sampling point drift?

(b)

After how many bits has it drifted a quarter bit?

Check

A receiver with 8 samples per bit picks the best phase for half-sine pulses.

(a)

How far off center can its sample be?

(b)

What signal loss does that cost?

Explain why

Why does a receiver need transitions in the data to keep its bit clock?

Practice

Keep practicing

8 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.