Costas Loop
Costas Loop
Modules: Sequence Generator, Digital Utilities, VCO, Quadrature Utilities (2), Phase Shifter,
Tuneable LPF (2), Multiplier
0 Pre-Laboratory Reading
Phase-shift keying that employs two discrete phases (0 and 𝜋 radians) is often called binary
phase-shift keying (BPSK).
BPSK carrier
1
A BPSK modulator can be implemented (for a relatively small 𝑓𝑐 ) with a multiplier.
𝑑(𝑡) X 𝑑 𝑡 cos(2𝜋𝑓𝑐 𝑡)
cos(2𝜋𝑓𝑐 𝑡)
At the receiver the data can be recovered with synchronous demodulation. If a stolen carrier is
available, the received signal is multiplied by this stolen carrier. It is assumed here that the
stolen carrier is 2cos(2𝜋𝑓𝑐 𝑡). If this is the case, then the signal processing in the receiver is
In the field, where the receiver is usually remote from the transmitter, no stolen carrier is
available. For synchronous demodulation to work, the receiver must somehow reconstruct a
copy of the (unmodulated) carrier from the received signal. It is important to note that this
reconstructed copy must match the arriving carrier in phase as well as frequency.
A simple phase-locked loop is designed to track a sinusoid. The VCO produces a sinusoid.
When the loop is tracking properly, this VCO sinusoid and the input sinusoid have the same
frequency. The multiplier produces a difference-frequency term and a sum-frequency term, but
only the former passes through the lowpass filter. The output of the filter is an error signal, and
it is amplified and then placed at the input to the VCO, completing the loop.
2
X LPF
VCO
Phase-locked loop
Loop gain is an important parameter in a phase-locked loop. The loop gain is defined as the
product of the VCO sensitivity and the amplification in the loop. The behavior of the loop
depends on whether the loop gain is positive or negative. In the following discussion, it is
assumed that the loop gain for this simple phase-locked loop is positive. (In the TIMS
instrument, the VCO sensitivity is negative and the amplifier gain is also negative, so the minus
signs cancel and the loop gain is indeed positive.)
With positive loop gain, a positive error signal (appearing at the output of the lowpass filter)
causes the VCO output frequency to be larger than its nominal value (the frequency with zero
input to the VCO). A negative error signal causes the VCO output frequency to be smaller than
its nominal value.
The input to the loop is here modeled as sin(2𝜋𝑓𝑐 𝑡 + 𝜃𝑐 ). The VCO output is modeled as
2cos(2𝜋𝑓𝑐 𝑡 + 𝜃𝑣 ). The multiplier produces a difference-frequency term sin(𝜃𝑐 − 𝜃𝑣 ), and this
is the error signal. (The sum-frequency term is blocked by the lowpass filter.) The error signal
is plotted below as a function of the phase difference 𝜃𝑐 − 𝜃𝑣 .
There is a stable lock point at the positive-going zero crossing: 𝜃𝑐 − 𝜃𝑣 = 0. The following
reasoning shows this to be a point of phase lock. If 𝜃𝑣 < 𝜃𝑐 , the error signal is positive
(assuming 𝜃𝑐 − 𝜃𝑣 is not larger than 𝜋) and therefore the VCO is forced to produce phase at a
faster rate (that is, to produce a larger frequency). This means the feedback action of the loop
pushes the loop back toward the point 𝜃𝑐 − 𝜃𝑣 = 0. If 𝜃𝑣 > 𝜃𝑐 , the error signal is negative and
3
therefore the VCO is forced to produce phase at a slower rate. In this case also, the feedback
action pushes the loop back toward the point 𝜃𝑐 − 𝜃𝑣 = 0. Of course, if 𝜃𝑐 − 𝜃𝑣 = 0 the error
signal is zero, and the loop tends to stay where it is.
It should be noted that a negative-going zero crossing is not a stable lock point. If 𝜃𝑐 − 𝜃𝑣
moves slightly off the point 𝜃𝑐 − 𝜃𝑣 = 𝜋, the feedback action pushes the loop away from the
point 𝜃𝑐 − 𝜃𝑣 = 𝜋. This is called a point of unstable equilibrium.
As described above there is one stable lock point per cycle of carrier phase. This point occurs at
𝜃𝑐 − 𝜃𝑣 = 0. In other words, phase lock corresponds to 𝜃𝑣 = 𝜃𝑐 . Remember that the input
sinusoid is modeled here as a sine and the VCO output is modeled as a cosine. Therefore, when
in phase lock (and with positive loop gain) the VCO sinusoid leads the input sinusoid by 90° .
A Costas loop is a type of phase-locked loop that is used for carrier synchronization in a receiver
when the modulation is BPSK.
X
−𝜋⁄2
data
Costas loop
Some mathematics will demonstrate how the Costas loop works. The input to the Costas loop is
modeled here as
4
𝐾UF 𝑑(𝑡)sin(𝜃𝑐 − 𝜃𝑣 ) (7)
where 𝐾UF is the DC gain of the upper-channel filter. The term sin(𝜃𝑐 − 𝜃𝑣 ) by itself would be
a suitable error signal for a carrier synchronization loop. However, the presence of 𝑑(𝑡) means
that the signal of Eq. (7) cannot by itself serve as the error signal for the loop.
The local oscillator applied to the lower channel is 2sin(2𝜋𝑓𝑐 𝑡 + 𝜃𝑣 ). The output of the filter in
the lower channel is
The third multiplier (the one on the right side of the diagram) produces a suitable error signal:
1
𝐾 𝐾 sin[2(𝜃𝑐 − 𝜃𝑣 )]
2 UF LF (9)
Eq. (9) was obtained by noting that 𝑑 2 (𝑡) = 1 and by using the trigonometric identity
1
sin(𝜓) cos(𝜓) = sin(2𝜓) (10)
2
The error signal of Eq. (9) passes through an amplifier with gain 𝐺 on the way to the VCO input.
The loop gain is the product of all gains in the signal path and the VCO sensitivity 𝐾VCO . The
loop gain is therefore proportional to 𝐺𝐾UF 𝐾LF 𝐾VCO . For this experiment 𝐺 and 𝐾VCO are
negative and 𝐾UF and 𝐾LF are positive. Therefore, the loop gain is positive. For a loop with
positive loop gain, a positive error signal (the signal at the output of the third multiplier) causes
the VCO output frequency to increase and a negative error signal causes the VCO output
frequency to decrease.
The error signal for the Costas loop is proportional to sin[2(𝜃𝑐 − 𝜃𝑣 )]. Below that expression is
plotted as a function of 𝜃𝑐 − 𝜃𝑣 .
5
For positive loop gain, the stable lock points are identified as positive-going zero crossings in the
above plot. Negative-going zero crossings are not stable lock points; instead they are points of
unstable equilibrium. For the Costas loop there are two stable lock points per cycle of carrier
phase. With positive loop gain, these two stable lock points are at 𝜃𝑐 − 𝜃𝑣 = 0 and 𝜃𝑐 − 𝜃𝑣 = 𝜋.
In other words, this loop will lock with either 𝜃𝑣 = 𝜃𝑐 or 𝜃𝑣 = 𝜃𝑐 − 𝜋. Remember that the input
has been modeled as a sine and the VCO output as a cosine. See Eqs. (5) and (6). Therefore, the
VCO output will be in phase quadrature with the input.
For example, for a period of time in which 𝑑(𝑡) = +1 and with the lock point 𝜃𝑣 = 𝜃𝑐 , the VCO
output will lead the modulated carrier by 90° ; however, when the bipolar voltage changes so that
𝑑(𝑡) = −1, the modulated carrier phase changes by 180° so that the VCO then lags by 90° . At
the other lock point also, the phase difference between the VCO output and the modulated carrier
will be ±90° , with the sign depending on the polarity of 𝑑(𝑡).
When a Costas loop with positive loop gain is in phase lock, the output of the filter in the lower
channel will be
In a practical BPSK system, how does the receiver resolve the phase ambiguity? One common
method is explained here. In digital communication systems, the data are normally organized
into data frames. For example, one data frame might contain the bits for 100 consecutive words,
each word representing one sample of the original analog message. Each data frame contains a
prefix that contains a short sequence of bits, agreed upon by both transmitter and receiver. This
sequence is known as a synchronization word because the receiver can look for it in the arriving
stream of bits and thereby identify the start of each new data frame. This process is known as
frame synchronization. The receiver can also check to see if the synchronization word (that is
expected at the beginning of each data frame) appears right-side up or upside down. If the latter,
the receiver knows to invert the entire frame of bits.
What changes if the loop gain is negative? In this experiment the loop gain becomes negative if
the amplifier with negative gain is removed from the circuit (since the VCO sensitivity is
negative). With a negative loop gain, the stable lock points occur on the plot of sin[2(𝜃𝑐 − 𝜃𝑣 )]
6
versus 𝜃𝑐 − 𝜃𝑣 at negative-going zero crossings. There are two stable lock points per cycle of
carrier phase, and these lock points are at 𝜃𝑐 − 𝜃𝑣 = 𝜋⁄2 and 𝜃𝑐 − 𝜃𝑣 = 3𝜋⁄2. The
demodulated data then appear at the output of the filter in the upper channel.
When a Costas loop with negative loop gain is in phase lock, the output of the filter in the upper
channel will be
In summary, a Costas loop with negative loop gain behaves in much the same way as a similar
Costas loop with positive loop gain. The difference is that the data appear (possibly upside
down) at a different location in the circuit.
1 BPSK
The Sequence Generator module will supply the sequence 𝑑(𝑡) of bipolar voltages. On the PCB
of this module there is a pair of switches in a dual in-line package (DIP). These switches
determine the sequences. Set both switches to the up position. You will use the sequence at the
analog Y output port.
Connect a (100⁄48)-kHz TTL clock to the clock input of the Sequence Generator. You can
create a (100⁄48)-kHz TTL clock from the (100/12)-kHz TTL clock on the Master Signals
panel with a divide-by-4 (Digital Utilities).
Place the analog Y output from the Sequence Generator on Channel A. Place the (TTL) sync
output of the Sequence Generator on Channel B. Use this same sync output as the trigger source.
(A positive trigger level is needed for a TTL trigger source.) The sequence from the Y output is
periodic. The sync TTL signal has the same period and therefore permits a stable oscilloscope
display. You should observe a stable display of a sequence of bipolar voltages. This will serve
as 𝑑(𝑡) in this experiment.
Create a BPSK carrier by connecting the analog Y output of the Sequence Generator to one input
of the Multiplier and a 100-kHz sinusoid (Master Signals) to the other input. The Sequence
7
Generator’s analog Y output should still be on Channel A. Place the modulator output on
Channel B. Use the (TTL) sync output of the Sequence Generator as the trigger source.
Consider using the zoom function of the oscilloscope to zoom in on a data transition.
Observe the spectrum of the BPSK carrier. You should note that there is no residual carrier.
Make sure the switch on the VCO module’s PCB is set to “VCO”. Set the toggle switch on the
front panel of the VCO module to “HI”. Place the VCO output on the input of the Frequency
Counter. With the gain knob on the VCO module set in the fully counterclockwise (zero-gain)
position, use the frequency knob to set the VCO output frequency to approximately 100 kHz.
Observe the VCO output frequency for a few minutes. It should be clear that the VCO does not
have good frequency stability.
Connect the Variable DC output to the VCO input. Adjust the DC source to +1 V. Rotate the
gain knob on the VCO clockwise until the VCO output frequency decreases by 1 kHz from its
nominal frequency. The sensitivity is now set for −1 kHz/V. You should keep the VCO
sensitivity at −1 kHz/V for the remainder of this experiment. Disconnect the Variable DC
source from the VCO.
The Phase Shifter module has a slide switch on its PCB. Make sure this switch is set to “HI”.
Adjust the delay of the Phase Shifter so that the phase change is − 𝜋⁄2 radians for a 100-kHz
sinusoid.
Build a Costas loop. Use Quadrature Utilities modules for the three multipliers in this loop. Use
the Phase Shifter that you have just calibrated. Use Tuneable LPFs for the upper-channel and
lower-channel lowpass filters. Place a Buffer Amplifier between the output of the third
multiplier (which multiplies the outputs of the two filters) and the input of the VCO. This
amplifier has negative gain and the VCO has negative sensitivity. The minus signs cancel, and
the loop gain is positive.
Adjust the bandwidths of the two filters to approximately 26 kHz. (The Tuneable LPF’s clock
output has a frequency equal to 100 times the bandwidth.) Set the gain knob of each filter to a
mid-range position. (The line on this knob should be approximately vertical.)
Connect the BPSK carrier to the Costas loop input. Place a 100-kHz sinusoid (Master Signals)
on Channel A. (This should be the same 100-kHz sinusoid that was used in the modulator.)
Place a copy of the VCO output on Channel B. Use the Channel A sinusoid as the trigger
8
source. Connect a copy of the VCO output to the Frequency Counter. Adjust the gain of the
Buffer Amplifier until the loop achieves phase lock. If you have any difficulty obtaining phase
lock, make slight changes to the VCO nominal frequency (with the loop closed) using the tuning
knob on the VCO.
You can recognize phase lock as follows. The Frequency Counter will indicate that the VCO
output frequency is a stable 100 kHz. The oscilloscope will have a stable display for the VCO
output (as well as for the 100-kHz sinusoid). The stable oscilloscope display is the more reliable
indicator of phase lock.
You should observe that the VCO output is 90° out of phase with the 100-kHz sinusoid from
Master Signals. The VCO output may either lead or lag the 100-kHz sinusoid from Master
Signals. It depends on which lock point the Costas loop occupies. Take the Costas loop out of
lock by changing the Buffer Amplifier gain, then bring the loop back into lock. Repeat this
several times. You should find that taking the loop out of lock and then back into lock can
(sometimes) cause the lock point to change. You can recognize a change in lock point by noting
that the VCO output sometimes leads the 100-kHz sinusoid from Master Signals and sometimes
lags it. (But when the loop is in phase lock, the VCO output and the 100-kHz sinusoid from
Master Signals should always be in phase quadrature.)
Place a copy of the BPSK carrier (the input to the Costas loop) on Channel A. Place a copy of
the VCO output on Channel B. Use the (TTL) sync output of the Sequence Generator as the
external trigger source. You should observe that during some bit intervals the VCO output leads
the modulated carrier by 90° and during other bit intervals the VCO output lags by 90° .
Keep a copy of the BPSK carrier on Channel A. Place a copy of the local oscillator for the lower
channel (that is, the output of the Phase Shifter) on Channel B. Use the (TTL) sync output of the
Sequence Generator as the external trigger source.
You should observe that during some bit intervals the VCO output is in phase with the
modulated carrier and during other bit intervals the VCO output is out of phase by 180° . This
local oscillator is therefore suitable for a synchronous demodulation of the BPSK carrier.
9
Place a copy of the analog Y output from the Sequence Generator on Channel A. Place a copy of
the lower-channel lowpass filter output on Channel B. Use the (TTL) sync output of the
Sequence Generator as the external trigger source.
You are now comparing the original data (from the transmitter) to the demodulated data (in the
receiver). You should observe that the output of the lower-channel filter is an approximation to
either 𝑑(𝑡) or −𝑑(𝑡). Take the Costas loop out of lock by changing the gain of the Buffer
Amplifier, then bring the loop back into lock. When you do this, the lock point might change.
Repeat this several times. You should find that the output of the lower-channel filter is
sometimes 𝑑(𝑡) and sometimes −𝑑(𝑡), depending on the lock point.
Keep a copy of the Y output of the Sequence Generator on Channel A. Place a copy of the
upper-channel lowpass filter output on Channel B. Use the (TTL) sync output of the Sequence
Generator as the external trigger source. Considering Eq. (7) with 𝜃𝑐 − 𝜃𝑣 = 0 or 𝜃𝑐 − 𝜃𝑣 = 𝜋,
you might expect to see zero at the output of the upper-channel filter. However, you will likely
see instead a badly attenuated copy of either 𝑑(𝑡) or −𝑑(𝑡). The reason for this is that the loop
is, at any point in time, not exactly on the lock point. If the nominal frequency of the VCO is
slightly off 100 kHz, the loop has to work harder to lock and 𝜃𝑐 − 𝜃𝑣 is a little off the lock point.
Slightly adjust the nominal frequency of the VCO (with the loop closed) and try to minimize the
signal at the output of the upper-channel filter. Small adjustments in the gain of the Buffer
Amplifier might also help with this minimization.
So far you have used a Costas loop with positive loop gain. Now you are to experiment with a
negative loop gain. Remove the Buffer Amplifier from the loop, so that the loop error signal
(from the third multiplier) goes directly to the VCO input. Because the VCO sensitivity is
negative and all other gains in the loop are now positive, this new configuration has a negative
loop gain.
Adjust the gain of one of the lowpass filters until the loop is in phase lock. Place a copy of the
analog Y output of the Sequence Generator on Channel A. Place a copy of the upper-channel
lowpass filter output on Channel B. Use the (TTL) sync output of the Sequence Generator as the
external trigger source. You should find that either 𝑑(𝑡) or −𝑑(𝑡) appears on the output of the
upper-channel filter.
10
Take the Costas loop out of lock by changing the gain of one of the lowpass filters, then bring
the loop back into lock. Repeat this several times. You should find that taking the loop out of
lock and then back into lock can (sometimes) cause the lock point to change. The output of the
upper-channel filter will be 𝑑(𝑡) for the lock point 𝜃𝑐 − 𝜃𝑣 = 𝜋⁄2 and −𝑑(𝑡) for the lock point
𝜃𝑐 − 𝜃𝑣 = 3𝜋⁄2.
Keep a copy of the Y output of the Sequence Generator on Channel A. Place a copy of the
lower-channel lowpass filter output on Channel B. Use the (TTL) sync output of the Sequence
Generator as the external trigger source. You will likely see a badly attenuated copy of either
𝑑(𝑡) or −𝑑(𝑡) on the output of the lower-channel filter. Slightly adjust the nominal frequency of
the VCO (with the loop closed) and try to minimize the signal at the output of the lower-channel
filter. Small adjustments in the gain of a filter might also help with this minimization.
You are now done with the experiment. You should reflect on what you have accomplished in
this experiment. A BPSK carrier was demodulated without using a stolen carrier. In practice,
with the transmitter and receiver remote from each other, there is no stolen carrier. The receiver
must recreate an unmodulated carrier for use in synchronous demodulation. You have shown
that a Costas loop accomplishes this. It is all the more remarkable because there is no residual
carrier in the transmitted signal. Nonetheless, the frequency and phase information of the
(phantom) unmodulated carrier resides within the modulated carrier. The Costas loop extracts
this frequency and phase information.
11