Problems with AD9850 signal generator

BillBWann

Member
About a year ago, I bought a couple of AD9850 signal generator modules on Ebay for about $5 each. I don’t have any specific need for such a device but thought it could be interesting to see how they worked. I’ve only now got around to trying them out and I haven’t had any luck so far getting a signal out of either of them.

At this stage I’ve simply hooked up the module to an 08M2 home made module that I use for this sort of thing and I’ve used Matherp’s finished project as a guide for both hardware & software. When powered up, the red LED on the module comes on, it pulls about 100 mA and the output waveform on pin 10 rises to about 0.5 volts and sits there steadily.

IMG_5869.JPG

I’ve included a photo of my rough setup but I don’t really expect anyone to follow it in detail. In essence, I’ve connected data lines D0 & D1 to Vcc and D2 to ground and I’ve tied the reset line to ground with a 1k resistor. I’ve connected Vcc (5 volts) & ground of both modules together. I’ve also connected the control lines between the 08M2 & the AD9850 as follows:-
C.1 - Data (leg 4 of AD9850 board)
C.2 - W_CLK (leg 2 of AD9850 board)
C.4 - FQ_UD (leg 3 of AD9850 board)

I’ve then run the program below which simply switches the module to serial mode and then reads in a 40 bit word which should set it to a frequency of 1k hertz. However I get no signal out of pin 10. I’ve looked at the signals going to the module from the 08M2 and they look fine to me.

Code:
#picaxe 08M2
#no_data

symbol D7=pinC.1 
symbol W_CLK=C.2
symbol FQ_UD=C.4

low W_CLK
low FQ_UD
low c.1

pause 10
pulsout FQ_UD,10		'reset the address pointer to first register
pause 10
pulsout W_CLK,10		'Read in control word from 8 bit data lines
pause 10
pulsout FQ_UD,10		'Switch to serial mode input
pause 10

do
	for b2=0 to 4	'Read in 5 bytes from EEPROM and send them serially to the AD9850 module
		read b2,b0
		for b3=1 to 8
			D7=bit0
			pulsout W_CLK,1
			b0=b0/2
		next b3
	next b2
	pulsout FQ_UD,10       'load 40 bit control value - update frequency
	low c.1
	pause 1000
loop

EEPROM 0,(56,134,0,0,0)		'1k Hertz
I see in the brief documentation on the seller’s ebay site that it says “Parallel and serial data input can be selected via a jumper”. I don’t see any jumper on the board. From a read of the documentation for the AD9850, it would appear that there is no facility to select serial data via hardware so I can’t see how a jumper could function.

Has anyone else purchased this module and did you have any luck getting it going?

Any comments on what I might try next would be welcomed.
 

matherp

Senior Member
I've tested your code on a 28X2 and it works fine EXCEPT

for reasons I don't understand I needed to explicitly set the direction register. I would have expected the "low" command to do this but on the X2 part they clearly don't.

Your wiring looks good so try putting dirsc=00010110 into your code
 

hippy

Technical Support
Staff member
I've tested your code on a 28X2 and it works fine EXCEPT

for reasons I don't understand I needed to explicitly set the direction register. I would have expected the "low" command to do this but on the X2 part they clearly don't.
The LOW commands should be setting pins as outputs for all PICAXE chips and we would suspect that they are.

If explicitly setting the pin directions with a 'Let dirsC=' command makes it work, the only change would be in making those pins outputs earlier and more simultaneously. That would suggest some issue with initialisation of the hardware interface. If pins are input and signals are floating when the PICAXE starts and progresses through initialisation and this is what is causing the issue this might be resolved by adding pull-up or pull-downs.
 

hippy

Technical Support
Staff member
Code:
#picaxe 08M2
#no_data

	for b2=0 to 4	'Read in 5 bytes from EEPROM and send them serially to the AD9850 module
		read b2,b0

EEPROM 0,(56,134,0,0,0)		'1k Hertz
You do not want a #NO_DATA directive in the program because this prevents the EEPROM being pre-loaded with the data you want to send to the module.
 

