Académique Documents
Professionnel Documents
Culture Documents
Thuong Le-Tien
P . F . I . E . V
Project Report
AMPLITUDE MODULATION
GROUP 1
Abstract
As early as the 1950s, designers of signal processing systems were using
digital computers to simulate and test their designs. It didn’t take too long to
realize that the digital algorithms developed to drive the simulations could be
used to carry out the signal processing directly – and so the digital signal
processor was born. With the incredible development of microprocessor chips
over the last decades, digital signal processing has become a hugely
important topic. Speech synthesis and recognition, image and music
enhancement, robot vision, pattern recognition, motor control, spectral
analysis, anti-skid braking and global positioning are just a few of the diverse
applications of digital signal processors.
This report contains four main parts. Part one introduces the DSP course as
well as its applications in our life. Part two will talk about the MATLAB based
programs and their results. In part three, programs based on the hardware will
be shown beside their results. And the last part contains some comparisons
and conclusions in terms of signal processing.
Abstract 3 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
Acknowledgements
The student group would like to thank Associate Professor Dr. Thuong Le-Tien
who officially taught us the theory of digital signal processing and helped us
approach a new horizon of knowledge. Moreover, he did not only support us the
study of hardware but also instructed us step-by-step whole heartedly to handle
potential problems.
Finally, special thanks to our families for their unstinting encouragement and
support.
Acknowledgements 4 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
List of contents
Abstract .................................................................................................. 3
Acknowledgements .............................................................................. 4
1. Introduction........................................................................................ 7
4. Conclusions........................................................................................ 35
5. References ......................................................................................... 36
List of figures
Figure 1- Functional Block Diagram............................................................................................. 11
Figure 2- Modulating Signal ........................................................................................................... 14
Figure 3- Carrier wave signal ......................................................................................................... 15
Figure 4- Modulated signal (𝜇 = 0.5) ............................................................................................ 15
Figure 5- Modulated signal (𝜇 = 1.5) ............................................................................................ 16
Figure 6- Periodogram of modulated signal ............................................................................. 17
Figure 7- C5515 eZdsp USB Stick Block Diagram ...................................................................... 18
Figure 8- Project AM Block Diagram ........................................................................................... 19
Figure 9- Main Flowchart ................................................................................................................ 20
Figure 10- AIC3204 Configuration Flowchart ............................................................................ 22
Figure 11- Read data flowchart ................................................................................................... 23
Figure 12- Modulation flowchart .................................................................................................. 24
Figure 13- Write data flowchart .................................................................................................... 25
Figure 14- Create 1KHz sinusoidal signal from Function Generator ................................... 26
Figure 15- Modulating signal (1KHz) ............................................................................................ 27
Figure 16- Carrier wave (10KHz).................................................................................................... 27
Figure 17- Modulated signal with 𝛍 = 0.1 ................................................................................... 28
Figure 18- Modulated signal with 𝛍 = 0.5 ................................................................................... 28
Figure 19- Modulated signal with 𝛍 = 1....................................................................................... 29
Figure 20- Modulated signal with 𝛍 = 1.5 ................................................................................... 29
1. Introduction
1.1. DSP course
First of all, we need to answer the question: What is Digital Signal Processing
(DSP)?
Digital: operating by the use of discrete signals to represent data in the form of
numbers.
Signal: a parameter (electrical quantity or effect) that can be varied in such a
way as to convey information.
Processing: a series operations performed according to programmed
instructions.
So we can define that DSP is changing or analyzing information which is
measured as discrete sequences of numbers. It’s not very hard to find out
applications of DSP around us, which are very familiar to our day life.
In communications:
Telephone – transmission of information in digital form via telephone lines,
modem technology, mobile phones
Encoding and decoding of the information sent over a physical channel (to
optimize transmission or to detect or correct errors in transmission)
In music applications:
Recording
Playback
Manipulation (mixing, special effects)
Chapter 1 7 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
In image processing:
Content based image retrieval – browsing, searching and retrieving images
from database
Image enhancement
Compression – reducing the redundancy in the image data to optimize
transmission or storage
In speech applications:
Noise reduction – reducing background noise in the sequence produced by a
sensing device (microphone)
Speech recognition – differentiating between various speech sounds
Synthesis of artificial speech – text to speech systems for blind
Chapter 1 8 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
DSP is used widely in more and more different domains thanks to its advantages:
Digital system can be simply reprogrammed for other applications / ported to
different hardware / duplicated
(Reconfiguring analog system means hardware redesign, testing, verification)
DSP provides better control of accuracy requirements
(Analog system depends on strict components tolerance, response may drift
with temperature)
Digital signals can be easily stored without deterioration
(Analog signals are not easily transportable and often can’t be processed off-
line)
More sophisticated signal processing algorithms can be implemented
(Difficult to perform precise mathematical operations in analog form).
“Learning digital signal processing is not something you accomplish; it’s a journey
you take”
R.G Lyons, Understanding Digital Signal processing
Chapter 1 9 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
1.2.1. Features
The TMS320C5515 eZdsp USB Stick has following special features suitable for
DSP:
High-Performance, Low-Power
TMS320C5515 DSP builds on the TMS320C5514 DSP with an additional 64 KB
on-chip memory (320 KB total)
Up to 1024-point programmable FFT hardware accelerator
Integrated LCD display controller and 10-bit, 4-channel SAR ADC – reduce
system cost and enable more user interactive portable features
Scalable and pin-to-pin compatible with the TMS320C5514 DSP allowing for
the ability to design an entire product portfolio using the same hardware
and software platform
Chapter 1 10 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
1.2.3. Applications
This kit is a multifunction-hardware which can be used for following
applications:
Portable audio recording
Wireless microphone
Noise cancellation headphones
Medical monitoring
Biometrics
Smart sensors
Chapter 1 11 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
2. MATLAB-based programs
2.1. Objectives
clear
close all
clc
for i=1:480
signal(i) = Am*sin(2*pi*fm*(i-1)/48000);
carrier(i) = Ac*sin(2*pi*fc*(i-1)/48000);
xc(i)=(1+m*signal(i))*carrier(i);
end
Chapter 2 12 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
% Plot waves
figure
plot(signal,'b')
figure
plot(carrier,'r')
figure
plot(xc,'k')
% Modulating Signal
fid=fopen('modulatingsignal.h','w');
fprintf(fid,'float Signal[480]={');
fprintf(fid,'%f, ' ,signal(1:479));
fprintf(fid,'%f' ,signal(480));
fprintf(fid,'};\n');
fclose(fid);
% Carrier Wave
fid=fopen('carierwave.h','w');
fprintf(fid,'float carrier[480]={');
fprintf(fid,'%f, ' ,carrier(1:479));
fprintf(fid,'%f' ,carrier(480));
fprintf(fid,'};\n');
fclose(fid);
% Modulated Signal
fid=fopen('modulatedsignal.h','w');
fprintf(fid,'float xc[480]={');
fprintf(fid,'%f, ' ,xc(1:479));
fprintf(fid,'%f' ,xc(480));
fprintf(fid,'};\n');
fclose(fid);
Chapter 2 13 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
Simulation results:
0.8
0.6
0.4
0.2
-0.2
-0.4
-0.6
-0.8
-1
0 50 100 150 200 250 300
Chapter 2 14 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
0.8
0.6
0.4
0.2
-0.2
-0.4
-0.6
-0.8
-1
0 50 100 150 200 250 300
1.5
0.5
-0.5
-1
-1.5
0 50 100 150 200 250 300
As we can see: Amax = 1.5, Amin = 0.5; and there is no phase reversal.
Chapter 2 15 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
Simulation results:
2.5
1.5
0.5
-0.5
-1
-1.5
-2
-2.5
0 50 100 150 200 250 300
As in the figure, we can see there are phase reversals of signal, because
modulation index is larger than 1.
N n 0
Chapter 2 16 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0 5000 10000 15000
As in figure, we see spectrum of the signal contains three lines spectrum. The
amplitude of middle line spectrum is bigger than the two others. Frequencies
spectrum respectively is 9KHz, 10KHz and 11KHz (corresponding fc – fm, fc and
fc + fm)
Chapter 2 17 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
3. Hardware-based programs
In this chapter, we will discuss about how to implement Amplitude Modulation
by using TMS320C5515 eZdsp USB Stick. The block diagram of the C5515 eZdsp USB
Stick is shown below.
And, these are the function blocks we will use in this project, and we can also see
how they interact with the PC.
Chapter 3 18 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
In order to implement the Amplitude Modulation, first, we must configure all functions
for the board and configure some parts of the board which we will use.
Second, we create the carrier wave by programming in MATLAB (the same work as
in chapter 2). Then we read the header file ‘carrier.h’ as we had the carrier wave,
with the fixed frequency is 10 KHz and the amplitude can be modify easily.
Chapter 3 19 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
Then, we read data from AIC3204 through I2S0 interface, this is the data from LINE IN
of the board. Next, we modulate by multiply the modulating signal and the carrier
wave, then add into it the carrier wave.
Finally, we return the modulated signal by writing data to AIC3204, the signal will be
push out to the LINE OUT of the board. We can overview the whole process in the
flowchart below.
Int16 USBSTK5515_init( )
{
/* Enable clocks to all peripherals */
SYS_PCGCR1 = 0x0000;
SYS_PCGCR2 = 0x0000;
return 0;
}
Chapter 3 20 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
3.2 Configuration
Int16 USBSTK5515_I2C_init( )
{
I2C_MDR = 0x0400; // Reset I2C
I2C_PSC = 15; // Config prescaler for 100MHz
I2C_CLKL = 25; // Config clk LOW for 100kHz
I2C_CLKH = 25; // Config clk HIGH for 100kHz
I2C_MDR = 0x0420; // Release from reset; Master,
// Transmitter, 7-bit address
return 0;
}
As we can see in the C5515 eZdsp USB Stick Block Diagram, the I2C interface
has to be initial to use AIC3204 chip and OLED 96x16 display. We configure
step by step the values of registers, such as prescaler, clock LOW and HIGH, …
To configure the AIC3204 chip, we have to follow these steps, as we can see in
the flowchart below.
Chapter 3 21 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
Note that the ADC Routing, is to be used with LINE IN. Meanwhile, the DAC
Routing is to be used in LINE OUT. And I2S is the interaction between AIC3204
chip and the TMS320C5515 digital signal processor.
We create a carrier wave with 10KHz from Matlab, and save data into header file
carrier.h, in order to Code Composer Studio can read it.
for i=1:480
sin10k(i) = sin(2*pi*10000*(i-1)/48000);
end
fid=fopen('carrier.h','w');
fprintf(fid,'float sin10KHz[480]={');
fprintf(fid,'%f, ' ,sin10k(1:479));
fprintf(fid,'%f' ,sin10k(480));
fprintf(fid,'};\n');
fclose(fid);
Chapter 3 22 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
To read digital audio, we have wait for interrupt pending flag by checking the rcv
bit in I2S0_IR register, it means that’s the time the TMS320C5515 are ready to read
the audio signal.
While the interrupt flag is active, we have to read data from the register
I2S0_W0_MSW_R (Channel A High) and I2S0_W0_LSW_R (Channel A Low), and the
same with right channel (B channel).
Chapter 3 23 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
3.5 Modulation
Chapter 3 24 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
Opposite with reading process, to write data to LINE OUT, while the interrupt flag is
active, we write data to the register I2S0_W0_MSW_R (Channel A High) and
I2S0_W0_LSW_R (Channel A Low), and the same with right channel (B channel).
Chapter 3 25 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
Chapter 3 26 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
Chapter 3 27 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
Chapter 3 28 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
Chapter 3 29 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
main.c
#include "AM.h"
#include "oled_test.c"
/* ------------------------------------------------------------------------ *
* *
* main( ) *
* *
* ------------------------------------------------------------------------ */
void main( void )
{
unsigned char sample;
/* Initialize BSL */
USBSTK5515_init( );
SYS_EXBUSSEL = 0x6100; // Enable I2C bus
USBSTK5515_I2C_init( ); // Initialize I2C
AIC3204Config(); // Configuration AIC3204
oled_test();
while(1)
{
for (sample=0;sample<48;sample++)
AMModulation(sample);
}
Chapter 3 30 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
AM.c
(the main function doing amplitude modulation)
/*
* AM.c
*
* Created on: May 20, 2013
* Author: GROUP 1 - HUY NGUYEN.T – KHOA NGUYEN.T - MY LE.D - TUAN NGUYEN.O
*/
#include "AM.h"
#include "carrier.h"
/* ------------------------------------------------------------------------ *
* *
* _AIC3204_rset( regnum, regval ) *
* *
* Set codec register regnum to value regval *
* *
* ------------------------------------------------------------------------ */
Int16 AIC3204_rset( Uint16 regnum, Uint16 regval )
{
Uint8 cmd[2];
cmd[0] = regnum & 0x007F; // 7-bit Register Address
cmd[1] = regval; // 8-bit Register Data
void AIC3204Config(void)
{
/* 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
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
Chapter 3 31 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
AIC3204_rset( 0, 0 );
USBSTK5515_wait( 200 ); // Wait
/* I2S settings */
I2S0_SRGR = 0;
I2S0_CR = 0x8010; // 16-bit word, slave, enable I2C
I2S0_ICMR = 0x3f; // Enable interrupts
}
/* ------------------------------------------------------------------------ *
* *
* ReadData(Channel A high, Channel A low, Channel B high, Channel B low) *
* *
* Read signal from STEREO IN port *
* *
* ------------------------------------------------------------------------ */
void ReadData(short *ChA_H, short *ChA_L, short *ChB_H, short *ChB_L) {
/* Read Digital audio */
while ((Rcv & I2S0_IR) == 0)
; // Wait for interrupt pending flag
*ChA_H = I2S0_W0_MSW_R; // 16 bit left channel received audio data
*ChA_L = I2S0_W0_LSW_R;
*ChB_H = I2S0_W1_MSW_R; // 16 bit right channel received audio data
*ChB_L = I2S0_W1_LSW_R;
}
/* ------------------------------------------------------------------------ *
Chapter 3 32 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
* *
* WriteData(Channel A high, Channel A low, Channel B high, Channel B low) *
* *
* Write signal to STEREO OUT port *
* *
* ------------------------------------------------------------------------ */
void WriteData(short ChA_H, short ChA_L, short ChB_H, short ChB_L) {
/* Write Digital audio */
while ((Xmit & I2S0_IR) == 0)
; // Wait for interrupt pending flag
I2S0_W0_MSW_W = ChA_H; // 16 bit left channel transmit audio data
I2S0_W0_LSW_W = ChA_L;
I2S0_W1_MSW_W = ChB_H; // 16 bit right channel transmit audio data
I2S0_W1_LSW_W = ChB_L;
}
/* ------------------------------------------------------------------------ *
* *
* AMModulation(sample) *
* *
* Modulate signal with AM method *
* *
* ------------------------------------------------------------------------ */
void AMModulation(unsigned char sample) {
short ChA_H, ChA_L, ChB_H, ChB_L;
usbstk5515.c
#include "usbstk5515.h"
/* ------------------------------------------------------------------------ *
* *
* USBSTK5515_wait( delay )
*
* *
* Wait in a software loop for 'x' delay *
* *
* ------------------------------------------------------------------------ */
void USBSTK5515_wait( Uint32 delay )
{
volatile Uint32 i;
for ( i = 0 ; i < delay ; i++ ){ };
}
/* ------------------------------------------------------------------------ *
* *
* _waitusec( usec ) *
Chapter 3 33 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
* *
* Wait in a software loop for 'x' microseconds *
* *
* ------------------------------------------------------------------------ */
void USBSTK5515_waitusec( Uint32 usec )
{
USBSTK5515_wait( (Uint32)usec * 8 );
}
/* ------------------------------------------------------------------------ *
* *
* USBSTK5515_init( ) *
* *
* Setup board board functions *
* *
* ------------------------------------------------------------------------ */
Int16 USBSTK5515_init( )
{
/* Enable clocks to all peripherals */
SYS_PCGCR1 = 0x0000;
SYS_PCGCR2 = 0x0000;
return 0;
}
Chapter 3 34 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
4. Conclusions
The modulated signals from MATLAB-based programs and hardware-based
programs are generally identical. They have the same wave shape and spectrum.
The frequencies of received signals based on two methods are basically met the
requirement of the project. However, it still remains some very small differences
belong to the results from the TMS320C5515 eZdsp USB Stick compared to the ideal
simulate on MATLAB because of following objective reasons:
Connectors between cables and computer, and between cables and kit are
not ideal.
Perturbations from inside the cables and from surrounding environment
Digital signal processing in the kit is not perfectly precise
etc.
The above comparisons show that the amplitude modulation using TMS320C5515
eZdsp USB Stick is carried out totally accurately, with acceptable errors in case of
requirements of this project.
Chapter 4 35 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
References
[1]. Assoc. Prof. Dr. Thuong Le-Tien, Chapter 3 lecture in the Analog & Digital
Modulations course.
[3]. Sample Test “aic3024_test.c” and “oled_test.c” in the directory folder of Code
Composer Studio 4.1.3
(...\Texas Instruments\ccsv4\emulation\boards\usbstk5515_v1\tests)
[10]. Design and Configuration Guide for the TLV320AIC3204 and TLV320AIC3254
Audio Codecs
References 36 Group 1
Amplitude Modulation Using TMS320C5515 eZdsp USB Stick Assoc. Prof. Dr. Thuong Le-Tien
37 Group 1