digital signal processing project...
TRANSCRIPT
Digital Signal Processing
PROJECT REPORT Amplitude Modulation – Single Sideband Signal Generation
Using TMS320C5515 eZDSPTM USB Stick
April, 28th 2014
Đại học Duy Tân
Khoa Điện – Điện tử
1 Project report
April, 28th 2014
Table of Contents
I) Table of Contents ..................................................... 1
II) Abstract .................................................................... 2
III) Introduction ............................................................. 3
1) MODULATION ............................................. 3
2) DOUBLE SIDEBAND MODULATION ............. 4
3) SINGLE SIDE-BAND (SSB) ............................ 5
a)The Benefits of SSB .................................. 6
b)The Cost of SSB ........................................ 6
IV) Related theories ....................................................... 7
1) FAST FOURIER TRANSFORM (FFT) .............. 7
2) HILBERT TRANSFORM ................................. 7
3) SINGLE SIDEBAND MODULATION ............... 8
V) Implementation ....................................................... 10
1) 1) MATLAB .................................................... 10
2) 2) TMS320C5515 eZDSPTM USB Stick ............ 13
VI) Conclusion ............................................................... 17
VII) References ............................................................. 21
2 Project report
April, 28th 2014
Abstract
This project studies one variant of Amplitude Modulation: Single Sideband (SSB) Modulation. In this report, we will discover the concept of amplitude modulation, double sideband and single sideband signals and their applications. We will then build a demonstration of SSB modulation using Matlab and TMS320C5515 eZDSPTM USB Stick Development Tool. The underlying theories used to build this demonstration are also explained in details.
3 Project report
April, 28th 2014
Introduction
1) MODULATION
In electronics and telecommunications, modulation is the process of varying one or more
properties of a periodic waveform, called the carrier signal (high frequency signal), with a
modulating signal (low frequency signal) that typically contains information to be
transmitted.
A modulator is a device that performs modulation. A demodulator (sometimes detector or
demod) is a device that performs demodulation, the inverse of modulation. A modem
(from modulator–demodulator) can perform both operations.
There are 2 kinds of modulation: digital and analog. In our group project, we only concern
about continuous wave analog modulation. Common analog modulation techniques are:
Amplitude modulation (AM) (here the amplitude of the carrier signal is varied in accordance to the instantaneous amplitude of the modulating signal)
o Double-sideband modulation (DSB) o Single-sideband modulation (SSB, or SSB-AM) o Vestigial sideband modulation (VSB, or VSB-AM) o Quadrature amplitude modulation (QAM)
Angle modulation o Frequency modulation (FM) o Phase modulation (PM)
4 Project report
April, 28th 2014
2) DOUBLE SIDEBAND MODULATION
Double sideband modulation is the original form of amplitude modulation, in which the modulating signal containing the message of interest is multiplied with the sinusoidal carrier signal of frequency wc for transmitting. This process results in two copies of the spectrum of the modulating signal in the DSB spectrum, one shifted to wc and the other shifted to - wc. The frequencies on either side of the carrier are called the sidebands. The bandwidth of a DSB signal is thus twice the bandwidth of the modulating signal.
5 Project report
April, 28th 2014
3) SINGLE SIDE-BAND (SSB)
Conventional AM transmission has several problems:
Bandwidth is wasted by having two identical side-bands on either side of the carrier The efficiency is limited to 33% to prevent distortion in the receiver when
demodulating. The carrier signal is present even if nothing is being transmitted
In radio communications, single-sideband modulation (SSB) or single-sideband
suppressed-carrier (SSB-SC) is a refinement of amplitude modulation that more efficiently
uses transmitter power and bandwidth. Amplitude modulation produces an output signal
that has twice the bandwidth of the original baseband signal. Single-sideband modulation
avoids this bandwidth doubling, and the power wasted on a carrier, at the cost of increased
device complexity and more difficult tuning at the receiver.
6 Project report
April, 28th 2014
a) The Benefits of SSB
By eliminating the duplicated side-band and carrier from transmission, the bandwidth has been reduced by half. By reducing the bandwidth transmitted, you may put double the number of channels (or stations) in the same frequency band.
Because the carrier if also filtered out, there is no transmission unless information is being sent. This is useful if you are trying to be covert. The efficiency is also improved considerably. In theory, since you are only transmitting side-band information then the efficiency is 100 %. In practice, including losses in the circuitry and antenna, a more typical efficiency would be 80 -> 95 %.
b) The Cost of SSB
To make the SSB system work, every receiver must now contain its own carrier oscillator. An oscillator that can cover the range of all possible frequencies in your band and be stable does not come cheaply. Therefore, SSB systems are usually limited to things that already are expensive and/or costly or situations where the improved performance is essential (like the military).
This is what the SSB transmitter looks like:
The SSB receiver looks like:
7 Project report
April, 28th 2014
Related theories
1) FAST FOURIER TRANSFORM (FFT)
In summary, the Fast Fourier Transform (FFT) is an algorithm to compute the Discrete
Fourier Transform (DFT) and its inverse. A Fourier transform converts time (or space) to
frequency and vice versa; an FFT rapidly computes such transformations by factorizing the
DFT matrix into a product of sparse (mostly zero) factors.
2) HILBERT TRANSFORM
In AC circuit theory we use complex exponentials to represent real sinusoidally varying quantities with the understanding that the real part of the complex exponential gives the physical quantity of interest. The analytic signal of a real function plays the same role for
more general waveforms. Given a real function f(t) with Fourier transform , the analytic signal fa(t) is defined by
This is just the inverse Fourier transform of the positive frequency part of F(w). The Fourier
transform of fa(t) is given by
The Hilbert transform of f(t) is defined to be the imaginary part of fa(t) and is denoted by
Thus
The Fourier transform of this relationship is
where is the Fourier transform of . Solving this yields
8 Project report
April, 28th 2014
3) SINGLE SIDEBAND MODULATION
For any signal g(t), let
be two complex-valued signals associated with g(t). The significance of these two signals can be seen from their Fourier transforms. We have
where u (f) is the unit step function, and, similarly,
Thus g+(t) has spectral components (equal to those of g(t)) at positive frequencies only, i.e., g+(t) has a right-sided spectrum. Similarly, g−(t) has spectral components (equal to those of g(t)) at negative frequencies only and hence has a left-sided spectrum. These spectra are illustrated in the following figure
It is now straightforward to express upper- and lower-sideband signals in terms of g+(t) and g−(t). Let g(t) be the modulating signal, assumed bandlimited to W Hz, and let fc > W be the carrier frequency. In the frequency domain, the upper sideband signal is given by
and the lower sideband signal is given by
as sketched in the figure below:
9 Project report
April, 28th 2014
It follows from the frequency-shifting property of the Fourier transform that
A similar derivation shows that
Thus we see that single-sideband modulation can be regarded and implemented as a form of quadrature amplitude modulation (QAM), with the modulating signal g(t) placed in the in-phase channel and the Hilbert transform of g(t) (or its negative) placed in the quadrature channel. A block diagram illustrating this approach is given in the following figure
10 Project report
April, 28th 2014
Implementation
1) MATLAB
In Matlab, we used another approach to the model presented above. This second method
uses Hilbert Transformer and Spectral Shifter and can be used interchangeably with the
first method. Later on when implement SSB modulation on TMS320C5515 eZDSPTM USB
Stick we will use the first method. This is to show the flexibility of implementing SSB
modulation, i.e. different models can be used depending on resources and tastes.
The SSB modulated signal is
where ma denotes the analytic signal and the Hilbert transform of m.
Note that this simple mathematical transformation returns the same final result as the first
method, yet now we have a different way to obtain it:
11 Project report
April, 28th 2014
Matlab code is as shown:
% Target frequencies
Fm = 400; % base frequency
Fc = 4000; % carrier frequency
Fs = 48e3; % sampling frequency
% Base sine signal
nsample = 4 * Fs / Fm;
n = 0 : nsample;
signal_m = sin(2 * pi * n * Fm / Fs);
% Number of samples
NFFT = 4096;
% Generate the double side band signal
carrier = sin(2 * pi * n * Fc / Fs);
xcarrier = exp(1i * 2 * pi * n * Fc / Fs);
dsbSig = signal_m .* carrier;
% Apply transformer, get the result
mc = hilbert(signal_m);
% Shift the signal frequency to desire Fc
mcm = mc .* xcarrier;
% Plotting the result
%Set axis limit
Xlim = [0 6];
Ylim = [-80 -20];
% Plotting the double side band
subplot (3,1,1);
periodogram(dsbSig, [], 4096, Fs);
title({'Double Side Band AM'});
set(gca,'XLim',Xlim,'YLim',Ylim)
set(gcf,'Color','white');
% Ploting the single side band obtain by hilbert
subplot(3,1,2);
periodogram(real(mcm), [], 4096, Fs);
title({'Single Side Band AM'});
set(gca,'XLim',[0 6],'YLim',[-80 -20])
set(gcf,'Color','white');
12 Project report
April, 28th 2014
Using the above Matlab codes, we obtain the result:
13 Project report
April, 28th 2014
2) TMS320C5515 eZDSPTM USB Stick
The the AIC3204_tone_headphone.c is modified as follows: /*
* Copyright 2010 by Spectrum Digital Incorporated.
* All rights reserved. Property of Spectrum Digital Incorporated.
*/
/*
* AIC3204 Tone
*
*/
#include "stdio.h"
#include "usbstk5515.h"
extern Int16 AIC3204_rset( Uint16 regnum, Uint16 regval);
#define XmitL 0x10
#define XmitR 0x20
#define Fs 48000
#define Fa 500
#define Fc 4000
#define PI 3.141592654
#include "math.h"
/* ------------------------------------------------------------------------ *
* *
* AIC3204 Tone *
* Output a 1 kHz tone through the HEADPHONE jack *
* *
* ------------------------------------------------------------------------ */
Int16 aic3204_tone_headphone( )
{
double* signal;
short ptsig1[480];
short ptsig2[480];
int x;
int nsample = 480;
signal = (double*) malloc( nsample * sizeof(double));
for ( x = 0; x < nsample; x++)
{
signal[x] = cos (2*PI*x*Fa/Fs) * cos (2*PI*x*Fc/Fs);
}
for ( x = 0; x < nsample; x++)
{
14 Project report
April, 28th 2014
ptsig1[x] = 1333 * signal[x];
}
for ( x = 0; x < nsample; x++)
{
signal[x] = cos (2*PI*x*Fa/Fs -PI/2) * sin (2*PI*x*Fc/Fs);
}
for ( x = 0; x < nsample; x++)
{
ptsig2[x] = 1333 * signal[x];
}
free(signal);
short ptsig3[480];
for ( x = 0; x < nsample; x++)
{
ptsig3[x] = ptsig1[x] + ptsig2[x];
}
/* Pre-generated sine wave data, 16-bit signed samples */
Int16 sinetable[48] = {
0x0000, 0x10b4, 0x2120, 0x30fb, 0x3fff, 0x4dea, 0x5a81, 0x658b,
0x6ed8, 0x763f, 0x7ba1, 0x7ee5, 0x7ffd, 0x7ee5, 0x7ba1, 0x76ef,
0x6ed8, 0x658b, 0x5a81, 0x4dea, 0x3fff, 0x30fb, 0x2120, 0x10b4,
0x0000, 0xef4c, 0xdee0, 0xcf06, 0xc002, 0xb216, 0xa57f, 0x9a75,
0x9128, 0x89c1, 0x845f, 0x811b, 0x8002, 0x811b, 0x845f, 0x89c1,
0x9128, 0x9a76, 0xa57f, 0xb216, 0xc002, 0xcf06, 0xdee0, 0xef4c
};
Int16 j, i = 0;
Int16 sample;
/* Configure AIC3204 */
AIC3204_rset( 0, 0 ); // Select page 0
AIC3204_rset( 1, 1 ); // Reset codec
AIC3204_rset( 0, 1 ); // Select page 1
AIC3204_rset( 1, 8 ); // Disable crude AVDD generation from DVDD
AIC3204_rset( 2, 1 ); // Enable Analog Blocks, use LDO power
AIC3204_rset( 0, 0 );
/* PLL and Clocks config and Power Up */
AIC3204_rset( 27, 0x0d ); // BCLK and WCLK are set as o/p; AIC3204(Master)
AIC3204_rset( 28, 0x00 ); // Data ofset = 0
AIC3204_rset( 4, 3 ); // PLL setting: PLLCLK <- MCLK, CODEC_CLKIN <-PLL
CLK
AIC3204_rset( 6, 7 ); // PLL setting: J=7
AIC3204_rset( 7, 0x06 ); // PLL setting: HI_BYTE(D=1680)
AIC3204_rset( 8, 0x90 ); // PLL setting: LO_BYTE(D=1680)
AIC3204_rset( 30, 0x88 ); // For 32 bit clocks per frame in Master mode ONLY
// BCLK=DAC_CLK/N =(12288000/8) = 1.536MHz = 32*fs
AIC3204_rset( 5, 0x91 ); // PLL setting: Power up PLL, P=1 and R=1
AIC3204_rset( 13, 0 ); // Hi_Byte(DOSR) for DOSR = 128 decimal or 0x0080
DAC oversamppling
AIC3204_rset( 14, 0x80 ); // Lo_Byte(DOSR) for DOSR = 128 decimal or 0x0080
15 Project report
April, 28th 2014
AIC3204_rset( 20, 0x80 ); // AOSR for AOSR = 128 decimal or 0x0080 for
decimation filters 1 to 6
AIC3204_rset( 11, 0x82 ); // Power up NDAC and set NDAC value to 2
AIC3204_rset( 12, 0x87 ); // Power up MDAC and set MDAC value to 7
AIC3204_rset( 18, 0x87 ); // Power up NADC and set NADC value to 7
AIC3204_rset( 19, 0x82 ); // Power up MADC and set MADC value to 2
/* DAC ROUTING and Power Up */
AIC3204_rset( 0, 1 ); // Select page 1
AIC3204_rset( 0x0c, 8 ); // LDAC AFIR routed to HPL
AIC3204_rset( 0x0d, 8 ); // RDAC AFIR routed to HPR
AIC3204_rset( 0, 0 ); // Select page 0
AIC3204_rset( 64, 2 ); // Left vol=right vol
AIC3204_rset( 65, 0); // Left DAC gain to 0dB VOL; Right tracks Left
AIC3204_rset( 63, 0xd4 ); // Power up left,right data paths and set channel
AIC3204_rset( 0, 1 ); // Select page 1
AIC3204_rset( 0x10, 0x00 );// Unmute HPL , 0dB gain
AIC3204_rset( 0x11, 0x00 );// Unmute HPR , 0dB gain
AIC3204_rset( 9, 0x30 ); // Power up HPL,HPR
AIC3204_rset( 0, 0 ); // Select page 0
USBSTK5515_wait( 100 ); // wait
/* ADC ROUTING and Power Up */
AIC3204_rset( 0, 1 ); // Select page 1
AIC3204_rset( 0x34, 0x30 );// STEREO 1 Jack
// IN2_L to LADC_P through 40 kohm
AIC3204_rset( 0x37, 0x30 );// IN2_R to RADC_P through 40 kohmm
AIC3204_rset( 0x36, 3 ); // CM_1 (common mode) to LADC_M through 40 kohm
AIC3204_rset( 0x39, 0xc0 );// CM_1 (common mode) to RADC_M through 40 kohm
AIC3204_rset( 0x3b, 0 ); // MIC_PGA_L unmute
AIC3204_rset( 0x3c, 0 ); // MIC_PGA_R unmute
AIC3204_rset( 0, 0 ); // Select page 0
AIC3204_rset( 0x51, 0xc0 );// Powerup Left and Right ADC
AIC3204_rset( 0x52, 0 ); // Unmute Left and Right ADC
AIC3204_rset( 0, 0 );
USBSTK5515_wait( 200 ); // Wait
/* I2S settings */
I2S0_SRGR = 0x0;
I2S0_CR = 0x8010; // 16-bit word, slave, enable I2C
I2S0_ICMR = 0x3f; // Enable interrupts
/* Play Tone */
for ( i = 0 ; i < 1000 ; i++ )
{
for ( j = 0 ; j < 1000 ; j++ )
{
for ( sample = 0 ; sample < nsample ; sample++ )
{
16 Project report
April, 28th 2014
while((XmitR & I2S0_IR) == 0); // Wait for transmit
interrupt to be pending
// I2S0_W0_MSW_W = (sinetable[sample]) ; // 16 bit left channel
transmit audio data
// I2S0_W1_MSW_W = (sinetable[sample]) ; // 16 bit right channel
transmit audio data
//DSB
// I2S0_W0_MSW_W = (ptsig1[sample]) ; // 16 bit left channel
transmit audio data
// I2S0_W1_MSW_W = (ptsig1[sample]) ; // 16 bit right channel
transmit audio data
//X
// I2S0_W0_MSW_W = (ptsig2[sample]) ; // 16 bit left channel
transmit audio data
// I2S0_W1_MSW_W = (ptsig2[sample]) ; // 16 bit right channel
transmit audio data
//SSB
I2S0_W0_MSW_W = (ptsig3[sample]) ; // 16 bit left channel
transmit audio data
I2S0_W1_MSW_W = (ptsig3[sample]) ; // 16 bit right channel
transmit audio data
}
}
}
/* Disable I2S */
I2S0_CR = 0x00;
return 0;
}
17 Project report
April, 28th 2014
Conclusion
In this project, we successfully built the demonstration of AM-SSB modulation on both Matlab and
TMS320C5515 eZDSPTM USB Stick. This helps us to have a deeper insight of AM-SSB in application
and to understand the underlying theories leading to this method of broadcasting signals.
The results captured from Scope are as shown:
Double sideband signal
18 Project report
April, 28th 2014
Double sideband frequency spectrum
Single Sideband signal
19 Project report
April, 28th 2014
Zooming version of Single Sideband signal
Single Sideband Frequency spectrum
20 Project report
April, 28th 2014
Low Single Sideband signal
Low Single Sideband Frequency spectrum
21 Project report
April, 28th 2014
References
[1] S.M. Tan, Chapter 5: The Hilbert transform and linear modulation theory, Linear
Systems, The University of Auckland, retrieved on April 28th 2014
[2] Frank R. Kschischang, The Hilbert Transform, University of Toronto, October 22, 2006,
retrieved on April 28th 2014
Software used: Soundcard Scope v1.41, C. Zeitnitz
Illustrating images of C5515 eZDSP USB Stick Development Tool are taken from http://www.ti.com/tool/tmdx5515ezdsp.
All source codes in this report are taken from the usbstk5515_v1 library associated with C5515 eZDSP USB Stick Development Tool, provided by Spectrum Digital Inc..