matherp

Senior Member
Bill

I've now tested your code with an 08M2 and it works fine as long as (as per Hippy's comment) you comment out the #no_data at least the first time the program is loaded.

There is no jumper on the board. The comment refers to the fact that tying some of the parallel data lines to VCC or GND during power up puts it into serial mode

I suggest you check your wiring again
pinout of the AD9850 module is:
VCC pins 1,18,19,20
GND pins 6,11,17
C.1 (picaxe pin 6) to pin 4 (Data)
C.4 (picaxe pin 3) to pin 3 (Latch)
C.2 (picaxe pin 5) to pin 2 (Clock)
output to scope pin 10

The code definitely works as-is on a 08M2 if the unit is OK and the wiring as above
 

BillBWann

Member
Code:
#picaxe 08M2
#no_data

	for b2=0 to 4	'Read in 5 bytes from EEPROM and send them serially to the AD9850 module
		read b2,b0

EEPROM 0,(56,134,0,0,0)		'1k Hertz
You do not want a #NO_DATA directive in the program because this prevents the EEPROM being pre-loaded with the data you want to send to the module.
Thanks everyone for your comments - especially Matherp & Hippy. Yes, it was the no_data directive. Have to say that I feel pretty stupid because I've been caught by that before. I'd looked at the signals going to those 3 pins with my old cro and hadn't noticed that the data lines weren't reflecting the real data but some old values that I'd previously had in EEPROM. I'd also looked at the pins on the simulator and that all looked correct.

Is there any reason why the simulator doesn't behave like the real situation and not read the EEPROM if you have the no_data directive? Or alternatively, ignore the directive as it does now but give you a warning? It might save me from my stupidity in future.

Thanks again. I was about to toss out the 2 modules believing that all of Dippy's warnings about getting what I deserve for paying so little, had finally caught up with me.

Bill
 

hippy

Technical Support
Staff member
Is there any reason why the simulator doesn't behave like the real situation and not read the EEPROM if you have the no_data directive? Or alternatively, ignore the directive as it does now but give you a warning?
The simulator is precisely that, not an entirely accurate emulation of physical hardware.

The #NO_DATA prevents downloading of EEPROM statement data into a physical chip rather than preventing reading; what will then be read when a program runs is either data specified by EEPROM commands, or data previously written to the Data Eeprom.

With simulation there is no ability to retain Data Eeprom from previous simulations so the behaviour cannot be the same. It may however be possible to change the behaviour there is.
 

Cranky

New Member
Ok guys, I'm trying to follow this thread, but I am missing something here....

When I go to the AD9850 Calculator (google it) at the Analog Devices website, it is showing a serial load for 1 KHz as being 1C, 61, 00, 00, 00 (those obviously being in hexadecimal). In decimal it would be 28,97,00,00,00 if my math is correct.

So I am wondering why the above code sets EEPROM 0 to the values of 56,134,0,0,0 when the desired frequency out is 1 KHz?

Am I missing something here?

Cranky
 

matherp

Senior Member
Depends which order you are reading the bits. 56,134 (0x38,0x86) is the parallel calc from the AD website but the code is reading them lowest bit first. The serial calc on the website reverses the bits and is a bit counter intuitive so 1Khz is 1C,61 but 999hz is A8,61 - bigger number but lower frequency
 

Cranky

New Member
Thanks Matherp!

I knew I was ALMOST following along! That's what I get for trying to sort things out in the wee hours of the morning.
 

Lemon

New Member
Please, would anyone be willing to help me with the AD9833 control. I used the same connection but I'm not sure what to enter the code. I would like to generate a 3.5MHz frequency. All I need is only a square wave
output. I therefore don't need the DAC running.
Thank you for the kick.
 

premelec

Senior Member
@Lemon do you really only want one 3.5MHz frequency and not a VFO? A simple crystal oscillator would seem easier... please give more info on what your use is... e.g. if just looking for band edge marker [80M] then a variety of harmonic generating circuits could work...
 

Lemon

