Sie sind auf Seite 1von 5

Exercise 1: SDR Transmitters

Testing the USRP Connection 1. Install the MATLAB/Simulink Support Package for the USRP on the PC that you will be using. The instructions for this installation can be found at: http://www.csun.edu/~skatz/katzpage/sdr_project/sdr/Instructions_USRP_Simulink.pdf 2. If you are using a Desktop PC in JD 1536 both the Gigabit Ethernet card should already be configured and the Firmware and FPGA Images are loaded onto the USRP. If you believe that one of these two steps are not completed correctly please see an instructor before proceeding. 3. Connect the USRP to the PC by: Connecting the USRPs Ethernet port to the Ethernet card on the PC Attaching an antenna to the TX port of the USRP Connecting the power cable to the USRP

After connecting the power cable to the USRP the lights will cycle and finally stop with the D and F lights remaining on. 4. Start MATLAB 2012a. After the program starts, start Simulink. Click on Add SDRu. 5. At a command prompt, type: sdrulib . A library window with the SDRu Receiver and SDRu Transmitter blocks should open. 6. Start a new Simulink model and add the SDRu Transmitter block only. 7. Double click on the block to view the parameter window. Set the following parameters: Use the USRP IP address pull down menu to select 192.168.10.2 Set the Center frequency (Hz) to 432E6. Set the LO offset to 0 Set the Gain to 8 Set the Interpolation to 512

After completing these settings the Hardware window near the bottom of the parameter window should display information about the USRP connected. If not, stop here and ask an instructor for assistance.

A Simple Transmitter 1. Continuing with the model that was started above, add a Sine Wave block from the DSP System Toolbox, Sources library. Open the parameters window and set: Amplitude: 1 Frequency: 10000 Phase offset: 0 Sample mode: Discrete Output complexity: Real Computation method: Trigonometric fcn Sample time: 512/100e6 Samples per frame 1024 (this was discussed in the lecture)

2. Add a Real-Imag to Complex block to the model. Double click on the block and set the input to Real and the Imag part to 0. 3. Connect the blocks as shown below.

4. Save your model. 5. Open Simulation Configuration Parameters. Set: Stop Time to inf Type: Fixed-step Solver: discrete

Apply the changes and close the configuration parameters window. 6. Start the simulation. After some initialization the header in your model window should indicate that the simulation is running. If you have errors, correct them before proceeding any further.

7. If your simulation is running you will be transmitting a waveform around 432 MHz. However, without a receiver or any test equipment you will not be able to observe this signal. Stop the simulation. 8. In the model window, select Format Port/Signal Displays Signal Dimensions and Format Sample Time Display Colors. Re-run the simulation and confirm that you understand the values that are displayed. 9. Return to the model and connect a Spectrum scope to the output of the Real-Imag to Complex block. Set: Spectrum units: dBW Spectrum type: Two sided Window: Boxcar Leave both the Buffer input and Specify FFT length unchecked Number of spectral averages: 4

10. Run the simulation. The Spectrum Scope window will open and display the spectrum of your signal. Stop the simulation and select Axes Autoscale to expand the display. Do the frequencies on the display correspond to your expected spectrum? 11. Note that the spectrum scope is displaying your baseband signal. In order to observe the modulated/transmitted signal you need to build a receiver or use test equipment. You can do this on either the lab spectrum analyzer and/or oscilloscope. Connect an antenna to the input of the spectrum analyzer to observe the spectrum of the transmitted signal. Re-run the simulation. Confirm that it is what you expect to receive. Expand the display so that you can see two peaks, one on either side of the 432 MHz carrier. 12. Connect the output of the USRP TX port to the oscilloscope. You will need a SMA to BNC adapter or you can use the antenna. [Important: do NOT connect the USRP directly to the spectrum analyzer]. 13. Stop the simulation and change the Sample Time on the Sine Wave block to 100/100e6. Also, change the interpolation factor on the transmitter block to 100. Re-run the simulation. On the oscilloscope you should observe that the signal is intermittent. Why is that? If the signal is not intermittent, try reducing the interpolation factor further with a corresponding change in the sample time.

14. Stop the transmitter. Open the SDRu transmitter block. Click the Enable underrun output port box and close the parameter window. You should note that the new port called underrun is added to the transmitter block. Add a scope from the main Simulink library to this port and rerun the transmitter briefly. Stop the transmitter and zoom in on a small portion of the scope display. You should observe the display transitioning between zero and one. A zero indicates that the transmitter is outputting a signal while a one indicates that it is not. In other words, if the underrun output displays a one it means that your output signal will be intermittent. 15. Return to the model, delete the spectrum scope and run again. Your scope should now display zero continuously. This means that the transmitter is not experiencing any underruns and is transmitting a continuous signal. You should also observe this on the oscilloscope. The conditions under which underruns occur depend on the speed of the processor you are using. 16. In the sine wave block, change the Output Complexity to Complex. Remove the Real-Imag to Complex block. Re-run the transmitter. How do the spectrum analyzer and oscilloscope displays change? Can you explain the change? Use the Spectrum Scope on the model to observe how the baseband signal changes. 17. Experiment with: Changing the sample time in the sine wave block. What else needs to be changed? How small can you make the sample time and still avoid underruns (make sure the spectrum scope is deleted for this part). Vary the frequency of the sine wave. How does this affect the spectrum? In the Sine block change the frame size to another power of 2. How does this affect the spectrum as displayed on the spectrum scope? Try different values. Pulse Inputs 1. Create a transmitter model as shown below.

2.

Set the Random integer generator parameters as follows: M-ary number = 2 Initial seed = 37 Sample time = 1/10000 Frame-based outputs checked Samples per frame = 50

These parameters will cause the block to generate 0s and 1s at a rate of 10000 samples/second. There will be 50 values in each frame. 3. Set the Rectangular Pulse Filter parameters as follows: Pulse length = 20 Leave the other parameters at their defaults

This block will take each input and create a rectangular pulse of length 20 samples. Thus, each of the 10000 samples/second generates a pulse with 20 samples, bringing the data rate to 20*10000 or 200K samples/second. 4. Based on the incoming sample rate to the transmitter block, what interpolation factor should be used? Set the value and run the simulation. Observe the baseband signal on the spectrum scope to confirm that you are seeing the expected spectrum. Observe the transmitted waveform on the spectrum analyzer. 5. Display the samples times and the signal dimensions to confirm that the values are as expected. 6. Continue to experiment with the model parameters such as frame length, sample time, interpolation factor, samples per pulse to confirm that you understand their relationships.

Das könnte Ihnen auch gefallen