I am working on my graduation thesis. The topic is a receiver implementation in FPGA. I am doing an implementation of symbol timing recovery. For this part I have decided to choose the Gardner algorithm. I have found here discussions about Gardner, Mueller&Muller and other algorithms. All the posts were useful, but I still have the following questions.

  1. I have noticed that my implementation of Gardner algorithm doesn’t work as intended in case of a big initial phase offset. Could you please give a suggestion, what I can do in such case?

I've already started a simulation in MATLAB with generating a signal with N symbols. Each symbol has to have 8 samples (as given by my supervisor). I did the first part:

Input_signal = randi([0 15],2000,1); % mod order = 16, 2000 symbols
  1. How can I implement the next part of this task, which is to create 8 samples for each symbol?


I have used CORDIC algorithm and defined amplitude of each samples and phase. Using them I can define a sample with max amplitude in each symbol. How can I use this information in implementation the time recovery algorithm?

  • $\begingroup$ At the MATLAB prompt, type openExample('signal/PassSignalThruRRCFilterSigExample'). It'll open an example that shows how to pulse shape using raised cosine filter $\endgroup$
    – Engineer
    Commented Feb 3, 2021 at 12:07
  • $\begingroup$ @Engineer raised cosine filter? Why do I need it? $\endgroup$
    – AD23
    Commented Feb 3, 2021 at 12:32
  • 1
    $\begingroup$ You’d be very helped by reading some digital communications textbook just to get the basics. Every book has a whole section on pulse shaping. This question has also been answered on this very site! $\endgroup$
    – Engineer
    Commented Feb 3, 2021 at 12:51
  • $\begingroup$ See this previous answer, dsp.stackexchange.com/a/40098/31316 $\endgroup$
    – Engineer
    Commented Feb 3, 2021 at 13:25
  • $\begingroup$ @Engineer Actually, I have the same doubt as OP. What if its a wired communication application and signal is PAM modulated, for example? In this case the transmitter may not implement any specific pulse shaping.To OP: what is your intended application? $\endgroup$
    – megasplash
    Commented Feb 4, 2021 at 10:40

1 Answer 1


Preamble: This answer is about timing recovery in a sense of symbol synchronization, i.e. finding the proper sampling phase of a baseband signal.

Based on the stated requirement of only 8 samples per symbol, I will assume that you are employing a fully digital approach to timing recovery. That means that you have no control over the times of sampling by ADC. The fully digital approach looks like this (this nice picture is from slides here):

Digital timing recovery

The "digital processor" is your FPGA-based implementation of the timing recovery algorithm, including the selected Gardner algorithm to find a phase error. "Sampler" - is an ADC with fixed sampling rate, 8 samples per symbol. "Analog processor" - this is an analog front-end, which is implemented in your board outside of the FPGA. And "signal in" is a baseband signal from your target communication channel.

In order to verify an implementation of your algorithm, you will want to model it, e.g. using a Matlab program or a Python script (whatever is more convenient). With the real signal samples from ADC you will be able to see the details of how your algorithm works in a long run, which otherwise is difficult to simulate in RTL and may be hard to debug when programmed on board. With a synthetic signal you can vary the parameters of the signal to see, how the algorithm reacts to it, and also you can plot a sigmoid for the TED, which can be very helpful.

About TED: Timing error detector (TED) is intended to detect a phase error in sampling. Based on the sign of its output, the timing recovery scheme will incrementally shift the sampling phase by a little step value, until the timing error becomes zero (or close to zero). This step value is usually selected to be 1-2% of a symbol period. Note, that with a fully digital timing recovery approach, when there is no actual control of the sampling phase, an interpolator is used instead, to fill the gaps between the signal samples. As a result the phase shift is made for the recreated version signal and not the real one.

Sampling phase error is defined by a phase difference between the transmitter, which generates symbols, and base sampling frequency of ADC (actual sampling frequency/8). Ideally the algorithm should be able to converge for arbitrary initial value of that error.

The answer to the question: In order to adequately model the initial phase error, the model must include not only a digital processor, but also a sampler. This means, that the input signal for the model should be continuous or oversampled. The degree of oversampling will define the resolution ability of your tests, i.e. how many different initial values you can provide. The goal can be 50-100 points per symbol period.

If you intended to use a real signal as an input of your model, you would use a logic analyzer to capture the signal at the input of the ADC with high enough frequency.

Alternatively, you may want to use a synthetic signal, that models a real one. Then you have to create its mathematical model. Usually you will start with random symbol values (as you did), then apply the modulation scheme (you will skip this if the symbol is a signal level), then apply a pulse shape (if the target transmitter does), then apply the distortions/pulse shaping relevant to your intended target communicating channel and analog front end (e.g. a low-pass filter can model the distortion of the signal in a twisted pair).

As you can see, the particular way of creating a synthetic signal will strongly depend on the type of the target communication channel.

Edit: Here is an illustration of what the resulting input data $x(k)$ for the TED may look like. It shows two different cases. You can see that they differ in the phase of ADC sampling. Also the examples show that the selection of 2 samples out of 8, which is necessary for the Gardner TED, is random.

eye diagram 1 eye diagram 2

The black lines are the exemplary eye diagram of the signal, the green line is the optimal sampling point and the blue lines are the ADC samples.

  • $\begingroup$ if i need create a single with 8 samples pro symbol, it means i need upsample it by factor 8 and filter, isnt? $\endgroup$
    – AD23
    Commented Feb 8, 2021 at 13:15
  • $\begingroup$ @Ali23 I've added an illustration for my answer, hope it makes my point more clear. What I suggest is to create a continuous signal (rather almost continuous, e.g. with 128 samples per symbol). That means that you will have to apply all the necessary filters to the sequence of random symbol values. Then you will give this oversampled signal to the model. $\endgroup$
    – megasplash
    Commented Feb 8, 2021 at 16:39
  • $\begingroup$ The first step of processing in the model is to select a phase of your ADC: with 8 ADC samples per 128 given samples in symbol you will have 16 different phases to experiment with. The next step will be to select 2 ADC samples out of 8 to give it to your Gardner TED (this will give you 8 more options). As a result you will have 128 different phase values to test your algorithm. $\endgroup$
    – megasplash
    Commented Feb 8, 2021 at 16:40
  • $\begingroup$ I am going to use Matlab and generate a random binary vector, modulate it using different types of PSK and add phase offset. Will be it enough to check the TED algorithm? $\endgroup$
    – AD23
    Commented Feb 24, 2021 at 14:04
  • $\begingroup$ @Ali23 Yes, it will do for a basic validation of the TED. This will be basically a signal as it can viewed at the transmitter end. But for a thorough test your model should definitely include a channel model, with matching filters (if applicable), noise and other relevant signal distortions. $\endgroup$
    – megasplash
    Commented Feb 24, 2021 at 14:31

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.