New Member
Yes, it will be VFO, I want to adjust the program to change to other frequencies. Crystal 3,579MHz I have now :) The base is to hang up so the DDS will produce 3.5MHz. I do not know exactly how to calculate the DDS feed constants. I proceed from this:

#picaxe 08M2
#no_data

symbol D7=pinC.1
symbol W_CLK=C.2
symbol FQ_UD=C.4

low W_CLK
low FQ_UD
low c.1

pause 10
pulsout FQ_UD,10 'reset the address pointer to first register
pause 10
pulsout W_CLK,10 'Read in control word from 8 bit data lines
pause 10
pulsout FQ_UD,10 'Switch to serial mode input
pause 10

do
for b2=0 to 4 'Read in 5 bytes from EEPROM and send them serially to the AD9850 module
read b2,b0
for b3=1 to 8
D7=bit0
pulsout W_CLK,1
b0=b0/2
next b3
next b2
pulsout FQ_UD,10 'load 40 bit control value - update frequency
low c.1
pause 1000
loop

EEPROM 0,(56,134,0,0,0) '1k Hertz

-------------------------------------------------

3.50000000 MHz + 25MHz clock = 23D70A4 -

and DDS table: FCB $70A4 ;0111000010100100 #1-L
FCB $48F5 ;0100100011110101 #1-H

But where to place a constant?
 
Last edited:
You seem to be using code intended for an AD9850. The AD9833 is quite different. I haven't used the AD9833, so I can't offer much advice other than to check out the datasheet. I have used the AD9834, AD9850 and AD9851.

Have you considered using one of the small PCBs fitted with an AD98950 or AD9851 and which are available from eBay? My home made transceiver uses the last one as a VFO.

Richard
 

Lemon

New Member
Yes, I have this module from Aliexpress:
https://ae01.alicdn.com/kf/HTB1JykOXHGYBuNjy0Foq6AiBFXat/AD9833-Programmable-Microprocessors-Serial-Interface-Module-Sine-Square-Wave-DDS-Signal-Generator-Module.jpg_220x220.jpg
My VFO is designed to be a fox hunter. Receivers are commercially available, not transmitters. The existing home transmitter includes a crystal resonator or DIL oscillator. But only 3.579545 and 3.686 MHz are available. Other frequencies to make a crystal are expensive. I need several transmitters for the partitions. Everyone should have a different frequency. I was thinking of using DDS. AD9850 can be used. And it was mentioned how to pilot. But it is several times more expensive than 9833. And for generating a 3.5MHz frequency, 9850 and 9851 are an unnecessarily big hammer. So 9833 ideal. No i do not have such programming knowledge and I can not feed DDS from Picaxe 08M2 according to datasheet... . Picaxe would also make keying with the correct CW characters. That's what I've mastered. But the serum line for AD9833 needs help. I'm not able to create a DDS hang up program. If I have a pattern as it is in the first post, it would be great.
 
At start-up you must reset the AD9833. This is bit DB8 of the 16 bit control word (see Figure 5 and Table II of the datasheet). The tuning information is split up into the most significant 14 bits and the least significant 14 bits with 2 bits added to each which indicate the frequency register, making up two 16 bit words.

As an example, with a 25MHz clock frequency and a frequency to be generated of exactly 3,500,000Hz, the frequency setting information is 3,500,000* 2^28/25,000,000 (decimal 37,580,963) which is hexadecimal 23D70A3. This needs to be split into the least significant 14 bits (hexadecimal 30A3) and the most significant 14 bits (hexadecimal 8F5) plus the two bits for the frequency register and sent to the AD9833 with the control word. I have written an EXCEL spread sheet to calculate these numbers.

I have just ordered a PCB with an AD9833 from China but it will be several weeks before it arrives.

Richard
 

Lemon

New Member
Thank you for answer. I'm glad to wait if someone is able to feed DDS AD9833. I also had to order a new board with the AD9833, something went wrong on the desk, and AD has a 180mA power supply and very hot. Probably went to the silicon sky due to my inattention. I need fox hunters until the summer holidays, there is still plenty of time. Thank you.
 
