amplitude modulationdsk6416

Upload: naveen-babu

Post on 08-Apr-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/7/2019 Amplitude ModulationDSK6416

    1/5

    Version 1.0

    B.ENG. (HONS) III/ B.Sc. IT (Hons) IVCCE3202 - Advanced Digital System Design Practical AssignmentDr. Ing. Victor Buttigieg

    Department of Communications and Computer Engineering, University of Malta

    Generation and Demodulation of Amplitude Modulation usingthe DSK6416

    Objectives:

    The objectives of this practical assignment are to(i) use the EDMA on the TMS320C6416 to read and handle frames of samples;(ii) amplitude modulate a baseband signal and transmit this;(iii) demodulate the received AM signal to recover the original baseband signal.

    Background:

    Amplitude modulation is a very simple modulation scheme where the amplitude of a fixedfrequency carrier is modulated by the baseband (input) signal. The equation for AM is givenby:

    [ ]( ) 1 ( ) sinam c m cv t V m v t t = + ,

    where V c is the amplitude of the carrier, m is the modulation index (which is a number

    between 0 and 1), vm(t ) is the normalised baseband signal (amplitude equal to one) and c isthe radial frequency of the carrier. The modulation index measures the depth of modulation(0 = no modulation, 1 = full modulation, where the amplitude of the carrier is driven to zerowhen the baseband signal peaks negatively). The value of the modulation index may bedetermined from the AM waveform using the expression

    A Bm

    A B

    =

    +

    where A and B are amplitudes of the AM waveform as shown in Figure 2 .

    A simple square-law envelope detector for AM demodulation may be implemented as shownin Figure 1 .

    Figure 1

    Assuming that ( ) sin( )m mv t t =

    , show that the maximum output frequency from the squaringblock in Figure 1 that involves the carrier frequency is ( )2 c m . Furthermore, show that

    (.)2 LPF ( ) vam(t ) vm(t)

  • 8/7/2019 Amplitude ModulationDSK6416

    2/5

    Version 1.0

    the maximum frequency component involving only the baseband signal is 2 m . Therefore,to remove the carrier component and retain just the baseband signal (squared) the LPF shouldremove all frequencies greater than or equal to ( )2 c m whilst retaining those smallerthan or equal to2 m .

    Figure 2

    Design:

    The AM system described in the previous section is going to be implemented on theDSK6416 with the following parameters:

    Sampling Frequency F s = 32kHzCarrier Frequency F c = 10kHzBaseband Frequency range - F m = 100Hz - 1kHzCarrier amplitude V c = 500mVBaseband amplitude V m = 100mVModulation index m = 0.5

    Use Matlab to design an appropriate second order IIR LPF filter for the demodulator given inFigure 1.

    Experiment 1:

    In order to improve the efficiency of implementation, a frame-based DSP implementation isgoing to be adopted in this case. An example program that generates a sine-wave withfrequency 1kHz on channel 0, and outputs the addition of the left and right input channels onchannel 1 is supplied at http://staff.um.edu.mt/vbut1/CCE3202/files .

    1) Create a new project file.

    A

    B

  • 8/7/2019 Amplitude ModulationDSK6416

    3/5

    Version 1.0

    2) Create a new DSP/BIOS configuration file and add this and the downloaded filesdmatemplate.c , edma.c , aic23.c, edma.h and aic23.h to the project.

    3) Since this project will not use the BSL libraries, then there is no need to configure theproject any further.

    4) Modify the dmatemplate.c , edma.c and aic23.c files to include the appropriateconfiguration header file according to the name chosen for the DSP/BIOS file. In thesupplied files, the configuration header file is set to dmatemplatecfg.h . This needs tobe changed if you have not saved the DSP/BIOS file as dmatemplate.cdb .

    5) Define a new SWI thread to handle the processing of the frames of samples. Thismust be named as processBufferSwi . It is suggested that the function invoked by thisSWI is named processBuffer (in this example, this function is already implementedfor you in the file dmatemplate.c , but you need to configure this in the DSP/BIOSconfiguration file, following the same steps as given in the previous practical

    assignment.)

    6) You now need to configure the hardware ISR associated with the EDMA controller.The ISR routine is already implemented for you and is found in the file edma.c underthe name edmaHwi( ) . However you need to configure the DSP/BIOS to handle thisinterrupt. Choose HWI_INT8 for this, selecting EDMA_Controller as the interruptsource. Also enable the Dispatcher for this ISR.

    7) The main( ) function initialises the EDMA and the AIC23. This is found indmatemplate.c . The following code would need to be included in all programs thatwill use frame-based DSP.

    #include "aic23.h"#include "edma.h"

    /* Codec configuration settings**********************************************************************************

    Select all default values, except for Sampling frequency - Set this to 48kHz**********************************************************************************

    */AIC23_Params config = {

    AIC23_REG0_DEFAULT, // 0 DSK6416_AIC23_LEFTINVOL Left line input channel volumeAIC23_REG1_DEFAULT, // 1 DSK6416_AIC23_RIGHTINVOL Right line input channel volumeAIC23_REG2_DEFAULT, // 2 DSK6416_AIC23_LEFTHPVOL Left channel headphone volumeAIC23_REG3_DEFAULT, // 3 DSK6416_AIC23_RIGHTHPVOL Right channel headphone volumeAIC23_REG4_DEFAULT, // 4 DSK6416_AIC23_ANAPATH Analog audio path controlAIC23_REG5_DEFAULT, // 5 DSK6416_AIC23_DIGPATH Digital audio path controlAIC23_REG6_DEFAULT, // 6 DSK6416_AIC23_POWERDOWN Power down controlAIC23_REG7_DEFAULT, // 7 DSK6416_AIC23_DIGIF Digital audio interface formatAIC23_REG8_48KHZ, // 8 DSK6416_AIC23_SAMPLERATE Sample rate controlAIC23_REG9_DEFAULT // 9 DSK6416_AIC23_DIGACT Digital interface activation

    };

    /*------------------------------------------------------------------------------------**** These pointers will point to the current Ping or Pong buffers these are set by the **** ISR ****------------------------------------------------------------------------------------*/ Int16 *gBufferXmt;Int16 *gBufferRcv;

    /* --------------------------- main() function -------------------------- */

    /** main() - The main user task. Performs application initialization and* starts the DSP/BIOS scheduler.

  • 8/7/2019 Amplitude ModulationDSK6416

    4/5

    Version 1.0

    */void main(){

    // Put any of your configuration code here// ....

    AIC23_setParams(&config); // Configure the codec

    initMcbsp(); // Initialize McBSP2 for audio transfers

    IRQ_globalDisable(); // Disable global interrupts during setup

    initEdma(); // Initialize the EDMA controller

    initIrq(); // Initialize interrupts

    IRQ_globalEnable(); // Re-enable global interrupts}

    8) Build the program and test its functionality.

    9) Modify the processBuffer( ) thread so that it implements the FIR filter given in theprevious practical assignment. Note that all you need to do is to read the samplesfrom the frame buffers, instead of the BSL function used in the previous practicalassignment. What is the CPU load in this case, and how does this compare to theprevious implementation which was sample-based?

    10) Implement an additional task thread that toggles LED0 once every 100ms. Note thatyou need to include all the necessary header files, initialisations and additionalconfigurations to make use of any BSL functions to achieve this.

    11) Modify the program such that if the input signal on channel 0 is greater than that onchannel 1, then LED1 is switched on, otherwise LED2 is switched on. You can makeuse of the output signal from the DSP itself as a second signal source (use the T-connector to connect to the input cable).

    12) As an optional challenge, can you modify this program to implement the FIR filter inplace, i.e. without the need of using a separate circular buffer. This is not as trivialas one may at first assume, and you should only attempt this if you first finishExperiment 2 .

    Experiment 2:

    Write a project for the DSK6416 to implement the AM system with specifications as given inthe Design section using frame-based DSP. Follow the following steps:

    1) Sample the baseband signal on channel 0 with the parameters as given in the Designsection.

    2) Generate a carrier with a frequency of 10 kHz and amplitude 500mV on the outputchannel 0.

    3) Modulate this carrier using the input baseband signal using amplitude modulation(double sideband with carrier). Output this again on channel 0.

    4) Use the oscilloscope to measure the actual modulation index of the AM signalproduced.

  • 8/7/2019 Amplitude ModulationDSK6416

    5/5

    Version 1.0

    5) Transmit this signal (loop a cable from the line out back to line in, you can use the T-connector to achieve this).

    6) Demodulate this signal using the square-law envelope detector given earlier. Toimplement the IIR filter, express its transfer function H (z) as ( ) / ( )Y z X z (output over

    input), then take the inverse z-transform to obtain the difference equation. Implementthe difference equation using the minimum number of delay elements (variables), i.e.use a Direct Form II implementation.

    N.B. It is recommended that the filter is first implemented separately and tested againstthe design specs to verify correct operation.

    7) Observe the demodulated output and comment on the results obtained.