 So, this is lecture 38, ok. So, there were a couple of classes which were not recorded before this, those of you who did not show up for those two classes you would not have a recording of that, ok. So, I think two or three classes maybe I did not record, it was basically to show demos of very simple PAM simulation, ok. Well, maybe very simple maybe not so simple, ok. So, to show LMS and the fractionally spaced equalizers and all the properties to show them in a simulation. Once again I had urge you to go and try to recreate that simulation yourself with whatever software that is applicable to you and people are doing the lab maybe do not need to do that at all, ok. Alright. So, today's lecture is going to be briefly on career and timing synchronization, ok. I will not spend, in fact I will spend very, very little time on this, just one lecture overview and maybe even just half a lecture because I want to return your answer sheets as well. So, very brief lecture is going through high level ideas, ok. So, what is carrier synchronization? You want to get back the frequency and phase of the carrier that was used at the transmitter, ok. So, you might have a nominal idea of what that is or you might be able to nominally reproduce that frequency at the receiver, but it might drift, it might change with time, it might change with temperature. So, many things slightly differ. So, you definitely need to be very accurate about your estimate of the frequency, that is one thing. The other thing is the phase is something which is which needs to be estimated and needs to be locked on to. So, it is called the lock. So, you lock on to the frequency and phase of the actual center frequency of the carrier that is coming in, ok. So, that is the carrier synchronization, ok. And I showed you some effects of what happens if the carrier is not synchronized in the simulations. You saw the constellation rotating all over the place and all kinds of errors will be introduced, it is not possible to decode. Timing is after the carrier means after you have done the down conversion, after you do a match filter or some filter you have to sample, ok. So, you have to sample at the sometimes at the symbol rate, sometimes twice the symbol rate, ok. So, if you tell us if you sample twice the symbol rate maybe timing is not that serious a problem, but still you have to be worried about it, but the symbol rate sampling finally you have to worry about. If there is a drift in the phase then there is a problem, in the timing phase there is a problem. What do I mean by a timing phase, right? So, in PAM serial PAM transmission each symbol is going to roughly correspond to one symbol period which is 0 to t, ok. Within that 0 to t you have to sample somewhere, somewhere in that point and that point might is actually unknown to you. You do not know you know at the transmitter what that point is at the receiver you do not know what that point is and you have to keep changing that to get a better and better estimate of where that point is and depending on your for instance if you are doing Ray's cosine pulses depending on your excess bandwidth this thing can be very crucial or not so crucial, ok. But still if the channel is bad and all that this timing can cause serious problems, ok. So, you have to particularly at low SNR it will cause problems, ok. So, all so the problem I hope is clear to you and in today's modern several modern communication systems like wireless systems and several other things usually people go for a very easy solution. The easy solution is to do what, ok. Transmit the carrier and timing separately using some dedicated bandwidth, ok. So, that is the easiest solution, ok. So, I am going to put that down as the easiest solution, ok. So, use something called control or pilot channels for transmitting for transmitting the carrier and timing, ok. So, the timing and carrier is usually derived from this control channels information usually in wireless systems this is very common and the reason why some some approach like this is taken is one can also argue that in wireless systems you mostly go for what are called packetized transmissions, ok. Short bursts of packets and each transmission happens in a short burst and after that you discontinue for a while and then maybe one more burst, ok. In such situations each burst needs to have its own training data, its own framing and all that. So, it does not make sense to expect something like a continuous timing that needs to be maintained that situation does not really arise, ok. So, in packetized communications some solution like this is much more preferred, ok. So, you have bursts of transmission and that is better, ok. But of course, there are other situations where you have to send long streams of bits without any pause for a long time and expect your carrier and timing to be in sync over a long period of time. Can you think of any examples of such systems? Maybe satellite is one example, what else? Satellite no one can argue there is lots of bandwidth, maybe power is not there, but it is bandwidth available. So, usually what happens is if you think of systems like I do not know maybe on the chip. So, inside a chip sometimes you need to send bits from one place to another place. Inside a board you may need to send bits from one place to another place and those situations you are really sending bits continuously at a fast pace and you do not want to keep packetizing it, you do not want to keep putting framing this and that and you do not expect too much timing. In those situations these kind of things make sense. When you have to send a long stream of bits continuously at a fast rate and you do not want to keep stopping and pausing and doing all of this. So, that is where many of these carrier and timing synchronization ideas are very, very popular. Maybe Ethernet for little bit people use these things. But in wireless systems and all these modern systems people use very simple methods to track minor drifts in the timing assuming the control and pilot channels are available to fix the major issues. So, that is the idea. So, what we will do in this course is basically see an assortment of techniques, no logical flow to what I am doing first and what I am doing last. I will just provide a few techniques, few things that you might hear, but it is not neither complete nor it is intended to be incomplete. So, we just for you to know these terms is to hear these terms once and not hopefully forget about it and remember the central ideas maybe one or two ideas here and there. So, one component which will show up all the time when you do, when you want to synchronize face, timing phase or carrier phase or whatever is what the face lock loop. So, the face lock loop I want to briefly mention should know it is a highly non-linear device very difficult to analyze with your traditional linear type analysis, but of course only analysis we do is linear. So, you of course do a linear approximation analyze. I am not going to talk about the analysis at all. I will simply provide a block diagram and give you a brief description of what it is supposed to do. Have you seen face lock loops anywhere before in your courses? Maybe not the bit extruded. So, what happens is you are expecting a sinusoid as an input. So, you think of it as say let us say a sin I do not know some omega c t plus theta. So, this is what is the signal that is I am drawing continuous time it can even be discrete time. So, sampled versions also. And locally you have a certain version of this. So, I am going to call it sin omega l t plus theta l. This is your local version of what that is. So, first thing you have to assume is you can produce several such local versions. For instance is omega l can vary over a certain interval you should be able to do that. If you cannot do that then you cannot adjust it and then nowhere you can catch the drift and all that. So, there should be a device which lets you do that what is the device called. So, it is a voltage controlled oscillator. So, you need a voltage controlled oscillator whose frequency can be set by changing its input voltage and its output while being also used to correct the error is the actual carrier that you want. So, this is your output. So, what you do here is calculate error. So, it is like any other loop you always calculate error and feed it in. It is the same old thing all over again feedback loops. So, what is the error that you are interested in here? The error in the phase. So, what you have here is what is called a phase detector. There are several ways of implementing it. So, significant research I believe is still being done on improving on these phase detectors, improving on different components here. So, what is a phase detector do roughly its output should be omega c t plus theta minus omega l t plus theta l. So, this is what you roughly expect the output to be maybe there are better ways of defining that, but the difference between the phase of the two sinusoids that are at the input of the phase detector. Of course, there is a modular 2 pi. So, you do not expect it to keep on producing some continuous range. So, modular 2 pi. If there is a mismatch in omega c and omega l, then how will this phase difference look? It will be a triangular thing a linear thing with time it will keep going up and down modular 2 pi. What about if omega c equals omega l and theta is not equal to theta l, it is going to be a DC. So, that is what you expect that is what the signal will be. Other than that it is difficult to analyze this block why? It is highly non-linear, it is doing something very weird, it is doing a sine inverse and subtracted. So, it is not it is not easy to analyze this with Laplace transform or Fourier transform or anything like we cannot do any such thing. But you hope that it is close enough to being linear and then you analyze. So, people analyze it we will not do any such analysis. But this input by itself might be too raw to feed into the VCO. So, you do not want to feed this input to the VCO of various reasons too raw. So, usually you put a filter inside it is called a loop filter. Then the output goes to the VCO which is the voltage which will control the omega l change in the omega l. Of course, theta also there are some details involved here. So, one thing you can notice is one stable point of operation for this loop is what? When both are equal, when both are face locked, when both are face locked it is a stable point. So, in this system that is a stable point there is no doubt about that. And you assume around that stable point disturbances are linear and you analyze it and you get some important parameters. One thing will be what is called the I think the acquisition range it is called something. So, all these terms are out there and then lock range. So, there is two different ranges of frequencies for different PLLs all these things are designs. So, that is all I am not going to go into any more detail. It is also possible to design this in digital. So, today people even do digital PLLs. So, you can do the whole thing in digital. Digital in the sense this will be a sample sinusoid, you will be producing samples of sinusoids. Then the face detection and all one can imagine implementing highly non-linear face detector. So, it is what is the big deal it is just digital. You take sign, you take cost it does not matter. So, processor sitting inside it can read from a table if necessary. So, all these things can be done easily in digital and these things are implemented implementable digital also. So, there are blocks available which can lock on to a unknown frequency and face given a nominal frequency close enough to it. You cannot lock if you have only 10 kilohertz you cannot lock to 100 kilohertz frequency happily. You might have to do some things there are ways to get around that also. So, all these things are possible today. So, that is my brief talk about PLLs and I will not talk about PLLs from now on mostly. So, maybe one here or there I will mention, but mostly we will not talk about PLLs again, but this is a block which will show up again and again in these synchronization systems. So, the first thing we will see in PAM systems is timing synchronization, timing recovery by what are called spectral line methods spectral line methods. So, the methods that we will see mostly will be not decision directed at all. So, usually in the previous blocks I drew decision directed timing recovery you remember the one of the practical PAM receivers I drew had decision directed timing recovery decision directed carrier synchronization. What I am going to describe mostly today is something that is not decision directed. So, you deal directly with the signal somehow manipulated and derive your timing and carrier that is what I am going to talk about mostly. So, basically spectral line is so, the idea is briefly to exploit some kind of periodicity that is probably already available in your PAM signal. So, after all your PAM signal kind of repeats every t time units. It repeats only thing that changes is what the multiplying factor. So, definitely your PAM signal has some kind of periodicity involved in it. So, can you exploit that to extract a tone at 1 by t is the question. So, once you extract a tone at 1 by t you can produce your clock at the receiver. So, that is the brief idea behind spectral line methods. So, let us look at a baseband PAM signal. So, baseband PAM signal looks roughly like so, if you think of the receive signal it is going to be not roughly quite accurately am P of t minus mt. So, this is how it looks. So, here the P of t represents transmit filter convolved with channel convolved with receive filter. So, this is what you expect in your receive. So, the first thing you can do is write r of t in this form. So, I will show you how to write it. It is a very interesting way of thinking about it. You write it as expected value of a which is independent of m m equals minus n free to infinity P of t minus mt plus you subtract expected value of a from each of these case. So, assuming expected value of a is non-zero this signal decomposes into two non-zero parts. The first part is what? So, assuming expected of a e of a is not zero. So, this is an assumption I am making which will be violated in many signal constellations that we saw. But assuming it is non-zero this r of t breaks down into two parts. The first part is a deterministic periodic part with period 1 by t or with period t. Why am I saying it is deterministic? There is nothing random here. Periodic with period t. So, this part is random. So, I am going to call this a random wriggle that is introduced on top of the periodic 1 by t period t waveform. So, what one can do is roughly take this r of t and do what? How do I extract the period deterministic periodic 1 by t part? Put it with a filter rough filter around 1 by t. So, you know 1 by t roughly you do not know it exactly. So, you put a rough filter around 1 by t may be quite narrow. So, you know it quite accurately. You know you expect only a minor drift you do not expect huge changes around 1 by t. So, you probably put a very narrow filter around 1 by t you can extract this periodic tone. So, once you get the tone you sample it with that. So, that is the very simple idea in the spectral line method. So, you might say when do you get expected value of a not equal to 0s particularly in optical systems people use what is called on-off communications. The light is there or not there. So, that will correspond to a constellation which is 0 and plus a. So, that will give you a non-zero point. So, those conditions you can extractor can be extracted with a narrow band pass filter. So, the next question is what do you do if expected value of a is 0 then you do not get this part. So, what can be done? Any ideas? What can you do? So, you try some simple non-linear things basically you do things like squaring the waveform. You take r of t and you multiply it with itself. So, you get r of t square. So, notice r of t was that if you look at mod r of t squared you will get something like this m equals minus infinity infinity a m squared well mod a m squared I am sorry mod p of t minus m t squared plus you will get a whole bunch of cross terms a m a n star p of t minus m t p of t minus m t. So, this is what you get if you do mod r of t squared. So, now if you take expected value you can expect expected value of a m a n when a m m and n are not equal to be 0. You can expect this to go to 0 which means the expected value of r of t square will have a periodic well it does not necessarily have a periodic pattern I have to further extract the periodic pattern. So, now if you take expected value you will get something. So, let me write it down. So, I can write r of t as summation m equals minus infinity to infinity expected value of a m squared mod a m squared mod a squared p of t minus m t squared plus a random regal component. So, even if r of t expected value of a is 0 it is very likely that this will be non-zero. You do expect the value of mod a squared it will be non-zero right for most constant almost every constellation it will be non-zero. So, even if r of t does not have a spectral component at 1 by t it is very very likely that if you take mod r of t squared you will get a spectral component at 1 by t. So, this is non-zero. So, which means this part will be will be it is deterministic periodic with period 1 by t well period t sorry. So, you do a narrow band pass band filter to extract this term. So, r of t comes in you do mod r of t squared and then you do a narrow band pass pass filter you get it. So, these kind of ideas form this idea called spectral line methods for doing timing recovery. Of course, there are decision directed methods also. One such method I want to quickly point out I will point out just one decision directed method for well not really decision directed method for keeping up with timing. So, those are spectral line methods there is one more method called early late I spoke about it briefly yesterday early late gate timing recovery. So, even if you have even if you have a dedicated control channel there might be small drifts in the timing which you can catch with this such methods like early late timing recovery. So, it is common for instance to even in wireless systems to have something something like early late implemented. So, what you do is you have r of t. So, you normally have a timing tone at the receiver and you are expected to sample r of t at that timing tone you will do that also, but to estimate your timing better you will do an early sampling and a late sampling. What do I mean by early and late? So, if this is producing timing tone t this will be t minus sum delta by 2 this will be t plus sum delta by 2. So, within a width of delta minus delta by 2 plus delta by 2 you sample r of t again. So, in most pulse shapes that we saw the early and late gate should roughly produce the same number. So, you might lots of cat needs to be taken there. So, if you keep it carefully if you choose this delta carefully you can expect the early and late gate also to produce the same number. So, if there any different then that error can be used to adjust your timing tone. So, usually there is also an absolute value which is done just to get rid of the complex samples and then you do an error computation and then you do the standard form. So, you put it through a loop filter followed by a VCO which is producing your timing tone. So, any error you compute you deal with like this. So, this is a very simple idea which is implemented in several systems, but I am not talking about the details here this is beyond the scope. So, these are this is one more idea there are several such ad hoc ideas. There is also an idea based on peak estimation differentiating r of t in figuring out where it reaches a peak. It is likely that wherever it reaches a peak it is got right timing. So, there are methods like that ad hoc methods based on that. The next thing I think the last thing I am going to talk about today is carrier recovery once again non decision directed carrier recovery which is basically just called power of n carrier recovery. So, you saw before the way I did my timing recovery I did not need carrier synchronization. So, I did it kind of independently right with the r of t without worrying anything about carrier. Well actually I did not talk about pass band and base band at all. So, many of these techniques can be done even in pass band for instance taking modulus what will it do to e power j completely kill it ok. So, complex exponentials will go away. So, if you are if you have an analytical form if you have sign or cost then there is a problem, but if you did a face filtering face splitting then you have an exact e power j and then you take modulus it will completely disappear. So, the same thing can be done for pass band systems also and you can do timing without doing carrier recovery. So, once you have timing you can do carrier recovery also using this power of n method ok. So, once you have sampled it your sampled waveform is going to have a form like this e power j 2 pi fck t plus theta k summation m equals minus infinity to infinity am pk minus m ok. Once again this is overall response, overall pulse shape ok. So, now, if you imagine a pass band equalizer ok. So, you have done some preliminary demodulation and you are inside a pass band demodule pass band equalizer then you can expect the p of k minus m to be a delta p of k can be expected to be a delta because you are inside a equalizer the equalizer has killed all the ISI ok. So, one hopes and you can approximate p of k as delta ok. So, like I said this works only if you are inside a pass band equalizer ok. So, if you are outside of it maybe this is a bad assumption, but even otherwise you will usually make this assumption ok. So, if this is not a bad assumption one can make this particularly inside a pass band equalizer this is a very reasonable assumption to make because you have already equalized. So, you expect your p of k to be roughly close to delta. So, once you make this assumption you will see that this xk will have a simpler form which you can exploit ok. It is going to be approximately e power j 2 pi fck t plus theta times ak ok the entire convolution because it is a delta becomes just multiplication by ak. So, now, all you have to do is find n such that such that what expected value of ak power n is not equal to 0. So, once you find that n all you have to do is raise xk to the power n which will give you e power j n 2 pi fck t plus theta k right times what? Times expected value of e kn plus the random regal corresponding to the actual realization ok. So, this if you now do a band pass filter at n times fc ok. So, you do a band pass filter at n times fc about n times fc you extract your nfc ok. And then from nfc you can divide by n to go back to fc which dividing timing tones is very trivial right in right at least in digital you can do it very very easily. So, you just divide the carrier and get back to well you have to divide the carrier maybe it is not that trivial, but you can do that even in visualize how to do that ok. So, it is also possible to usually at the output have a PLL to further synchronize everything ok. So, PLL is also used to in this power of n method ok. So, but finding this n is crucial and this n might be easy in several cases for instance in bpsk can you think of an n 2 right. So, if you just square the signal you are going to get a component at 2 fc ok. So, it is a cos 2 pi fc or cos minus cos 2 pi fc square it you get it even for PAM you can do something like that. So, it is easy to get multiple of fc and then you do a PLL ok. You need a PLL further after that to make sure you have locked on to the right thing after you do a narrow band pass filter ok. So, these are just assorted methods there are more of these things ad hoc methods as well as decision directed methods about which I am not going to discuss ok. Is there any question at all that you want to ask? Welcome to read more books and find out more and figure out what. So, I have just one word of advice for people and people are doing the lab do not try any fancy carrier recovery methods ok. So, best thing I would advise is estimate what your delta f is which you can do using some standard sinusoid frequency estimation methods. Estimate what your delta f is and then compensate for it literally in your demodulation that is what I would advise do not try implementing digital PLLs it is it can be notorious ok. So, the last practical piece which is used in most systems which is missing in what I have done so far is this differential encoding ok. So, we are talking about carrier synchronization and phase synchronization there is one problem with the QAM constellations which you have to tackle independent of all these synchronization essentially especially in decision directed mode ok. So, that is that is the problem because of the symmetry of the QAM constellations. If you look at most QAM constellations ok almost any QAM constellations is basically they have what is called the phase ambiguity of pi by 2 ok. So, symmetric two rotations by pi by 2 right. So, most of the constellations that we talked about are symmetric two rotations by pi by 2 ok. So, if you are now trying to do an equalizer suppose there is just a phase offset some rotation has happened and you are trying to do an equalizer your equalizer can correct for it. In the training mode you would know exactly what the transmitted symbol was and you can subtract, but if you are in decision directed mode you are using the slicer error to feedback your equalizer. If your constellation is rotated by pi by 2 there is a phase difference of pi by 2 there is no way you can recover from it in decision directed mode ok. So, that is the problem that is that needs to be fixed ok. So, suddenly there can be a phase ambiguity of pi by 2 for some reason you may not be able to recover from it once you have once you entered the decision directed mode and that will cause a lot of errors ok. Turns out this can be solved in a very simple way and it is used in almost all systems today ok. So, most people would use this it is called differential encoding. So, what you do is instead of mapping the phase or this constellation point to one bit for instance if you take BPSK you map the bit 0 to plus 1 and bit 1 to minus 1. Instead of doing that absolute mapping you do something called differential mapping ok. So, if you get a bit 1 then you say I will change my constellation point in a specific way ok. So, change of the constellation point signifies your bit as opposed to the absolute point itself that is called differential encoding. So, I will illustrate it with differential BPSK. So, you will see it is really a simple idea and that is that ends up solving this problem ok differential BPSK ok. In regular BPSK what do you do? You have a constellation plus 1 minus 1 you associate a bit 0 to it and associate a bit 1 to it and if you have a bit sequence which is say 0 1 0 0 1 1 0 you associate a phase or a constellation point this VK is a constellation point you associate the see remember what is BPSK doing when you do plus 1 it is not introducing it is doing cos 2 pi of Ct ok if you do minus 1 it is minus cos 2 pi of Ct. So, you can also denote it as 0 pi ok pi pi 0 ok. So, this is the phase that is being introduced by the BPSK and when you decode and you find BK hat what do you do? You simply look at the 0 and then decode to 0 if look at this pi you decode to 1 there is no problem ok you can do each received value independently ok. Simply see constellation point plus 1 you decode to 0 constellation point minus 1 you decode to 1 there is no problem you can just do that without any problem. In differential BPSK you do something which is slightly different ok. So, you update the phase depending on the previous phase by a delta K and there is only a mapping from bit to delta K do 0 1 do 0 pi here and of course, for K equals 0 there is a problem. So, we can set phi minus 1 to be 0 the initial phase is 0. So, the change in the phase is what is controlled by your input bit not the absolute phase itself ok. So, that is what you do in differential BPSK. So, let us take the same BK for the same BK. So, the phi K will be what? Initially it was 0 phi minus 1 is 0 you got a bit 0. So, the phase will be 0 then you got a bit 1. So, the phase becomes pi and then you got a bit 0. So, the phase will be what? It will continue to remain pi ok. So, basically you will send the constellation point plus 1 first and then you will send minus 1 to indicate the change and then you will send minus 1 again ok. So, it is not an absolute mapping from either 0 to plus 1 or 0 to minus 1. So, notice here this minus the first minus 1 corresponded to a bit 1 while the next minus 1 corresponded to a bit 0 ok. So, it can change depending on how things look. So, this is pi then 0 pi pi ok. So, this is how your constellation point would look. So, this would be minus 1 this would be plus 1 am I right plus 1 then plus 1 again and then no minus 1 again and then plus 1 ok. So, those are the constellation points no no no minus 1 I am sorry the last thing is also minus 1. So, the way the constellation point maps to the bit is different, but the phase is what you have to carefully look at ok. So, pi goes to minus 1 pi goes to minus 1. So, that is fine. So, make sure you see this. So, when you decode it you have to do decoding at two levels. The first thing you do is the first step in the decoding is to simply look at the constellation point and decode what bit corresponded to it just blindly like before without worrying about it. So, you see this you do 0 you do 1 here then you do 1 1 0 1 1 like before ok, but these are not your bits that were sent. How do you find the bits that were sent? You add an imaginary 0 for the previous thing and in the second step what do you do? You XOR consecutive bits you XOR this bit with the previous bit to get your real bit ok. So, 0 XOR 0 will be 0 1 XOR 1 will be 1 this will be 0 this will be 0 this will be 1 this will be 1 this will be 0 and you go back to your original bit sequence ok. So, the change in the phase was indicated by the bit. So, you decode the phase back and do this XOR to find out if it changed or not right. When you do the XOR you find if it changed or not right if it is different it will be 1 if it is the same it is going to be 0. So, it is a very simple day mapping ok. So, this is differential BPSK. Now, you can also imagine doing differential QPSK ok. How would you do differential QPSK? Yeah delta K will be pi by 2 ok. The phase will change by pi by 2 depending on whether or not your 0 0 0 1 1 0 1 1 and based on that your first and second steps will change slightly ok. You have to be careful about how you design these things it can be done very easily ok. How will you do something like this in 16 QAM? Is it possible? Can you do this in 16 QAM or is it only done for BPSK and QPSK ok. So, what is done usually is in 16 QAM you have 4 quadrants and 4 points in each quadrant ok. So, you can imagine 2 bits denoting the quadrant and 2 further bits denoting what is inside the quadrant. So, what is what is usually done is you encode the 2 bits denoting the quadrant with differential encoding and within the quadrant you do absolute encoding. So, you do a mixture of differential and absolute in more fancy constellation and that is actually done in most systems people do that. The quadrant itself is indicated in a differential way and then the point inside the quadrant is denoted absolutely ok. So, that is how you map from bit sequence to the symbol ok. So, that is differential QAM and all that you can imagine doing this all right. So, I think that is all I wanted to say about carrier phase and timing synchronization like I said it is a it is more of an artistic area right. There is some non-linear components you have to come up with clever tricks if you are smart you can get things implemented faster ok. So, we will stop here for today.