This is only a preview of the April 2017 issue of Silicon Chip. You can view 40 of the 96 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "El Cheapo Modules, Part 6: Direct Digital Synthesiser":
Items relevant to "New Spring Reverberation Unit":
Items relevant to "The eFuse: never replace another blown fuse":
Items relevant to "Micromite BackPack Touchscreen DDS Signal Generator":
Purchase a printed copy of this issue for $10.00. |
U s in g
Ch e a p
A s ian
El e c t r
M o d u o nic
l
Par t 6e s
AD9833-based
Direct Digital
Synthesiser
By JIM ROWE
This little signal generator module uses an Analog Devices AD9833
DDS chip and a 25MHz crystal oscillator. It can be programmed to
generate sine, triangle or square waves up to 12.5MHz and it's all
controlled via an SPI serial interface.
18 Silicon Chip
Asia, especially China, some of them
available at surprisingly low prices
via internet markets like eBay and
AliExpress.
As a result, you can buy the tiny
(18 x 13.5mm) AD9833-based DDS
module shown in the photos, which
includes a 25MHz crystal oscillator,
for the princely sum of $7.88 each –
including free delivery to Australia!
That's really quite a bargain, which is
why we're focusing our attention on
it this month.
To get an idea of how a DDS works,
take a look at the panel titled “DDS in
a Nutshell”, which can be found on
pages 23 & 24 of this article.
Inside the AD9833
The block diagram of Fig.1 shows
what's inside that tiny MSOP-10 package. There's quite a lot, although some
of the elements are mainly involved
in giving the chip its flexibility in
terms of output waveform and modulation capabilities. The main sections
2
CAP/2.5V
3
COMP
1
FULL-SCALE
CONTROL
ON-BOARD
REFERENCE
REGULATOR
2.5V
FREQ0 REGISTER
(28-BIT)
MUX
1
28
PHASE
ACCUMULATOR
(28-BIT)
Σ
12
SINE
ROM
10-BIT
DAC
MUX
3
FREQ1 REGISTER
(28-BIT)
MSB
S1
(12-BIT)
PHASE0 REG
PHASE1 REG
MCLK
8
FSYNC
6
SDATA
7
SCLK
DIVIDE
BY 2
(12-BIT)
VOUT
MUX
4
10
200Ω
CONTROL REGISTER (16-BIT)
S2
SERIAL INPUT REGISTER (16-BIT)
AGND
5
MUX
2
DGND
irect Digital Synthesiser or DDS
chips have been around for well
over 20 years now but for much of that
time they were fairly costly.
Until recently, they didn't include
an integral DAC (digital to analog converter), so you had to use their digital
output to drive a separate DAC to generate the analog output signal.
In the early 2000s, Analog Devices
Incorporated (ADI) announced a new
generation of complete DDS devices which did have an integral DAC,
as well as offering high performance
combined with a price tag significantly lower than what you formerly had
to pay for a DDS+DAC combination.
Although it's one of the low-cost,
lower-performance devices in their
range, the AD9833 provides a good
example of just what can be achieved
nowadays.
When combined with a 25MHz crystal oscillator, it can be programmed to
produce any output frequency from
0.1Hz to 12.5MHz in 0.1Hz increments, with a choice of three waveforms: sine, triangular or square.
All this comes from a chip housed in
a tiny MSOP-10 package, running from
a supply voltage of 2.3-5.5V, dissipating
only 12.65mW and currently with a
price tag of $17.46 AUD plus GST in
one-off quantities. That's significantly
lower than earlier DDS chips.
As we've seen in earlier articles
in this series, there has also been
a huge surge in the manufacture of
many kinds of electronics modules in
VDD
D
4
9
Fig.1: block diagram of the AD9833 DDS IC. The critical blocks are yellow. The
phase accumulator generates a series of addresses to look up in the ROM sine
table and the resulting values are then fed to a 10-bit DAC which produces the
output waveform. Other circuitry allows the output waveform to be changed to
a triangle or square wave and also allows for frequency and phase shift keying.
siliconchip.com.au
involved in basic DDS operation are
those shown with a pale yellow fill.
Down at lower left in Fig.1 you
can see the 16-bit shift register where
data and instructions are loaded into
the chip from almost any micro, via a
standard SPI (Serial Peripheral Interface) bus. We'll discuss that in more
detail later.
Just above the serial input register is the control register, also 16-bit.
This stores the control words, used to
set up the configuration of the device,
including the output waveform type,
which of the two 28-bit frequency
registers (FREQ0 or FREQ1) is used
to set the DDS output frequency and
also whether the phase is shifted by
the content of 12-bit phase registers
PHASE0 or PHASE1.
The main reason why the AD9833
has two frequency registers and two
phase registers is to give it the capability of generating signals with frequency-shift keying (FSK) or phase-shift
keying (PSK) modulation. Multiplexers MUX1 and MUX2 allow these options to be controlled using bits in the
control register.
So how are those 28-bit frequency/
phase increment registers FREQ0 and
FREQ1 loaded with 28-bit data from
the 16-bit serial input register? This is
done by sending the data in two 14bit halves, in consecutive 16-bit words
from the micro, with the lower half
first and then the upper half.
The AD9833 can be configured
to accept the data this way simply by manipulating two bits in the
control register. The same bits can
also be used to configure it for setting
either the lower or higher 14-bit “half
word” alone, which can be useful for
some applications (such as frequency
sweeping).
MUX3, MUX4 and switches S1 and
S2 are all controlled by further bits in
the control register. MUX3 simply allows the sine ROM to be bypassed,
with the output from the phase accumulator fed directly to the DAC. This
is how the AD9833 produces a triangle wave output, since the amplitude
of a triangle wave is a linear function
of its phase.
For a square wave output, the DAC
is disconnected from the chip's analog
output (pin 10) using integrated switch
S1, and instead makes use of the MSB
(most significant bit) output of MUX3.
This automatically gives a square wave
output and MUX4 allows you to divide
siliconchip.com.au
VCC
CON1
1
2
3
4
5
6
7
4.7µF
100nF
10nF
2
VDD
VCC
COMP
DGND
SDATA
6
SCLK
7
FSYNC
8
SDATA
SCLK
IC1
AD9833
MCLK
1
4
3
5
VCC
OUT
25MHz
XTAL OSC
EN
GND
1
2
100nF
FSYNC
AGND
10
VOUT
VOUT
22pF
CAP/2.5V
AGND
9
DGND
4
3
100nF
Fig.2: circuit of the AD9833-based DDS module used in this article. The AD9833
IC and 25MHz crystal oscillator plus a few passive components are mounted on
a small PCB, with a SIL header to make control and output connections.
its frequency by two, if needed.
The integrated 200W resistor connected between the analog output pin
and ground via switch S2 is used to
convert the DAC's output current into
a proportional voltage output. Since
S2 is controlled in parallel with S1,
this means that when S1 cuts the link
between the DAC output and pin 10,
S2 also removes the built-in 200W output shunt.
This makes the chip's output voltage swing in square wave mode
significantly higher than for the sine
or triangular (DAC-derived) options.
To be specific, the square wave output is around 5.2V peak to peak, while
for sine or triangular waves the output
drops to around 650mV peak-to-peak.
The complete module
Now refer to Fig.2, which shows the
complete circuit for the 18 x 13.5mm
module shown in the photo below.
It simply comprises the AD9833
DDS chip (IC1) and its equally tiny (3
x 2.2mm) 25MHz crystal oscillator.
It has six even smaller SMD capacitors, most of them used for filtering
either the power supply rails or IC1's
Vout pin.
Seven-way SIL connector CON1 is
used to make all of the signal and power connections to the module. Pins 1 &
2 are used to provide the module with
5V power, while pins 3-5 are used to
convey the SPI commands and data
to IC1 from the micro you're using to
control it. And pins 6 & 7 are used to
carry the analog output signal from IC1
out to wherever it's to be used.
Limitations
Before we talk about driving the
module from a micro like an Arduino
or a Micromite, we should discuss its
limitations.
Firstly, the aforementioned difference in output amplitude for square
wave versus sine/triangle waves is a
factor of about eight times, or 18dB.
So if you want to use the module as
the heart of a function generator, you
will need to attenuate the square wave
output by 18dB, to match the sine and
triangle output levels.
You will also need to pass the sine
and triangular outputs through a low-
The DDS module is
shown at approximately
twice actual size to
provide greater clarity.
From left to right, the
pin connections are VCC,
DGND, SDATA, SCLK,
FSYNC, AGND and
VOUT.
April 2017 19
AD9833 SERIAL INPUT WORD FORMAT:
D15 D14 D13 D12 D11 D10 D9
D8
D7
D6
D5
D4
D3
D2
D1
MSB
D0
LSB
TO WRITE TO THE CONTROL REGISTER:
0
0
B28
HLB
FREQ PHASE
SEL. SEL.
0
RESET SLEEP SLEEP OPBIT
1
12
EN
0
DIV2
0
MODE
0
MODE:
0 = SINEWAVE
1 = TRIANGULAR
CONTROL
REGISTER
ADDRESS
FREQUENCY REGISTER WRITE
MODE: 1= WRITE AS TWO
SUCCESSIVE 14-BIT WORDS
0= WRITE SINGLE 14-BIT
WORD INTO MSB (HLB = 1)
OR LSB (HLB = 0) HALVES OF
FREQUENCY REGISTER
DAC DATA MSB:
1 = NO DIVISION,
0 = DIVIDE BY 2
CONTROLS WHETHER DAC OUTPUT
IS CONNECTED TO VOUT OR NOT:
0 = CONNECTED (SINE OR TRIANGLE),
1 = DISCONNECTED (SQUARE WAVE)
HIGH OR LOW BITS SELECT:
1= MSB BITS, 0 = LSB BITS
DAC POWER SAVING MODE:
0 = DAC POWERED UP, ACTIVE,
1 = DAC POWERED DOWN
FREQUENCY REGISTER SELECT:
0 = FREQ0 REG, 1 = FREQ1 REG
Scope 1 (above): a 1000Hz sinewave generated using an
Arduino programmed with "AD9833_DDS_module_test.ino".
MCLK ENABLE BIT:
0 = MCLK ENABLED (NORMAL OPERATION)
1 = MCLK DISABLED (DAC OUTPUT CONSTANT)
PHASE REGISTER SELECT:
0 = PHASE0 REG, 1 = PHASE1 REG
Fig.3 (left): the format of the 16-bit digital control data sent
to the AD9833. The top two bits determine whether the
remaining 14 bits are used to update the frequency, phase
or control registers. The control register is used to change
the output waveform type, switch between two different
sets of frequencies and phases or go into a low-power sleep
mode.
RESET INTERNAL REGISTERS:
0 = NORMAL OPERATION, 1 = RESET
TO WRITE TO A FREQUENCY REGISTER:
0/1 0/1 D13 D12 D11 D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
D5
D4
D3
D2
D1
D0
14 BITS OF DATA
FREQ. REGISTER
ADDRESS:
01 = FREQ0,
10 = FREQ1
TO WRITE TO A PHASE REGISTER:
1
1
0/1
X
D11 D10
D9
D8
D7
D6
The underside of the DDS module
with the 7-pin male header
attached. Again, it's shown
twice actual size, due to its
small size (18 x 13.5mm).
12 BITS OF DATA
PHASE REGISTER
ADDRESS:
110 = PHASE REG0,
111 = PHASE REG1
Another limitation, as noted in the
“DDS in a Nutshell” box, is that the
maximum output frequency is half
the sampling clock frequency; in this
case, 12.5MHz. But because of the way
a DDS works, it can only produce a
clean square wave at this maximum
frequency.
If you want to get a reasonably
smooth sine or triangular wave
output, this will only be possible
at frequencies below about 20% of
the clock frequency, or in this case,
a maximum of about 5MHz.
Programming it
When your program starts up, it
will need to carry out a number of
set-up tasks. These include:
1. Declare the micro's pins that are
going to be used by the SPI interface
and set them to their idle state (typically high).
2. Start the SPI interface, configured
USB TYPE B
MICRO
ARDUINO UNO OR NANO,
FREETRONICS ELEVEN OR LEOSTICK,
DUINOTECH CLASSIC OR NANO, ETC
IO1/TXD
ICSP
IO0/RXD
IO3/PWM
MISO 1
IO2/PWM
IO4/PWM
IO5/PWM
IO7
IO6/PWM
IO8
IO10/SS
IO9/PWM
IO12/MISO
IO11/MOSI
GND
IO13/SCK
AREF
SCL
SDA
SS
pass filter with a corner frequency of
around 12-15MHz, to remove most of
the DAC switching transients. After
this processing, the outputs can all
pass through a common buffer amplifier and output attenuator system.
You don't need to worry about any
of these niceties if you simply want
to use the module as a programmable
clock signal source. You can just program it to generate a square wave output and use it as is.
VCC
2 +5V
SCK 3
4 MOSI
RST 5
6 GND
DGND
MOSI
SCK
ADC5/SCL
ADC4/SDA
ADC3
ADC2
ADC1
ADC0
VIN
GND
GND
+5V
+3.3V
RESET
DC VOLTS
INPUT
+5V
SS
Fig.4: hooking the AD9833-based DDS module up to an Arduino. It mainly
involves making SPI connections via the 6-pin programming header.
20 Silicon Chip
SDATA
SCLK
FSYNC
AD9833
BASED
DDS
MODULE
AGND
OUT
SINE, TRIANGULAR
OR SQUARE WAVE OUT
TO LP FILTER, BUFFER &
ATTENUATOR
siliconchip.com.au
Scope 2 & 3: a 1000Hz triangular (left) and square (right) wave produced by running the "AD9833_DDS_module_test.ino"
file on an Arduino or compatible device. Note the higher amplitude of the square wave output.
for a clock rate of say 5MHz, the data
to be sent MSB (most significant bit)
first and using clock/data timing mode
2 (10 binary). If possible, it should also
be set for the data to be exchanged in
16-bit words rather than bytes.
3. Send initialisation commands
to the AD9833 to set up its control
register, the FREQ0 register and the
PHASE0 register. These involve sending the following five 16-bit words
(shown here in hexadecimal):
• 0x2100 (resets all registers, sets
control register for loading frequency registers via two 14-bit
words)
• 0x69F1 (lower word to set
FREQ0 for 1000Hz)
• 0x4000 (upper word to set
FREQ0 for 1000Hz)
• 0xC000 (writes 000 into
PHASE0 register)
• 0x2000 (write to control register to begin normal operation)
With that, the DDS should produce
a 1000Hz sinewave. To change to one
of the other waveforms, you need to
send the correct code to the control register. To change the output frequency,
you need to send the appropriate pair
of 14-bit words to one of the frequency
registers. Note that these are sent lower
word first, then upper word.
To make programming the AD9833
a little easier, the basic coding for the
control, frequency and phase registers
is summarised in Fig.3. I also have
written a couple of simple example
programs to illustrate programming
the AD9833 module; more about these
shortly. First you'll need to know how
the module can be connected to one
of the popular micros.
module up to almost any Arduino or
Arduino clone.
This takes advantage of the fact that
most of the connections needed for
interfacing to an SPI peripheral are
made available on the 6-pin ICSP
header fitted to most Arduino variants.
The connections to the ICSP header
are quite consistent over just about all
Arduino variants, including the Uno,
Leonardo and Nano, the Freetronics
Eleven and LeoStick, and the Duinotech Classic or Nano.
In fact, the only connection that's
not available via the ICSP header is the
one for SS/CS/FSYNC, which needs to
be connected to the IO10/SS pin of an
Arduino Uno, Freetronics Eleven or
Duinotech Classic, as shown in Fig.4.
With other variants, you should
be able to find the corresponding pin
without too much trouble. Even if you
can't, the pin reference can be changed
in your software sketch to match the
pin you do elect to use.
Driving it from an Arduino
Fig.5, on the next page, shows how
to drive the module from a Micromite.
Fig.4 shows how to connect the
siliconchip.com.au
Arduino sample program
One of my sample programs written for an Arduino is called “AD9833_
DDS_module_test.ino”.
It simply initialises the AD9833,
starts generating a 1000Hz sinewave
(Scope 1) and then changes the waveform after five seconds, giving you
a triangular wave (Scope 2), then a
square wave (Scope 3) and finally a
half-frequency square wave, before
returning to a sinewave and repeating
the sequence. If you look at the code,
you can see how easy it is to control
the AD9833 DDS module from an
Arduino.
Driving it from a Micromite
By connecting the MOSI, SCK and SS/
FSYNC lines to Micromite pins 3, 25
and 22 as shown, MMBasic's built in
SPI protocol commands will have no
trouble in communicating with the
module.
One thing to note is that if you want
to drive the AD9833 module from a
Micromite in a BackPack that is
already connected to an LCD touchscreen, there's a small complication
arising from the fact that the LCD
touchscreen also communicates with
the Micromite via its SPI port.
To prevent a conflict, your program
needs to open the SPI port immediately
before it sends commands or data to
the module, and then close the port
again immediately afterwards.
Micromite sample program
My other program is written for the
Micromite, specifically, the Micromite
LCD BackPack. It's called “Simple
AD9833 FnGen.bas”.
This one is a little more complicated
and lets you control the AD9833's
output frequency as well as the waveform, simply by using buttons and
a virtual keypad on the Micromite's
touch screen. It's quite easy to drive,
and again should show you how
the AD9833 can be controlled via a
Micromite.
Both this program and the Arduino
program are available for download
from the Silicon Chip website (www.
siliconchip.com.au).
Alternative module
On page 68 of this issue, we have
published a Micromite-based DDS
Function Generator project by Geoff
Graham which also uses the AD9833.
Geoff has used a slightly different module which includes the ability to vary
April 2017 21
eight bits of the data are the new potentiometer position while the upper
eight bits contain two command bits,
two channel selection bits and four
“don't care” bits, which it ignores.
The command bits allow you to
select whether you are setting the pot
wiper position or commanding the IC
go to into a power-down mode.
We suggest you check its datasheet
for details, however, you really only
need to send one of two different commands to this device when using this
module:
0x11xy – set wiper position to 8-bit
value xy
0x2100 – shut down potentiometer, saving power and disabling the
output signal
For example, the command 0x11FF
will set the output level to maximum,
command 0x1180 will set the output
level to 50% and 0x1101 will set it to
the minimum non-zero level.
The attenuated output signal
is available at pin 6 and this goes
to the non-inverting input of an
AD8051 high-frequency op amp
which is configured with a gain of six
times, providing an output swing of
around 3V peak-to-peak for sine and
triangle waves. This signal is fed to
both a 2-pin header connector and
SMA socket via another 0W resistor.
Other variations in this module are
that it has 100W protection resistors for
GND
+5V
+3.3V
VCC
26
25
24
22
SCK
DGND
MOSI
SCK
SS
SS
21
MICROMITE
SDATA
SCLK
FSYNC
18
AGND
17
OUT
AD9833
BASED
DDS
MODULE
16
14
(MISO)
SINE, TRIANGULAR
OR SQUARE WAVE OUT
TO LP FILTER, BUFFER
& ATTENUATOR
10
9
5
4
3
MOSI
RESET
the output level and also has a lowimpedance buffered output.
The module Geoff has used is shown
below, to the left of its circuit diagram,
Fig.6. It differs from the simpler module shown in Fig.2 in that it has the
output signal from the AD9833 fed to
a separate SIL connector.
From there the signal is routed to
an MCP41010 10kW digital potentiometer IC via a 0W resistor, which acts
as a digitally controlled attenuator.
The output of this attenuator is fed
to an AD8051 rail-to-rail op amp and
together these constitute a PGA, or
Fig.5: connecting the module to a
Micromite is similarly easy; all you
need to do is wire up its two power
pins, the three SPI pins and the
signal output connections.
Programmable gain amplifier (not pin
grid array).
The digital pot also communicates
via SPI and in fact its clock and data
pins are wired up in parallel with the
AD9833's so it is on the same SPI bus.
The only difference in communication is rather than pulling the FSY
pin low, as you do to communicate
with the AD9833, you pull the CS
pin low to communicate with the
MCP41010.
Like the AD9833, the MCP41010 is
controlled by writing 16-bit data words
to it. For the MCP41010, the bottom
VCC
4.7µF
1
2
3
4
5
6
100nF
DGND
10nF
2
VDD
VCC
COMP
4
4 x 100Ω
FSY
8
CLK
7
DAT
6
FSYNC
SCLK
IC1
AD9833
10Ω
1
4.7µF
100nF
MCLK
3
5
25MHz
XTAL OSC
OUT
GND
1
2
SDATA
CS
3
CAP/2.5V
AGND
100nF
9
VOUT
10
0Ω
DGND
4
5
6
22pF
7
Fig.6: the circuit of the alternative DDS module shown above, which
is also widely available. This one incorporates an MCP41010 digital
potentiometer to allow the output amplitude to be controlled as well as an
AD8051 high-speed op amp buffer to keep the output impedance low and
provide some gain to allow a higher maximum output signal level.
The module is shown at aproximately 1.5 times its actual size of 32 x
32mm.
22 Silicon Chip
EN
VCC
3
VOUT
AGND
1
2
100nF
4
VDD
PA0
MCP41010
CS
SI
PW0
SCK
PB0
GND
5
AD8051
2
1
0Ω
8
1
3
2
4
PGA
AGND
1
2
5k
1k
siliconchip.com.au
the four control pin inputs, the supply
for the 25MHz crystal oscillator has a
10W isolating resistor that also forms
a low-pass filter in combination with
the added 4.7µF ceramic capacitor and
there is a 2-pin header which makes
the output of the AD9833 available,
before it enters the attenuator.
There are more details on how to
use this module in this month's article
on the Micromite-based DDS Function
Generator, but besides needing to program the digital pot with the attenuation value, its control is pretty much
identical to the description above.
Final comments
In the June 2016 issue of Silicon
Chip, on pages 86-87, we published a
“Touch-screen Function Generator”
design by NSW reader Dan Amos. Mr
Amos' design used an AD9833 module driven by a Micromite with an
LCD BackPack but he also added a
digital potentiometer, an output buffer
amplifier and even an incremental
encoder for adjusting either the output
frequency or its amplitude.
He also provided the MMBasic
source code for his program, and a user
manual as a PDF file – both of which
can be downloaded from the Silicon
Chip website. So that project and its
software is also an excellent example
to get you started on using the AD9833
DDS module.
One last comment before closing.
As well as being able to generate fixed
frequency, FSK and PSK modulated
signals, the AD9833 can also be programmed to generate swept-frequency signals.
In fact, the Micromite DDS Function
Generator in this issue does just that,
so refer to that article on page 68 for
more details on frequency sweeping.
DDS in a Nutshell
This simplified explanation should
give you some insight into how a
DDS works. A DDS is based around
one or more look-up tables stored
in read-only memory (ROM). These
contain a set of high-resolution digital samples of a single wave cycle.
Let's consider the case where the
table contains a sinewave.
The values from the ROM table
are fed to a DAC (digital-to-analog
converter), so that for each entry in
the table, the DAC will produce an
analog DC voltage corresponding
to the value of the sample stored in
that address.
As a result, if a counter is used to
cycle through the table entries continuously, the DAC output is a continuous sinewave.
Let's say that the table contains
1000 entries which represent a single sinewave cycle and the counter
which indexes the table is incre-
mented at a rate of 1MHz.
This means that the output will be
a sinewave at 1MHz ÷ 1000 = 1kHz.
By changing the rate at which the
counter increases, we can change
the output frequency.
Since the DDS chip operates from
a fixed external clock, in order to
vary the rate at which the DDS runs
through its ROM table, a fancier
counter configuration known as a
“phase accumulator” is used. This
is shown in Fig.7 and it consists of
a binary adder feeding an accumulator register.
The important point to note is that
the phase accumulator register has
28 bits of precision while the sample table, with 4096 entries, only
requires a 12-bit number to index
its entries.
Hence there are an additional 16
bits of fractional phase data in the
register and these effectively indicate
PHASE ACCUMULATOR
28-BIT
FREQUENCY
REGISTER
28
BINARY
ADDER
+
28
28-BIT
28
ACCUMULATOR
REGISTER
12
28
28
4096 ENTRY
WAVEFORM
SAMPLE
TABLE
(ROM)
10
10-BIT
DAC
ANALOG
OUTPUT
Fig.7: the basic layout of
a simple DDS. The Phase
28
Accumulator adds the contents
of the frequency register to the
accumulator register on each
FREQUENCY
MASTER CLOCK
PROGRAMMING
INPUT
clock cycle. The top 12 bits of the
accumulator register is then used
to look up an entry in the waveform table ROM, producing a 10-bit digital
amplitude value which is subsequently fed to the digital-to-analog converter
(DAC) to generate the analog output signal.
siliconchip.com.au
output phase values in-between those
represented by the values in the table.
The binary adder has two 28-bit
inputs, one of which is the current
phase value from the accumulator
register. The other input comes from
the frequency register at far left, also
28 bits wide.
This is the register which we use
to set the DDS output frequency.At
each clock cycle, the value in the frequency register is added to the value
in the accumulator register and this
result is stored back in the accumulator register. As a result, as long as
the frequency register value doesn't
change, the accumulator register increases by the same amount on each
clock cycle.
With a 28-bit phase accumulator register, a value of zero indicates a phase in radians of zero
while its maximum value of 228 - 1
(268,435,455) represents a phase of
just under 2π.
When the value of the accumulator register exceeds 228 - 1, it rolls
back around to zero, hence maintaining 0 < phase < 2π. Each time it “rolls
over”, that represents one complete
cycle from the output.
With a frequency register value
of 1, it will take 228 clock cycles for
this to happen. With a master clock
of 25MHz, that means the output
frequency will be 25MHz ÷ 228 =
0.09313Hz or just under 0.1Hz.
With a frequency register value of
2, it will take 228 ÷ 2 clock cycles
to roll over, giving an output frequency of 25MHz ÷ 227 = 0.186Hz
and so on.
continued next page
April 2017 23
So the output frequency resolution
with this configuration is just
under 0.1Hz.
But how are such low frequencies
possible with only a 4096-entry
table? Well, only the top 12 bits of
the 28-bit accumulator register are
used to index the ROM table.
This means with the minimum
frequency value of one, it will only
roll over to the next entry in the table once every 2(28-12) = 65,536 clock
cycles. Hence, each value from the
table is sent to the DAC 65,536 times
before progressing to the next one,
giving a very low frequency.
At higher frequencies, in this case
above 25MHz ÷ 4096 (6.103kHz),
values in the table will be skipped
when necessary in order to increase
the output frequency. In other words,
the counter which indexes the table
may increase at a rate of 1, 2, 3, 4
times per clock, or somewhere inbetween, by skipping the occasional
table entry.
For example, to produce an output of 12.207kHz, every second entry
from the ROM table is sent to the DAC
(12.207kHz = 25MHz ÷ [4096 ÷ 2]).
Based on the above, we can calculate the output frequency as:
Fo = Dph × Mclk ÷ Rac
For the DDS shown in the diagram, with a 28-bit phase accumulator having a resolution (Rac) of 228
(= 268,435,456) and with a master
clock frequency (Mclk) of 25MHz,
this simplifies down to:
Fo = Dph × 0.09313
By the way, while we're showing
the table as containing 4096 entries,
note that due to symmetry, it's only
actually necessary to store the values
representing one quarter of a sinewave.
The second quadrant of a sinewave is a mirror-image of the first,
so this can be achieved by running
through a quarter sine table backwards, while the third and fourth
quadrant are simply an inverted
version of the first and second, and
these can be obtained by negating the
values from the first two quadrants.
You'll also notice that the samples
stored in the ROM are shown as having a resolution of 10 bits, to suit the
10-bit DAC, which can produce an
analog output with 1024 different
voltage levels.
One more thing to bear in mind.
Because a DDS achieves higher output frequencies by skipping samples
in the waveform ROM, at higher output frequencies, the sampling resolution effectively drops.
This continues until you reach the
“Nyquist frequency” of half the master clock frequency (ie, 12.5MHz)
above which the output from the
DAC actually starts to drop in frequency.
So the theoretical maximum frequency for a DDS is half that of the
master clock.
But in practice, because of the
above, if you want a reasonably smooth sinewave output that
doesn't need too much low-pass
filtering, it's a good idea to limit
the maximum output frequency
to about 20% of the master clock
frequency; say 5MHz for a 25MHz
SC
master clock.
Distributors of quality test and measurement equipment.
Signal Hound –
USB-based spectrum analysers
and tracking generators to 12GHz.
Virtins Technologies DSO –
Up to 80MHz dual input plus
digital trace and signal generator
Nuand BladeRF –
60kHz– 3.8GHz SDR Tx and Rx
Bitscope Logic Probes –
100MHz bandwidth mixed signal
scope and waveform generator
Manufacturers of the Flamingo
25kg fixed-wing UAV.
Payload integration services
available.
Australian UAV Technologies Pty Ltd
ABN: 65 165 321 862 T/A Silvertone Electronics
1/21 Nagle Street, Wagga Wagga NSW 2650
Ph 02 6931 8252 contact<at>silvertone.com.au
www.silvertone.com.au
24 Silicon Chip
siliconchip.com.au
|