This is only a preview of the September 2017 issue of Silicon Chip. You can view 59 of the 112 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 "Fully adjustable, 3-way active loudspeaker crossover Pt.1":
Items relevant to "Dead simple radio IF alignment with DDS":
Items relevant to "LTspice Tutorial Part 3: Modelling an NTC Thermistor":
Articles in this series:
Items relevant to "Arduino Data Logger Part 2":
Items relevant to "Arduino “ThingSpeak.com” ESP8266 data logger":
Items relevant to "El Cheapo modules Part 9: AD9850 DDS module":
Articles in this series:
Purchase a printed copy of this issue for $10.00. |
Using Cheap Asian Electronic Modules Part 9: by Jim Rowe
The AD9850 DDS Module
In the April issue, we covered the AD9833 Direct Digital Synthesiser
(DDS) chip. This time, we’re looking at modules based on its big
brother, the AD9850. Typically combined with a 125MHz crystal
oscillator, it can be programmed to produce sinewaves to beyond
40MHz, possibly accompanied by a square or pulse waveform. It is
again controlled via an SPI serial interface.
W
e won’t explain how a DDS chip
works again as we covered that
quite thoroughly in the article mentioned above, in the April 2017 issue.
There are a couple of modules using
the AD9850 chip in conjunction with
a 125MHz oscillator, with the one
shown in the photos probably the most
common. The other module is very
similar in most respects, apart from
having a different PCB layout.
In the module shown, the fact
that the AD9850 is coupled with a
125MHz crystal oscillator means that
it can be programmed to produce any
output frequency from 0.0291Hz to
over 62MHz in 0.0291Hz increments
(more about the practical frequency
limits later). This means it has a frequency range about five times that of
the AD9833 with a resolution about
3.4 times finer (0.0291Hz compared
with 0.1Hz).
Although the AD9850 doesn’t provide the same choice of output waveforms as the AD9833, it does offer the
basic sine waveform plus a derived
rectangular waveform with bipolar
outputs and an adjustable duty cycle.
This allows it to produce anything
from narrow positive pulses through
to a square wave to narrow negative
pulses.
The AD9850 chip itself is a little
larger than the very tiny AD9833,
but is still quite small. It comes in a
28-pin SSOP package, operates from
either 3.3 or 5V and is described as
low power – dissipating just 380mW
when running with a 125MHz master
clock from 5V, or only 155mW when
operating from a 3.3V supply with a
110MHz master clock.
94 Silicon Chip
The AD9850-based module shown
in the photos, which measures only
44.5 x 26mm and includes a 125MHz
crystal oscillator, is currently being offered on eBay and AliExpress for prices ranging from A$9.80 to A$22.50, in
many cases with postage included.
Inside the AD9850
The block diagram of Fig.1 shows
what’s inside that compact 28-pin
SSOP package. The main sections
involved in basic DDS operation are
those shown with a pale yellow fill.
The high speed comparator at lower
right is used for deriving the rectangular/square output waveform, as we’ll
see shortly.
Down at lower left is the 40-bit input
register where data and instructions
are loaded into the chip from almost
any micro. With the AD9850, this can
be done in two ways; in serial fashion
via an SPI (Serial Peripheral Interface)
The AD9850 module shown at approximately twice actual size.
siliconchip.com.au
bus like the AD9833, or by parallel
loading via an 8-bit data bus.
Since the AD9850 needs a 40-bit
word rather than two 14-bit words, this
means that programming it gets a little
more complicated than the AD9833.
With serial loading via the SPI bus,
all 40 bits must be sent in sequence,
while with parallel loading they must
be sent as a sequence of five bytes (8bit words). In both cases, they must be
sent to the chip in a particular order
(LSB first) and with the 32-bit frequency word sent before the 8-bit control/
phase word.
Returning to Fig.1, just above the
input register is the frequency/phase
data register, also of 40 bits. This stores
the data used to program the DDS in
terms of output frequency and phase
modulation (if any).
Once the data has been loaded into
the input register either serially or as
five bytes, it is transferred into the
frequency/phase register with a single
positive-going pulse to the Frequency
Update (FQ_UD) pin.
The high speed DDS “heart” of the
AD9850 is shown at upper left in Fig.1,
with its 125MHz master clock input
labelled “Ref Clock Input”. Then to
the right of the DDS block is the very
fast 10-bit DAC (digital to analog converter), used to provide the AD9850’s
main sinewave output. Note that the
use of a 10-bit DAC gives the device
a sinewave amplitude resolution of
1024 levels.
The complete module
Now turn your attention to Fig.2,
which shows the complete circuit for
the 44.5 x 26mm module shown in
the photos. It has quite a few components, comprising the AD9850 DDS
chip (IC1) and its equally small (6.5
x 4.5mm) 125MHz crystal oscillator,
a red power LED, seven SMD resistors, 14 SMD capacitors, three SMD
inductors and a small trimpot.
10-way SIL connectors CON1 and
CON2 provide all the signal and power
connections to the module. Most of
the pins of CON1 are used for the 8-bit
parallel data input (apart from pin 1
for +5V power and pin 10 for ground),
while the pins of CON2 are used for
the SPI serial interface and the analog
outputs.
Note that pin 25 of IC1 is both D7,
the most significant bit of the parallel
input (via pin 9 of CON1) and also the
serial data (SDA) line of the SPI intersiliconchip.com.au
face (pin 4 of CON2).
As shown on Fig.1, the AD9850’s
DAC has bipolar outputs and these
emerge via pins 21 and 20, as shown
in Fig.2. But only one of these is actually used within the module – the
positive output from pin 21. The signal from this output passes through
a low-pass filter formed by the three
small inductors and their accompanying low-value capacitors, to remove
as much of the DAC noise as possible
before the output signal passes to pin
10 of CON2.
The negative DAC output from pin
20 is simply terminated in a 100W load
and fed directly to pin 9 of CON2,
without any filtering. So if you want
to use this output, it will need external filtering.
One more thing to note regarding
the AD9850’s DAC is that its full-scale
output current is set by the value of
the resistor connected between pin
12 (DAC RSET) and ground. With the
3.9kW resistor supplied in the module, the full-scale output current is
10mA, which with the loading of approximately 100W gives a DAC output
close to 1V peak-to-peak. This should
be suitable for the majority of applications.
As well as going to pin 10 of CON2,
the filtered positive DAC output is also
connected to the positive input of the
AD9850’s high speed comparator (pin
16), via a 1kW resistor. The negative
input of the comparator (pin 15) is fed
with an adjustable DC voltage from
the 10kW trimpot, the ends of which
This photo of the underside of the
AD9850 DDS module shows the pin
header connections that can be used
with a Micromite or Arduino.
are connected to the +5V power rail
and ground.
The trimpot thus provides a simple
way to adjust the duty cycle of the rectangular output waveforms derived
from the filtered positive DAC output
by the action of the comparator. The
rectangular outputs emerge from pins
14 and 13, and are taken directly to
pins 7 and 8 of CON2.
Fig.1: internal block diagram of the AD9850 IC. This is somewhat simpler than
the AD9833 featured previously as it has no facility to generate a triangle wave
nor a square wave. However, the internal high-speed comparator at lower right
can be used to generate a fixed or variable duty cycle square wave derived from
the sinewave output and a DC reference voltage.
September 2017 95
From left to right: 10kHz, 100kHz, 1MHz, 10MHz waveform outputs from the AD9850 DDS module. The 25MHz and 40
MHz output graphs are shown overleaf.
Note that the comparator outputs
are both bipolar and symmetrical, ie,
they are always mirror images of each
other, regardless of the duty cycle setting set by the 10kW trimpot.
Practical limitations
As with the AD9833, the main limitation of this module regards the maximum frequency that it can produce.
In theory this is equal to the Nyquist
frequency, or half the sampling clock
frequency; in this case, 125MHz ÷ 2
or 62.5MHz.
But you need to bear in mind that
because of the way a DDS works, the
“sinewave” that it produces at this frequency will have very high distortion.
If you want to get a reasonably smooth
sinewave output, this will only be possible at frequencies below about 20%
of the clock frequency, or in this case,
a maximum of about 25MHz.
If you can tolerate a moderate
amount of distortion, it should be
possible to get nominal sinewaves at
frequencies up to about 40-50MHz.
That’s why the module pictured is
usually advertised as being capable
of delivering sinewaves up to “40MHz
and above”.
Programming it
Although the AD9850 is capable of
being programmed by a parallel loading sequence of five bytes, we’re going to concentrate on the SPI interface
since it involves only five wires between the micro and the module, rather
than the 11 wires needed for parallel
loading; with most micro-based projects, it’s easy to run out of free pins.
Fig.2: circuit diagram for the AD9850-based DDS module. Besides the DDS IC and 125MHz crystal oscillator used to
derive its output frequency, the main point of interest is the 7th order low-pass elliptic filter formed by three SMD
inductors and a few small ceramic capacitors. This has a corner frequency close to 100MHz and a rapid fall-off, to
reject the 125MHz+ switching artefacts from the DAC while leaving the generated signal largely untouched.
96 Silicon Chip
siliconchip.com.au
While the AD9850 doesn’t provide a direct way to produce a triangle or square wave, a fixed or variable duty cycle square
wave can be derived from a generated sinewave plus a DC reference voltage using the internal comparator.
We have summarised the basic
coding for the frequency, control and
phase registers graphically in Fig.3.
The 40 bits making up the serial word
are shown in a line along the top of
the diagram, with the 32 frequency
programming bits (red tint) on the left,
followed by the three control bits and
the five phase programming bits (blue
tint) on the right.
The entire 40 bits must be sent to
the AD9850 “LSB first”, ie, B0, B1, B2,
B3 and so on, right up to B39. When
all 40 bits have been shifted into the
AD9850’s data input register, a short
positive pulse is applied to the chip’s
FQ_UD/SS pin (pin 3 of CON2 in
Fig.2), to load the data into the frequency/phase data register.
If you decide to use parallel loading instead of serial loading, the main
difference is that you have to present
bits B0-B7 to pins 2-9 of CON1 first,
followed by a pulse to the W_CLK pin
(pin 2 of CON2). Then you repeat this
with bits B8-B15, B16-B23, B24-31 and
finally B32-39.
Only after all five bytes have been
loaded do you then need to apply a short
positive pulse to the FQ_UD/SS to load
it all into the frequency/phase register.
The formula to determine the DDS
output frequency from the 32-bit frequency word is shown at bottom left
in Fig.3. With a 125MHz clock and a
32 bit frequency word, the AD9850
has a minimum output frequency of
0.02910383Hz and this is also the
minimum frequency increment. So
the output frequency Fout = ΔPhase ×
0.02910383. Or if you prefer, ΔPhase =
Fout ÷ 0.02910383.
For most purposes, you won’t really
have to worry about the final eight bits
of that 40-bit programming word, because as you can see bits B32, B33 and
B34 should be set to zero for normal
operation, while bits B35-B39 should
also be set to zero if you don’t want to
perform phase modulation.
So now we just need to connect the
module up to our microcontroller.
Note that we’re only going to do that
using the SPI serial interface.
Driving it from an Arduino
There isn’t much to it, as shown in
Fig.4. Most of the connections can be
made via the 6-pin ICSP header. These
connections 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.
The only connection that’s not available via the ICSP header is the one
for SS/CS/FQ_UD, which needs to be
connected to the IO10/SS pin of an
Arduino Uno, Freetronics Eleven or
Duinotech Classic as shown.
With other Arduino variants, you
should be able to find the corresponding pin without too much trouble and
even if you can’t, the pin reference can
be changed in your software sketch
to match the pin you do elect to use.
One thing to bear in mind when
you’re writing your own sketch to
program the AD9850 module is the
requirement for the 40-bit programming word to be sent LSB first, instead
of the usual MSB first.
And because the serial data on the
SDATA/MOSI line is clocked into the
chip on the rising edges of the SCLK
pulses and SCLK must idle low, this
means you need to set the SPI Settings
parameters like this:
SPISettings(5000000, LSBFIRST,
SPI_MODE0)
(where that first parameter is the serial clock frequency). Also, since the
Fig.3: format for loading frequency, phase and control data into the AD9850. 40 bits of data are shifted into the IC,
least significant bit (LSB) first, with the first 32 bits setting the frequency, the next three bits controlling the powerdown (sleep) mode and the final five bits setting the phase.
siliconchip.com.au
September 2017 97
You can see that once the frequency exceeds ~25MHz, a fair amount of distortion is introduced into the output.
FQ_UD input of the AD9850 is active
high, this line should be programmed
to idle in the low state and only go high
for loading the data into the AD9850’s
frequency/phase register.
If this sounds confusing, please refer
to the example Arduino sketch I have
written; more about this shortly.
Driving it from a Micromite
It’s also quite easy to drive the module from a Micromite, using the connections shown in Fig.5. By connecting the MOSI, SCK and SS/FQ_UD
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.
Again, there is just one small
complication, brought about by the
AD9850’s need to have the data sent
to it LSB-first.
As MMBasic’s SPI commands only
have provision for MSB-first data
transmission, your program needs to
reverse the bit order before it’s sent
to the DDS.
You’ll see one way of doing this in
my example program for the Micromite, discussed below.
Note that if you’re using the Micromite LCD BackPack, because the LCD
touchscreen also communicates with
the Micromite via its SPI port, 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 to
prevent any SPI conflicts. This is also
illustrated in my example MMBasic
program.
Programming examples
The sample program for Arduino is
called “sketch_for_testing_AD9850_
DDS_module.ino”. This simple program initialises the AD9850, programs
it to generate a 100kHz sinewave, then
informs you of the current frequency
via the Serial Monitor utility built into
the Arduino IDE.
Fig.4: as with many of the modules we’ve examined in this series of articles, connecting the AD9850 DDS module to an
Arduino is quite simple. All you have to do is connect the 5V, GND and SPI signals to the ICSP header on the Arduino,
leaving just the slave select (SS) pin which normally goes to I/O pin 10.
98 Silicon Chip
siliconchip.com.au
At the same time, it gives you the
opportunity to type a new frequency
into the Serial Monitor and if you respond by typing in a new frequency
and clicking on the Send button, it
will load the new frequency into the
AD9850 and repeat the process.
It’s pretty straightforward, but it
should demonstrate the basics of controlling the AD9850 DDS module from
an Arduino.
The other program is written for
the Micromite LCD BackPack and is
called “Simple AD9850 sig gen.bas”.
This one is a little more complicated,
partly because of the need to control
the program’s operation via the LCD
touchscreen and partly because of the
need to reverse the bit order of the 40
bits of data sent to the AD9850 because
of its LSB-first requirement.
It again lets you control the AD9833’s
output frequency, in this case by using buttons and a virtual keypad on
the BackPack’s touchscreen. It’s quite
easy to drive and again, should show
you how the AD9850 can be controlled
via a Micromite.
Both of these programs are available
from the Silicon Chip website (www.
siliconchip.com.au).
SC
siliconchip.com.au
Fig.5: again, wiring up this module to a Micromite is pretty straightforward.
Check the instructions for your Micromite to determine the MOSI and SCK
pins; as shown here, for the 28-pin Micromite and LCD BackPack, these go
to pins 3 and 25. That just leaves 5V, GND and the slave select pin, which in
this case we’ve wired to pin 22.
September 2017 99
|