Experiment 3 Direct Sequence Spread Spectrum Prelab Introduction One of the important stages in most communication systems is multiplexing of the transmitted information. Multiplexing is necessary since usually a communication channel is shared by many users, so the information transmitted to each user should be separable from that of the others. A simple example is radio, where different radio stations are transmitting their programs through a channel (the air) to a number of listeners in their coverage distance. For the signals from different stations to be separable, the signals are multiplexed in frequency. This is done through AM/FM modulation of each station at a different carrier (center) frequency. This multiplexing method is called Frequency Division Multiple Access (FDMA). In this experiment, you will learn about another multiplexing method called Code Division Multiple Access (CDMA). The idea behind this method is very simple: Assume that the waveform to be transmitted is what is shown in figure 1-a. If this waveform is multiplied by a code waveform which is a pseudo-random concatenation of +1 s and -1 s, the resulting signal looks very much like noise. Now if this signal is multiplied once more with the same code waveform, what we get is the same signal we started with. Furthermore, it is seen that if the signal in figure 1-c is multiplied by another code waveform, the original signal is not obtained. In digital communication systems, the codes can be designed in a way that the receivers can completely separate the signals of different users that are transmitting simultaneously in the system. (Each user will be assigned a code waveform that is orthogonal to the codes of other users in the system.) In digital communication, the duration of each +1 or -1 in the code waveform is chosen to be much shorter than the duration of the bits being transmitted. As a result, when the output bit stream is multiplied by the code waveform, the resulting signal has a much higher bandwidth. This is why these systems are called spread spectrum. Since the signal with higher bandwidth is generated by direct multiplication in a sequence (the code waveform), the system is called Direct Sequence Spread Spectrum (DS-SS). Since the implementation of a digital CDMA system is rather complicated and cannot be done in a two week lab time, you ll implement a simplified version of this system.
0.5 3 0.4 0.3 2 0.2 1 0.1 0 0-0.1-1 -0.2-2 -0.3-0.4 0 200 400 600 800 1000 1200-3 100 200 300 400 500 600 700 800 900 1000 1100 1200 (a) (b) 0.5 0.4 0.3 0.2 0.1 0-0.1-0.2-0.3-0.4-0.5 0 200 400 600 800 1000 1200 (c) Figure 1 The signal in (a) is multiplied by a code waveform that is a concatenation of -1 and +1 s (b), the resulting waveform is shown in (c). Questions: 1. Assume a signal x() t with bandwidth W x is multiplied in a signal with bandwidth W c, what will be the bandwidth of the multiplication result? (Hint: Multiplication in time domain is equivalent to convolution in frequency domain.)
Objective The goal of this experiment is to learn more about direct sequence spread spectrum systems by making a simplified version of a CDMA communication system. Through this experiment you will also familiarize yourself with the notion of DMA and interrupts. Procedure The experiment consists of making two systems: a transmitter and a receiver. The transmitter system should: Get input sound from the computer through the line-in socket. Multiply the input sound by a code waveform consisting of a concatenation of +1 and -1 s. Send the resulting signal to the line-out port. The Receiver should: Get input sound from the transmitter through the line-in socket. Synchronize its code waveform with that of the transmitter. Multiply the input sound by the same code waveform used at the transmitter. Send the resulting signal to the line-out port. Instead of writing the program from scratch, you will use one of the tutorial programs that comes with the DSK board software. First copy the tutorial project folder dsk_app to your working directory. This is a simple program that makes the board loop back whatever it hears through the line-in port to the line-out. Open the dsk_app.c source file through the project tree pane. Start by reading the comment section of the code. There may be some things you won t understand right away but don t get discouraged since you don t need to (and won t have enough time to) understand every minor detail to get this lab done. The source can be seen as the following pieces: 1. General comments 2. Header file specifications 3. Function prototypes 4. Global declarations 5. Constant configuration definitions 6. The main() function 7. Other function definitions Let s first take a look at the main() function. This is the heart of the program. First the initialization routines are called. Then the transmit and receive buffers are allocated. The following two function calls deal with setting a new IRQ and setting the DMA for capturing the incoming sounds to the buffers and signaling the DSP when each buffer is full and ready to be processed.. Question: Define the following terms: IRQ (Interrupt Request), DMA (Direct Memory Access). (You will find your answer by using above terms and microprocessor in Google. The answer will be on the first page of the search results.)
Each of the input and output buffers, consists of two parts, A and B (in the source named ping and pong). After the part A is filled, the data in this part starts being processed and in the meantime part B starts being filled with incoming data. When B is filled, the role of A and B is interchanged. The interrupt is used to inform the DSP that one part of the buffer is filled and its data is ready to be processed. The key point in doing this experiment and making the systems is to note that the example source code that you have already performs all the settings required for the DMA and interrupt settings. Your first task thus is to find the section of code where the data from input buffer is copied to the output buffer for the loop-back operation. All that remains is then to modify this code to perform the additional required operations on the input sound before it is sent to the output. Code Waveform The code waveform that you will use for this experiment will be 16 bits long. It is important that the length of the input and output buffers you use be divisible by 16 for best performance. The best choices will be powers of 2. The duration of each -1 or +1 in the code waveform will hence be the length of the buffer divided by 16. To choose a code sequence, use the MATLAB hadamard function with an argument of 16. This gives you 16 codes in a matrix form, where every row is a code sequence. Transmitter For the transmitter part you simply need to multiply the code with the input sound. To be able to compare the effect of multiplication of the code waveform you need to program on of the DIP switches on the board to select if the input should be simply looped-back to the output or it should be multiplied with the code waveform before being output. Receiver The receiver part is very similar to the transmitter part but note that the sound that comes in is now encoded, so it is very important that the code waveform at the receiver be in phase with the input sound. With the equipment you have it would be rather difficult to fully synchronize the receiver code waveform with the input sound and making it automatic will require further processing and additional processing at the transmitter. An easy way to achieve approximately synchronized waveforms is to use the DIP switches on the DSK board to determine the number of shifts in the code waveform before it is multiplied with the received sound. The DIP switches can define 16 different combinations so considering that the switches define a 4 bit binary number, this number can define the number of bits the code waveform needs to be shifted, before it is multiplied with the received sound. For instance, if the number selected by the DIP switches is 5 and the buffer size is 1024 samples, the first 1024/16 = 64 samples are multiplied by code bit 6 instead of code bit 1 and so forth. Using this method you should select the time shift in the code waveform that results in the best output sound quality.
Some Important Considerations: The length of the input and output buffers in the receiver and transmitter systems should be equal so that the systems can cooperate with each other. The current version of Code Composer Studio that is used in the lab has a known bug and may crash after the program starts running on the board. Make sure you have saved all your work before loading your program onto the board and running it. Since the DSK and the PC have separate processing units, the program on DSK will continue running even if Code Composer Studio has crashed so you can test if your code is functional. It s better if you play a long sound file rather than a short one when testing your programs. Try using a music file rather than mere speech for testing your work. After finishing the transmitter code, listen carefully to the difference in the output sound before and after enabling the multiplication with the code waveform. What are the main features you notice? If the sound you re playing has high frequency components you should be able to see one of the limitations of the system. Try running the receiver code with two different code waveforms, one equal to the one used at the transmitter and one different from it. What can you conclude? Questions 1. Assume that the code waveform you are using is an alternating +1, -1 stream (the waveform will then be similar to a square-wave signal), try depicting the spectrum of the result of multiplication of this waveform and a sound waveform which has a bandwidth of 10KHz. (Hint: Use the Fourier series expansion of the code waveform and then use convolution.) 2. What are the main factors that limit the performance of the system you designed?
Instructor Sign-off Sheet How well is the code written? (Commented, organized, etc.) The transmitter system: The switch on the transmitter system enables and disables the multiplication of the code waveform: The receiver system: How well is the system synchronized with the transmitter?