Skip to content Skip to navigation

Connexions

You are here: Home » Content » Communications: Using Direct Digital Synthesis

Navigation

Recently Viewed

This feature requires Javascript to be enabled.
 

Communications: Using Direct Digital Synthesis

Module by: Matthew Berry. E-mail the author

Summary: This module introduces Direct Digital Synthesis with prepared code that transmits arbitrary input as an FM radio signal. The module then explains how to program the DDS hardware and concludes with a simple Frequency Shift Keying exercise.

Introduction

Direct Digital Synthesis (DDS) is a method for generating a desired waveform (such as a sine wave) by using the technique described in Figure 1 below.

Figure 1: Direct digital synthesis (DDS) (Couch)
Figure 1 (fig1.png)

Quantized samples of a desired waveform are stored in the memory of the microprocessor system. This desired waveform can then be generated by "playing out" the stored words into the digital-to-analog converter. The frequency of this waveform is determined simply by how fast the stored words are read from memory, and is thus programmable. Likewise, the phase and amplitude of the generated waveform are programmable.

The DDS technique is replacing analog circuits in many applications. For example, it is used in higher-priced communication receivers to generate local oscillator signals. It can also be used to generate sounds in electronic pipe organs and music synthesizers. Another application is its use by lab instrument manufacturers to generate output waveforms in function generators and arbitrary waveform generators (Couch).

In this lab you will familiarize yourself with the capabilities of the Analog Devices AD9854 DDS. The DDS board is installed between the 6-channel card and the DSP card at some (not all) lab stations. You can tell which boxes have them by the way the 6-channel card sits higher inside the metal box.

Frequency Modulation (FM) Radio Exercise

To get your feet wet and see a demonstration of the DDS, perform the following exercise. Copy the files FM.asm (downloadable here) and mod.asm from the v:\ece320\54x\dds\ directory. Assemble and run the frequency modulation (FM) program FM.asm. Next, plug an audio source into one of the two DSP input channels that you've been using all semester. If you have a CD on you, pop it into the computer and use that. If not, use a music web site on the Internet as your audio source. Connect the computer to the DSP by using a male-male audio cable and an audio-to-BNC converter box (little blue box), both of which are in the lab. The computer has three audio outputs on the back; use the middle jack. Ask your TA if you can't find the cable and/or box or don't see how to make the connection. Next, connect a dipole antenna to the output of the DDS (port \#1 on the back of the DDS board). A crude but effective dipole antenna can be formed by connecting together a few BNC and banana cables in the shape of a T. There should be one or two of these concoctions in the lab. Once the connections are made, turn on the black receiver in the lab, and tune it to 104.9 MHz (wide band FM). You should be able to hear your audio source!

note:

If your audio sounds distorted, it's most likely due to the volume of your audio source being too loud and getting clipped by the DSP analog-to-digital converter.

Spectral Copies

Spectral Copies: The digital-to-analog converter on the DDS is unfiltered, which means that there is no anti-imaging filter to remove the spectral replicas. To see this, plug the output of the DDS board directly into the vector signal analyzer (VSA), and observe the spectrum. Use 104.9 MHz as the center frequency, and set the span wide enough so that you can see the spectra of the replicas to the left and right of the 104.9 MHz signal. Use the marker to find the peaks of the other replicas, and record their frequencies. Once you've done that, reattach the antenna to the DDS output, and tune the receiver to the frequencies you just recorded. You should be able to hear your audio on each of the other frequencies.

Note:

The clock rate of the DDS is 60MHz, which corresponds to 2π 2 in digital frequency.
Therefore, the 104.9 MHz signal you just listened to is roughly equivalent to 7π2 7 2 in digital frequency. What are the digital frequencies of the other copies you saw on the VSA?

How to use the DDS

The DDS has several different modes of operation: single-tone, unramped Frequency Shift Keying (FSK), ramped FSK, chirp, and Binary Phase Shift Keying (BPSK). In this lab we will use the DDS in single-tone mode. Single-tone mode is easy to use, and is powerful enough to create many different kinds of waveforms, including FM and FSK.

FM code

The FM code you just ran (also listed here) is fairly straightforward. The program first calls the radioinit subroutine. This routine sets the DDS to single-tone mode and turns off an inverse-sinc filter to conserve power. Following radioinit, the setcarrier subroutine is called. This routine sets the frequency of the DDS output by writing to the two most significant 8-bit frequency registers of the 48-bit frequency-tuning word on the DDS1. Although the frequency-tuning word on the DDS has 48 bits of resolution, the upper 16 bits provide us with enough resolution for the purposes of this lab, and so we will only be writing to the two most significant registers. See page 26 in the DDS data sheet for a layout of the frequency-tuning word.

To set the carrier frequency, we first need to determine what frequency word has to be written to the frequency registers on the DDS. This can be done using Equation 1:

