3
\$\begingroup\$

I'm from computer science background and was reading NRZ encoding/decoding in my networking book (by sir Larry L. Peterson) which left me halfway with just small summary. Digging little deeper online I came across this article : Clock Recovery with digital PLL . I'm not into deep signal theory, and have no idea about sinx/x terms (but I know what frequency domains and time domains are at beginner level) and all I ask for help to understand the relevant theory to visualize things here .

In the section Clock Recovery System,

The only aspect we have, that carries part of the timing information, is the transitions between different bits. As we are going to see, transitions alone don't delivery a full solution, and a more complicated recovery system is needed (think with me, the sequence 1111, as an example, don't have any transition!).

The spectrum of a level encoded signal is a sinx/x function in the frequency domain.

Sin x/x spectrum of the NRZ encoded signal.

The signal has its power spread in a wide bandwidth, without much information about the bitrate. The only interesting visual aspect is the notches, evenly spaced apart. The first one happens to be exactly at 1200Hz, the bitrate of the simulated signal (1200 bits/s).

The energy being spread in frequency is actually the mathematical explanation about why it is hard to decode the signal. A large bandwidth signal is the dual of a well positioned information in the time-domain. This aligns with the conclusion that the timing information is only well presented in some parts of the signal - in its transitions - and not in the overall bitstream.

A better time-domain information about the overall bitstream will appear, in the frequency-domain, as power concentrated in specific frequencies.

Here we are able to use a simple but clever trick, and the first step at the receiver Clock Recovery System, is the processing of the signal through an edge detector.

The edge detector generates a signal with pulses exactly at the transitions of the received NRZ stream. This has the interesting effect of collapsing the sinx/x spectral energy into well localized frequency spurious.

The first frequency component is precisely at the bitrate frequency, 1200Hz. This is the base for clock recovery, where a timing generator will lock at this spectrum line, generating the periodic sampling of the signal line. It is useful to have a system where the phase of the generated clock is adjustable, to be correct aligned to the ideal decision moment.

Can anyone pls explain my questions

  1. This has the interesting effect of collapsing the sinx/x spectral energy into well localized frequency spurious <- meaning?

Edges Detected

  1. Once we detected edges/pulse of input signal (which will have different widths/distance between pulses dependent on data for example 110001, so the pulse would be like after edge detection _|__| (_=diff volt representing bits 1 or 0 , edges/transition = | ) , how edge detection makes us deduce pulse rate? why exactly we would have high spikes at 1200 Hz?
\$\endgroup\$
7
  • \$\begingroup\$ For visualising the function sin(x)/x, you might find the geogebra.org/calculator website useful. \$\endgroup\$ Commented Mar 18 at 12:55
  • \$\begingroup\$ Thanks,my main questions 1 & 2 are at bottom of page \$\endgroup\$ Commented Mar 18 at 12:56
  • \$\begingroup\$ I think "spurious" is a typo, perhaps an autocorrect for "peaks". \$\endgroup\$ Commented Mar 18 at 13:00
  • \$\begingroup\$ "spurious" --> "spurs" (peaks). The way that doing edge detection affects the spectrum of the signal is an interesting observation, but doesn't really aid in understanding how the clock recovery works. I wouldn't focus too much on that aspect of the description. The question Reconstructing Clock for Serial Signal might provide some insight -- just think of the pulses shown there as the output of the edge detector. \$\endgroup\$ Commented Mar 18 at 14:39
  • \$\begingroup\$ @DaveTweed Sir the answers there are overwhelming and very technical for me e.g FGPA, clock drifting (is this phase shifting?) etc which might lead me to reading whole signal theory I guess? hence my above question. It would be highly helpful if I get insight of what is happening in my question and move back to my subject. Thanks a lot! \$\endgroup\$ Commented Mar 18 at 14:53

2 Answers 2

3
\$\begingroup\$

I'm going to focus on your "computer science background", and assume that you're used to thinking in terms like "if x==5 then..."

Clock Recovery is only needed because reality is much messier than that. Nothing is exactly 1 meter long.

1200 Hz means repeating 1200 times per second. If you can send 1 bit on each of those cycles, then you can send 1200 bits per second. That seems obvious, because there are 1200 slots.

Except that reality does not have 1200 distinct slots! A better analogy would be some guy raising and lowering a stick, and someone at the other end looking to see whether the stick is up or down. Sometimes the first guy's arm will get tired, and he'll slow down, or only raise it halfway. Other times, he'll send three messages zip-zip-zip. Sometimes the observer will blink, or get distracted. Sometimes the observers will think they got distracted, but will actually glance back before the stick-raiser had a chance to change anything, so they'll record the same bit twice.

Electrical Engineers spend a lot of their focus on how to compensate for this. Maybe instead of looking 1200 times a second, look 12000 times a second and expect it to stay stable. (But if you can do that, then maybe we could communicate faster ...) Electrical Specifications will have different threshold voltages for high and low, so that some voltages in between are not well defined. Buttons will need to be "debounced", so that pushing the button once doesn't show up as 30 really quick pushes. By the time a computer program is dealing with this, the communication and debouncing and digitalization has already happened, so it is easy to forget -- but it is often top of mind for someone discussing "signal theory".

One common solution is an extra "ready" signal, often called a "clock". Imagine that the person sending the message still raises and lowers the stick, but then someone next to him waves a different flag to say "OK, the stick is in the right place now, go ahead and look." That person standing nearby with a validity signal is the "clock".

(That isn't the only meaning of "clock", or arguably even the most important -- but it is an important meaning. In this context "clock" doesn't always have much relation to the advancement of actual time. I2C clock stretching may be a helpful example.)

Of course, that extra "go ahead and look" signal is just as hard to send as the original signal. If we could skip that, we could send twice as much information! Well, instead of sending a signal, why don't we just piggyback on something else that we both know? Maybe we can both track time far more precisely than we can raise and lower a stick, or write down where it was? So lets just use the clock as our ready signal!

But if we're not using the same clock, things will eventually get out of synchrony. Maybe you send 1199.995 symbols each second, and I read 1200.033 times each second. That will work fine for quite a while, but eventually I'll read the same symbol twice. So we need a way to re-synch our clocks.

It doesn't matter whether the real speed is 1195 or 1219 or even if it varies between those, so long as we agree on when the next symbol is valid. Clock Recovery is a way for me to figure out what your clock is doing, so that I can do the same thing.

For the specific example in your question, I can assume that the bit value will change ((from 1 to 0) OR (from 0 to 1)) about half the time. So there will be a lot of energy around what you think is 1200Hz, and about half that around what you think is 2400Hz, and then some around what you think are 3600Hz, etc. (sinc, or sin(x)/x is not likely to be exact for a real protocol, but it is a decent approximation of how the energy will decrease with frequency.)

But what you think is 1200Hz might look to me like 1199Hz, or 1207Hz. And that is fine; it is close enough to read the right information for this symbol, and probably the next several.

A hundred symbols into the future, I might drift so far away that I'm reading at the wrong time. But if I do clock recovery, and I adjust my clock to match yours, and I keep doing that clock recovery and adjustment every few symbols, then by the time we're 100 symbols out, I've already adjusted my clock to match yours (several times), so that symbol can also be read.

Edge detection is just one way to recognize when the sender thinks the clock has ticked. It might involve some sharpening filter. (Normally, the sender's clock is less inconsistent than the total of all measurement errors including that clock.) You should not assume it has much to do directly with what a computer vision program would call edge detection.

\$\endgroup\$
2
\$\begingroup\$
  1. A random sequence of data sent as 1s and 0s in NRZ are rectangular pulses of various lengths. The frequency spectrum of such a signal has a shape of sin(x)/x, or otherwise known as sinc function. From such a signal it can be seen that there are frequencies with zero energy and lobes which have a local maxima, and these frequencies come from the bit rate of the NRZ signal.

Please understand that only random data has these properties so in general for any arbitrary data it does not have such white noise properties, and you cannot recover clock for an arbitrary length of 0s or 1s without transitions, so clock recovery for NRZ data is not a very good example.

  1. If the bit rate is 1200 bits per second then any time there is a transition on the signal it will be at multiple of time period matching 1200 Hz. You can have 1 bit, two bits, three bits etc up to infinity that are identical and have no transitions.
\$\endgroup\$
4
  • \$\begingroup\$ Sir can you please add little detail to your both points. for example "lobes which have a local maxima, and these frequencies come from the bit rate of the NRZ signal" . 2. "If the bit rate is 1200 bits per second then any time there is a transition on the signal it will be at multiple of time period matching 1200 Hz" please explain this part too \$\endgroup\$ Commented Mar 18 at 15:17
  • \$\begingroup\$ @HeartBleed Sure but I don't know what kind of explanation you need. Your quote from some source sounds like it has pictures of waveforms and their spectra which has sinc() waveform. A 1200 baud signal has no energy at 1200 Hz. It should be the first frequency null between main and second lobes. \$\endgroup\$ Commented Mar 18 at 16:19
  • \$\begingroup\$ "If the bit rate is 1200 bits per second then any time there is a transition on the signal it will be at multiple of time period matching 1200 Hz" can you sir please explain: sir what do you mean "time period matching 1200 Hz" and Why any transition will be multiple of 1200Hz?. Thanks a lot for helping me \$\endgroup\$ Commented Mar 18 at 19:14
  • \$\begingroup\$ @HeartBleed There are 1200 bit slots per second so each bit slot is 1/1200 seconds long in time. A bit is fixed length and state can change every 1/1200 seconds at most, for 600 Hz square wave being highest changing signal, and DC for never changing signal. \$\endgroup\$ Commented Mar 18 at 19:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.