Thank you for answer. I'm glad to wait if someone is able to feed DDS AD9833. I also had to order a new board with the AD9833, something went wrong on the desk, and AD has a 180mA power supply and very hot. Probably went to the silicon sky due to my inattention. I need fox hunters until the summer holidays, there is still plenty of time. Thank you.
I've sent a notification to you about programming frequencies into the AD9833 - please check your personal notifications.

Richard
 

nickols

New Member
About a year ago, I bought a couple of AD9850 signal generator modules on Ebay for about $5 each. I don’t have any specific need for such a device but thought it could be interesting to see how they worked. I’ve only now got around to trying them out and I haven’t had any luck so far getting a signal out of either of them.

At this stage I’ve simply hooked up the module to an 08M2 home made module that I use for this sort of thing and I’ve used Matherp’s finished project as a guide for both hardware & software. When powered up, the red LED on the module comes on, it pulls about 100 mA and the output waveform on pin 10 rises to about 0.5 volts and sits there steadily.

View attachment 16203

I’ve included a photo of my rough setup but I don’t really expect anyone to follow it in detail. In essence, I’ve connected data lines D0 & D1 to Vcc and D2 to ground and I’ve tied the reset line to ground with a 1k resistor. I’ve connected Vcc (5 volts) & ground of both modules together. I’ve also connected the control lines between the 08M2 & the AD9850 as follows:-
C.1 - Data (leg 4 of AD9850 board)
C.2 - W_CLK (leg 2 of AD9850 board)
C.4 - FQ_UD (leg 3 of AD9850 board)

I’ve then run the program below which simply switches the module to serial mode and then reads in a 40 bit word which should set it to a frequency of 1k hertz. However I get no signal out of pin 10. I’ve looked at the signals going to the module from the 08M2 and they look fine to me.

Code:
#picaxe 08M2
#no_data

symbol D7=pinC.1
symbol W_CLK=C.2
symbol FQ_UD=C.4

low W_CLK
low FQ_UD
low c.1

pause 10
pulsout FQ_UD,10        'reset the address pointer to first register
pause 10
pulsout W_CLK,10        'Read in control word from 8 bit data lines
pause 10
pulsout FQ_UD,10        'Switch to serial mode input
pause 10

do
    for b2=0 to 4    'Read in 5 bytes from EEPROM and send them serially to the AD9850 module
        read b2,b0
        for b3=1 to 8
            D7=bit0
            pulsout W_CLK,1
            b0=b0/2
        next b3
    next b2
    pulsout FQ_UD,10       'load 40 bit control value - update frequency
    low c.1
    pause 1000
loop

EEPROM 0,(56,134,0,0,0)        '1k Hertz
I see in the brief documentation on the seller’s ebay site that it says “Parallel and serial data input can be selected via a jumper”. I don’t see any jumper on the board. From a read of the documentation for the AD9850, it would appear that there is no facility to select serial data via hardware so I can’t see how a jumper could function.

Has anyone else purchased this module and did you have any luck getting it going?

Any comments on what I might try next would be welcomed.
Hi Bill,
I have a DDS board without jumpers. It simply has two opposite rows of pins for serial or parallel interface. I made two versions of a DDS vfo with this board, but none of them work. The first was made using a pic 16f84a as a microcontroller, the second, which I made yesterday, uses an Arduino nano clone. I powered the two stages with an only LM7805 ic. No way to have a signal out of the DDS. I read somewhere that some boards with AD9850 chip need to be powered with 3.3 volts instead of 5 volts to work. Do you know something about this?
Maybe this could be the issue.
Please let me know. Thank you very much.
Ciro IK6AIZ
 

BillBWann

Member
I read somewhere that some boards with AD9850 chip need to be powered with 3.3 volts instead of 5 volts to work. Do you know something about this?
Maybe this could be the issue.
Hi Ciro,
I had no problems powering the AD9850 board with 5V and it worked reliably once I commented out the “no_data” line in my program as detailed in this thread.
 
Top