Communications
Applications 10
Introduction
The great demand for Internet connectivity by consumers and the
wireless revolution have pushed the demand for DSP based com-
munication solutions to a very high level. What this chapter
attempts to do is work through some of the basic issues in using
real-time DSP to handle both analog and digital modulation
schemes. The first step in this process is getting analog commu-
nication waveforms into and out of the discrete-time domain.
Next follows a discussion of some basic signal processing func-
tions, such as a DSP Costas-Loop for coherent carrier recovery.
The environment where the communication signal resides,
the size weight and power requirements, and the market where
the communication services reside, dictates how to choose a par-
ticular implementation. These is no simple one approach satisfies
all solution. The dividing line between analog and DSP based
portions of a particular implementation is always moving
towards DSP, but where this line is placed depends on the above
mentioned factors. Once you decide to use DSP, then you must
decide which portions, if any are implemented using ASICs and
which can be done on a general purpose DSP. By visiting a few
vendor Web sites, you soon find that there are a vast array of
DSP Technology
• ASIC
• General purpose DSP
• A combination of the two
Transmitting Signals
In the book by Tretter1 DSP techniques for communication sys-
tem design is discussed, with emphasis on wireline modems. A
good blend of theory and practice is presented. From the intro-
ductory section we know that with the great variety of communi-
cation system scenarios there are more considerations.
Baseband/IF Transmitter
• The most direct approach for using DSP at the transmitter is
to simply modulate directly onto a discrete-time carrier and
pass the composite signal out through the D/A
a∗ [ n ] a[n]
Inphase Shaping
Filter
g[n] s[n]
Binary cos ω c n
Coder D/A BPF HPA
Data
b[n]
Shaping
Filter
Most Likely
Quadrature g[n] Frequency
b∗ [ n ] – sin ω c n Fs Translate Before
Im{} Re{} BPF and HPA
Carrier – jω c n
or IF Freq. e
• The coder output is likely to be an impulse train with the
shaping filter, g [ n ] , used to control the baseband transmitted
spectral occupancy
• The discrete-time signal prior to the D/A is of the form
s [ n ] = a [ n ] cos ( ω c n ) – b [ n ] sin ( ω c n ) (10.1)
where a [ n ] = a∗ [ n ] * g [ n ] , b [ n ] = b∗ [ n ] * g [ n ] ,
∞
a∗ [ n ] = a k δ[ n – kN s ] (10.2)
k = –∞
∞
b∗ [ n ] = b k δ[ n – kN s ] (10.3)
k = –∞
and N s is the number of samples per symbol
RF Microdevices RF2422
2.4 GHz Quadrature Modulator
• In this implementation the signals a [ n ] and b [ n ] are the
impulse modulator outputs convolved with the pulse shaping
filter
∞
a[n] = a k g [ n – kN s ] (10.5)
k = –∞
∞
b[n] = b k g [ n – kN s ] (10.6)
k = –∞
Bandwidth
Impulse
Data RC Efficient
Train Symbol
Filter Baseband
Sequence
Data
Data Bandwidth
Impulse
SRC SRC Efficient
Train Symbol
Filter Filter Baseband
Sequence
Data
in Noise
White Noise
G(F) ⋅ G(F) Rs
Full RC F 1 = ( 1 – α ) -----
Frequency 2
Response Rs
F 2 = ( 1 + α ) -----
2
R s = Symb. Rate
F
0 F1 F2
0.4
Zero Crossings Not at
0.2 16 Sample Intervals
0
-0.2
0 20 40 60 80 100 120 140 160 180 200
0.8
g[n]*g[n]/Ns
0.6
0.4
Now Zero Crossings at
0.2 16 Sample Intervals
-0.2
100 120 140 160 180 200 220 240 260 280 300
Index n
• To investigate further we will now implement a binary phase-
shift keyed (BPSK) modulator ( a k = ± 1, b k = 0 ) using
both rectangular and SRC pulse shaping
% A Square-Root Raised Cosine Pulse Shaping
% Demo that Creates a BPSK waveform. src_bpsk.m
%
% Mark Wickert 5/98
%
% Set Fs = 8 kHz
% Set Rb = 500 bits/sec
% Create a record of M = 1000 symbols using m_ary.m
% which creates symbols of amplitude 0 & 1
Fs = 8000;
Rb = 500;
M = 1000;
d = m_ary(2,M,1);
d = 2*d - 1; % translate to -1/+1 amplitudes
d = [d zeros(M,Fs/Rb-1)]; % Set up for impulse modulation
d = reshape(d',1,M*Fs/Rb);
n = 0:(M*Fs/Rb-1);
% Square-root raised cosine filter and then modulate
% on a cosine carrier of 2000 Hz
b_src = sqrt_rc_imp(Fs/Rb,0.35,6);
df = filter(b_src*Rb/Fs,1,d); %Filter with unity DC gain
Fc = 2000;
x = df.*cos(2*pi*Fc/Fs*n); %SRC Shaped BPSK
% Rectangle Pulse Shape filter and then modulate
% on a cosine carrier of 2000 Hz
b_rec = ones(1,Fs/Rb)/(Fs/Rb); %Make unity gain rec
dff = filter(b_rec,1,d);
y = dff.*cos(2*pi*Fc/Fs*n); %Rectangle Pulse BPSK
-20
REC
-30
-40
S(F) in dB
-50
1 kHz
-60
SRC
-70
α = 0.35
-80
Fc
-90
0 500 1000 1500 2000 2500 3000 3500 4000
Frequency in Hz
L = length(data);
% set axis limits
Limit = max([abs(min(data)) abs(max(data))]);
axis([0,W,-Limit,Limit]);
while L >= W+OFS,
temp = data(1+OFS:W+OFS);
plot(x,temp);
hold on
data = data(W+1:L);
L = length(data);
end
hold off
» eyeplot(filter(b_src,1,df(1000:5000)),32,105)
0.5
-0.5
-1
-1.5
-2
0 5 10 15 20 25 30
Index n
Receiving Signals
Signal processing at the receiver is typically more complex than
at the transmitter. There are a lot of details involved. Only the
main points will be considered here, or at least for now. In addi-
tion to the wireline modem design details given in Tretter, a very
good source for more general information on DSP implementa-
tion of digital communication receivers is Meyr1.
X ( f ) = FT { x ( t ) }
~2W
Fc – W Fc + W f
–Fc Fc
LPF
~Fs/2 A/D
x(t) 0°
xI ( t ) xI [ n ]
Power
Splitter
RF/IF Input – 9 0°
LPF
~Fs/2 A/D
xQ ( t ) xQ [ n ]
IQ Demodulator ~ cos ( Ω c t )
Local Oscillator
HT { m ( t )c ( t ) } = m ( t )ĉ ( t ) (10.19)
– A practical example is
HT { m ( t ) cos Ω c t } = m ( t ) sin Ω c t, F c > W 1
• The signal
x + ( t ) = x ( t ) + jx̂ ( t ) (10.20)
is known as the analytic signal or pre-envelope associated
with x ( t )
• The Fourier transform of x + ( t ) is
X + ( Ω ) = 2X ( Ω )u ( Ω ) (10.21)
where u ( Ω ) is the usual step function, except now in the fre-
quency domain
• Referring back to the complex envelope in (10.9), we see that
– jΩ c t – jΩ c t
x̃ ( t ) = x + ( t )e = [ x ( t ) + jx̂ ( t ) ]e (10.22)
and
x I ( t ) = x ( t ) cos ( Ω c t ) + x̂ ( t ) sin ( Ω c t ) (10.23)
x Q ( t ) = – j [ x ( t ) sin ( Ω c t ) – x̂ ( t ) cos ( Ω c t ) ] (10.24)
Negative Freqs.
0.3
0.2
0.1
0
0 1000 2000 3000 4000 5000 6000 7000 8000
1.4
Of the form
1.2
1
2X ( F )u ( F )
|X+(F)|
0.8
0.6
as expected
0.4
0.2
0
0 1000 2000 3000 4000 5000 6000 7000 8000
Frequency in Hz
-5
-10
N = 10
-15
-20
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
0
|B20(f)|dB
-5
-10
N = 20
-15
-20
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
0
|B30(f)|dB
-5
-10
N = 30
-15
-20
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
Normalized Frequency (Fs = 1 Hz)
– Real-time implementation of the above is easy
• To properly create an analytic signal using an HT FIR filter
also requires that the real part be delayed by N ⁄ 2 (assume N
is even, number of taps is odd)
2 cos 2πF c t
• Assuming no noise is present
r ( t ) = a ( t ) cos 2πF c t (10.26)
and
2
z ( t ) = 2a ( t )cos ( 2πF c t )
(10.27)
= a ( t ) + a ( t ) cos [ 2π ( 2F c )t ]
– jω c n
e
• From (10.19)
r + [ n ] = a [ n ] cos ( ω c n ) + ja [ n ] sin ( ω c n )
(10.29)
jω c n
= a [ n ]e
so
– jω c n
y [ n ] = r + [ n ]e = a[n] (10.30)
• A more practical model for r [ n ] is
r [ n ] = a [ n ] cos ( ω c n + θ [ n ] ) (10.31)
where ω c is still the nominal carrier frequency (in the DSP
domain), and θ [ n ] is a constant or slowly varying phase
– Note: θ [ n ] may also include a frequency error, e.g., θ [ n ]
= Δωn = 2π ΔF ⁄ F s × n
r + [ n ] = r [ n ] + jr̂ [ n ] Re { c [ n ] } ≈ a [ n ]
r[n] c[n]
– jsignω q[n]
r̂ [ n ]
–j ( ωc n + φ [ n ] ) ka
–j ( )
e ----------------
e 1–z
–1
v[n]
ωc n + φ [ n ] –1 kp
z
Loop Filter
Complex Baseband
Costas Loop ωc Set Quiescent VCO Frequency
–j ( ωc n + φ [ n ] )
c [ n ] = r + [ n ]e
(10.33)
j(θ[n] – φ[n])
= a [ n ]e
• The demodulated data signal is the real part of c [ n ]
Re { c [ n ] } = a [ n ] cos ( θ [ n ] – φ [ n ] ) ≈ a [ n ] (10.34)
for θ [ n ] – φ [ n ] ≈ 0
2
q [ n ] = a [ n ] cos ( θ [ n ] – φ [ n ] ) sin ( θ [ n ] – φ [ n ] ) (10.35)
2
= 0.5a [ n ] sin { 2 ( θ [ n ] – φ [ n ] ) }
• For a small phase error, θ [ n ] – φ [ n ] « 1 , we can linearize
the control loop since
2
q[n] ≅ a [n](θ[n] – φ[n]) (10.36)
θ[n]
k1 q[n]
+
-
ka
φ[n] ----------------
–1
1–z
v[ n]
–1 kp
z
Loop Filter
Linearized Costas Loop
– In the linearized model, the lowpass filtering action of the
2
closed-loop response allows us to replace a [ n ] with
2
k 1 = E { a [ n ] } , which for BPSK is just one
• The closed-loop system performance can be obtained from
the system function
Φ(z)
H ( z ) = ------------ (10.37)
Θ(z)
–1 k p – 1
k 1 ( k p + k a )z 1 – ----------------z
kp + ka
H ( z ) = --------------------------------------------------------------------------------------------------------
–1 2 kp –1
( 1 – z ) + k 1 ( k p + k a )z 1 – ----------------z
–1
kp + ka (10.41)
–1 –2
k 1 ( k p + k a )z – k 1 k p z
= -----------------------------------------------------------------------------------------------
–1 –2
-
1 – [ 2 – k 1 ( k p + k a ) ]z + ( 1 – k 1 k p )z
0.8
F s = 8 kHz
phi[n]
0.6
k 1 = 2.25, k p = 0.05, k a = 0.002
0.4
0.2
0
0 2 4 6 8 10 12 14 16 18 20
Time in ms
MATLAB Simulation
• A complete simulation of the loop using an M = 30 Hilbert
transforming FIR filter is constructed to verify proper loop
performance with simulated signals
• For the simulation an unmodulated carrier at 2000 Hz with
amplitude 1500 is input to the system
– Note: 1500 is a representative amplitude for digitized sinu-
n = 0:N;
%Generate carrier at F0 with amplitude similar to DSK
%x = 1500*cos(2*pi*50/Fs*n).*cos(2*pi*F0/Fs*n);%with/DSB Mod.
x = 1500*cos(2*pi*F0/Fs*n); %Unmodulated carrier
%Generate analytic signal
xa = filter([zeros(1,15),1],1,x) + j*filter(b,1,x);
q = 0; q_old = 0; v = 0; v_old = 0;
accum = 0; %NCO accumulator
out = zeros(1,N+1) + j*zeros(1,N+1);
out_i = zeros(1,N+1);
q = zeros(1,N+1);
v = zeros(1,N+1);
%Begin simulation loop to model feedback system
for i=1:N+1
out(i) = xa(i)*exp(-j*accum);
out_i(i) = real(out(i));
q(i) = real(out(i))*imag(out(i));
q(i) = q(i)*1e-6;
%Loop filter
v(i) = v_old + (kp+ka)*q(i) - kp*q_old;
%Update filter states
v_old = v(i); q_old = q(i);
%Apply a frequency step at 600 samples &
%Wrap the phase in accumulator
if i <= 600
accum = mod(accum + 2*pi*F0/Fs + v(i),2*pi);
else
accum = mod(accum + 2*pi*(F0-100)/Fs + v(i),2*pi);
end
end %Simulation loop
1400
Expected Constant
Output at 1500
1200
100 Hz Frequency
Step is applied to
1000 the VCO Here
Re{c[n]}
800
600
The loop is naturally
400
acquiring in this region
and filter transients are
dying down.
200
-200
0 10 20 30 40 50 60 70 80 90 100
Time in ms
120
Normalized Loop Filter Output
100
v[n] × F
80 Plot of ----------------------s
2π
60
40
20
0
0 2 4 6 8 10 12 14 16 18 20
Time in ms
1000
500
Re{c[n]}
-500
-1000
-1500
0 20 40 60 80 100 120
Time in ms
//project Costas.pjt
#include <math.h>
#include "Hilbert_31.h" //coefficients in float format
int rand_int(void);
void hilbert_xform()
{
int i;
float acc;
acc = 0.0;
DLY[0] = in;
for (i=0; i<NH; i++)
{
acc += Hilbert[i] * DLY[i];
}
out_i = DLY[15];
out_q = acc;
for (i=NH-1; i>0; i--)
{
DLY[i] = DLY[i-1]; /*Update Buffers*/
}
}
void main()
{
accum = 0.0;
q_old=0.0;
v=0.0;
twopi = 8*atan(1);
T = 1/18300.0; //Sampling Period
wo = twopi*4000; //VCO quiescent frequency
kv = 1e-7, kp = 0.05, ka = 0.002;
s_indx = 0;
select_output = 1; //in-phase output select
select_buffer = 1; //load accum into samples[] buffer
noise_level = 0; //initialize noise level at 0
comm_intr(); //init DSK, codec, McBSP
while(1); //infinite loop
}
int rand_int(void)
{
static int a = 100001;
a = (a*125) % 2796203;
return a;
}
• The sampling rate has been increased to 18.3 kHz and the
NCO (VCO) quiescent frequency increased to 4000 kHz
• Noise may also be added to the input signal which is supplied
from a function generator
• A GEL file defining three sliders is used to
AM Mod FM Mod
Parameters Parameters
Noise
Analog
Modulated
Output(s)
Function Carrier
Generator
Loop CCS Plots
Carrier Carrier
Freq. Ampl. C6711 Costas Loop
∞
a(t) = c n p ( t – nT b ) (10.43)
n = –∞
slow
response,
Loop Filter Output, v
fast
Loop Filter Output, v
response,
large BW
High Input
Level