Frequency word=baseband frequency 60   MHz 248 Frequency word baseband frequency 60   MHz 2 48
(1)
where baseband frequency corresponds to the desired frequency that lies in the range of 0-30 MHz. For example, to get the DDS to transmit at 104.9 MHz, you would choose the baseband frequency to be 15.1 MHz since 104.9 MHz is one of the unfiltered spectral replicas of 15.1 MHz. Then, using Equation 1, the frequency word for 15.1 MHz (and 104.9 MHz) would be equal to 406D 3A06 D3D4h. But since we only write to the two most significant registers of the frequency-tuning word, we only need the first 4 hexadecimal numbers of this result, i.e. 406Dh. The first two of those, 40h, need to get written to the most significant 8-bit frequency register, while the second two hex numbers, 6Dh, need to get written to the second-most significant 8-bit frequency register. This is where the 40h and 6Dh in the setcarrier subroutine of the FM code come from.

Writing to the frequency registers is accomplished using the portw instruction. To write to the frequency or phase registers on the DDS, the second operand of the portw instruction must be 10xxxxxx, where the lower six bits are the address of the specific register to be written to. The address of the most significant frequency register on the DDS is 04h, and the address of the second most significant frequency register on the DDS is 05h (see page 26 in the data sheet). It is important to note that the way our DDS boards were built, you will not be allowed to make two consecutive writes. To solve this problem, a subroutine called nullop is called to waste some CPU time between writes. nullop does this by simply repeating the nop instruction 128 times.

After the program returns from the setcarrier subroutine, it enters an infinite loop in which it waits for a serial interrupt to occur. The serial interrupt occurs every time a new sample is acquired from one of the two input channels and is transmitted to the DSP via the serial port. When the interrupt occurs, an interrupt service routine called ANALOG_IFC (see core_mod.asm executes and calls the handle_sample subroutine. The handle_sample subroutine reads in the acquired sample from the serial port and scales that sample so that it can be "mapped" to a frequency in the range of ±75 kHz2. The scaled sample therefore determines the frequency deviation and is added to 6Dh. The last step is to write the result to the second most significant frequency register so that the frequency of the DDS output can be updated.

Programming the Phase

The process for changing the phase of the DDS output is the same as it was for changing the frequency of the DDS output. To change the phase, you need to write a phase word to a phase-adjust register on the DDS. The phase-adjust register is 14 bits wide and is split up into two smaller registers that you can write to (see page 26 in the data sheet). The upper 6 bits have address 00h, and the lower 8 bits have address 01h. The phase word can be calculated using Equation 2:

Phase word=Carrier phase2π214 Phase word Carrier phase 2 2 14
(2)
Once you've calculated the phase word, you can write it to the DDS using the portw instruction as before. Just make sure you use the correct address for the phase register.

Programming the Amplitude

The DDS also allows you to program the amplitude, but this functionality is not addressed in this lab. You will be able to implement a digital communication system in ECE320 without having to program the amplitude. Interested readers are referred to the data sheet.

FSK exercise

Now that you know how to use the DDS in single-tone mode, implement a simple FSK system that uses 2 frequencies: 120.005 MHz, and 120.011 MHz. You don't need to encode any data for this exercise. In other words, your DDS output should just continuously alternate between the two frequency symbols. Also, the DDS automatically ensures continuous phase, so you won't have to keep track of it. Use a symbol length of approximately 725μs (the same length as your lab 5 symbols). Timer interrupts are an elegant way to control the symbol lengths, but in this lab we will keep things simple and control the symbol lengths by creating a second (longer) nullop subroutine and calling it between writes to the DDS. The second nullop subroutine should waste approximately 725μs worth of time.

Note:

Since we're not using input or output from the DSP, you don't need to use the WaitData or WaitAudio macros.

Testing

Note that the corresponding baseband frequencies for 120.005 MHz and 120.011 MHz are 5 kHz, and 11 kHz, respectively. Since these baseband frequencies lie within the 22.05 kHz bandwidth of the DSP, you will be able to view your FSK signal in real time on the oscilloscope without the contribution from the spectral replicas. Just feed the output of the DDS into a second DSP (the anti-aliasing filter on the DSP will get rid of the spectral replicas), and pass it through to the output and the scope. You should be able to verify that there is continuous phase between frequency symbols, and that your symbol length is approximately 725μs. You should also view the spectrum of your DDS output on the VSA to verify that your symbols have the correct frequencies.

Appendix

Footnotes

  1. Communication between the DSP and the DDS is done through a parallel bus.
  2. In FM radio, the amplitude of the message signal being transmitted determines the amount of frequency deviation from the carrier frequency of the passband signal. ±75 kHz is the largest frequency deviation allowed.

References

  1. Leon W. Couch, II. (1995). Digital and Analog Communication Systems. (3rd edition). Upper \\ Saddle River, New Jersey, 07458: Prentice Hall.

Content actions

Download module as:

PDF | EPUB (?)

What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

Downloading to a reading device

For detailed instructions on how to download this content's EPUB to your specific device, click the "(?)" link.

| More downloads ...

Add module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks