Completed Project Experimenting with the AD9851

Thread Starter

bloguetronica

Joined Apr 27, 2007
1,541
Hi,

I've been contemplating using the AD9850, but then I've decided to go for the AD9851. Despite some issues, I found that it is quite useable and somewhat SPI compatible (more on that later). So, I've bought one of those boards from AliExpress (possible fakery, but the markings on the chip are laser engraved, and the chip looks genuine). I found out that the board itself already had two 10K pull-up resistors in D0 and D1, so I only had to ground D2 in order to enter serial mode. I've connected it to the CP2130 evaluation board as the image shows.

AD9851.jpg

Here is a correspondence between the AD9850 and the CP2130, concerning the connections:

AD9851 boardCP2130 evaluation board
5VVBUS
GNDGND
D2GND
D7MOSI
FQ (FQ_UD)GPIO.0
CLKSCK

However, I had the idea of connecting the RST pin on the AD9851 to GPIO.7, to do a reset on demand. Although it does work, it proved to be a bit cumbersome for testing. Another idea would be to connect the former to the !SUSPEND pin on the CP2130, but unfortunately, that didn't work.

Anyway, using the connections listed in the table above, it is possible to use the AD9851 as an SPI slave device. FQ only requires a rising edge for the acknowledgement, and the length of the pulse could be infinite. Thus, it can be directly connected to a chip select pin on the CP2130.

Having done that, interacting with the AD9851 is easy. However, converting an arbitrary frequency value to a byte sequence is not. Not only the bytes are flipped (consider a little-endian approach), but so are the bits within each byte. Doing this conversion process by hand will lead to mistakes more often than not, judging by my own experience. The frequency is set by four bytes, and the final byte sets the phase and other parameters (namely, the REFCLK mulltiplier enable, which you will undoubtedly need, because the low pass filter will have no effect otherwise. If you use Windows, you can use the CP2130 Evaluation Tool application. Under Linux, CP2130 Commander comes to the rescue.

AD9851-CP2130Configurator.jpg

Nevertheless, if you happen to have a CP2130 evaluation board, or any other board that uses the CP2130, and if you wish to evaluate the AD9851, you can use the source code attached to compile the program for Linux. That program is very simple to use, and all you have to do is to specify the frequency (in kHz) as an argument.

AD9851-Terminal.jpg

I've decided to open this thread in the hope that it will be useful to someone. The AD9851 is not simple to use, and there is not a lot of information (namely, there are no schematics) on how to interface with it via SPI. I'm planning to use it with the MCP2210 in the future.

Kind regards, Samuel Lourenço

Edit: Updated the source code. Basically, changed some names and deleted junk code. Some comments were corrected as well
 

Attachments

Last edited:

Thread Starter

bloguetronica

Joined Apr 27, 2007
1,541
I've also experimented controlling AD9851 board with the MCP2210 from Microchip, as an alternative to the CP2130. For that, I've used a modified "USB SPI click" board from Mikroe. Basically, the power selector shunt in it was set to the 5V position. However, this modification is not required. The connections are as follows:

AD9851 board"USB SPI click" board
5V5V
GNDGND
D2GND
D7SDO
FQ (FQ_UD)GP0
CLKSCK

You can also use the MCP2210 breakout board from Microchip, but since that that board only has one ground pin, you'll have to connect D2 to ground directly on the AD9851 board. Thus, you only have to make the following connections between boards:

AD9851 boardMCP2210 breakout board
5VVDD
GNDGND
D7MOSI
FQ (FQ_UD)0
CLKSCK

In the file attached, you can find the source code to compile the program for the MCP2210. Similarly to the previous source code, it can be compiled under Linux, just by running make. The compiled program then can be used via the terminal, as before.
 

Attachments

Thread Starter

bloguetronica

Joined Apr 27, 2007
1,541
A month ago, I've modified the AD9851 board that I have, in order to implement some form of amplitude modulation. Basically, this was done by removing the resistor R6, which was connected to pin 12 (Rset) of the AD9851, and by soldering three wires so that another board can be connected. That second board is to provide modulation.

ModifiedAD9851Board-1.jpg

ModifiedAD9851Board-2.jpg

The red and black wire provide power for the second board. The blue wire, connected to pin 12, is there for modulating the amplitude. This modulation is done via a 2.21k resistor. That resistor is not connected to ground, but to the output of an op-amp, which oscillates between Vgnd and Vref. Vref is obtained from pin 12. I've done some testing with a prototype board, and this was a relative success. Using the same pin to read a voltage from and to set a current is not ideal, but it works nonetheless.

The second board required some corrections, though, so it had to be remade. I'm still waiting for what I hope it will be the definitive board. Note that there are two headers. The 3-pin one is to be connected to the board above. The 2-pin one is to be connected to a NO momentary switch, for the PTT.

AmpModulPrototype.jpg
 

Thread Starter

bloguetronica

Joined Apr 27, 2007
1,541
In an attempt to solve some issues between the MCP2210 and the AD9851, I've decided to use the MCP23S17 in the form of a Mikroe "Expand click" board, to send data in parallel mode to the AD9851. Basically, the AD9851 has the data pins connected to the port A of the MCP23S17, which in turn receives the data from the MCP2210 via SPI. However, the FQ and CLK pins of the AD9851 are still directly connected to the MCP2210, albeit to different pins and being used differently. I was also able to reset the AD9851 without many issues. Note that I'm still using the modified "USB SPI click" board described in a post above.

MCP2210-MCP23S17-AD9851.jpg

There are connections between the three boards, described in the tables below:

AD9851 board"Expand click" board
5VVCC
GNDGND
D0RA0
D1RA1
D2RA2
D3RA3
D4RA4
D5RA5
D6RA6
D7RA7

AD9851 board"USB SPI click" board
RSTGP2
CLKGP4
FQ (FQ_UD)GP5

"Expand click" board"USB SPI click" board
3.3V5V
GNDGND
SDISDO
SDO (not actually needed)SDI (not actually needed)
SCKSCK
CSGPO
RSTGP1

However, this solution of using the MCP27S17 to push data in parallel mode to the AD9851 is too cumbersome and doesn't solve the issues seen before, but rather complicates things further. It creates more points of failure, and it is harder to implement both in hardware and software.

I've attached some commands in the form of source code, which can be compiled on almost any Linux system. There are two commands: one to reset and another one to set the frequency.
 

Attachments

Thread Starter

bloguetronica

Joined Apr 27, 2007
1,541
Hi blog,
Do you have a specific question about this project, that other members can help answer.?
E
I do, actually. Why, despite my efforts and despite every combination of chips used, do I have to issue the command twice in order to set the frequency? Someone suggested to interface the AD9851 in parallel, but after doing that and after altering the program code, the behavior is the same.
 
Top