10 years ago.

Problematic VCO

0 down vote favorite I hope your day is going well. I am programming a LPC1768 to send signals to at AD5791 in order to output a given frequency dependent on the output voltage of the AD5791. I have attached the circuit diagram. I have been able to seemingly read and write to the AD5791 from the LPC1768. However, when I connect the VCO to a signal analyzer I see no variation in the peak frequency when I "change" the voltage output of the AD5791. I have been programming using mbed. Below is the code I am currently using. Inputs would be greatly appreciated. I believe the issue may lie in how spi.write is implemented. The AD5791 requires 20-bit words and the LPC1768 can only send 16-bit words max. Also, there is the matter of endianness - but I believe I have solved that as I am reading out what I write to the AD5791 in the order expected.

VCO

#include "mbed.h"

SPI spi(p5, p6, p7); // mosi, miso, sclk
DigitalOut cs(p8);

int main()
{
spi.format(8,1);
spi.frequency(1000000);
cs=1;

while(1)
{

    cs = 0;
    spi.write(0x10);
    spi.write(0xFF);
    spi.write(0xFF);
    cs = 1;

    cs = 0; 
    int first = spi.write(0x90);
    int second = spi.write(0x00);
    int third = spi.write(0x00);
    cs = 1;

    printf("first register = 0x%X\n", first);
    printf("second register = 0x%X\n", second);
    printf("third register = 0x%X\n", third);
}
}

1 Answer

10 years ago.

The Analog Devices AD5791 is a DAC "digital to analog converter" - no VCO "voltage controlled oscillator" -? Have you set the LDAC signal to low ? RESET + CLR high ?

If your use the DAC to generate a control voltage for a VCO : Your code wil generate only a short peek with 0x10FFFF , than 0x900000 for a long time because the tree printf will take a lot of time compared to the spi write. Add delays between the spi writes to alow the vco to change the frequency.

Hi Peter! Thank you so much for the response. Sorry for the delay, I just returned from travel. So, the spi.write does not automatically adjust the LDAC, RESET, and CLR? Does writing 0x200012 to the AD5791 set LDAC to low and RESET and CLR to high? I read it on this site: http://wiki.analog.com/resources/quick-start/ad5791

If not, how am I suppose to do that? Also, would deleting the 0x900000 solve the delay issue? I was only using that for debugging purposes.

Thank you again!

posted by Tash Woods 17 Apr 2014

Hello Tash, you have to feed all input signals of the AD5791. See page 6 of the datasheet. If LDAC is low, the SYNC signal will act as cs. The CLR signal can be used to set the DAC output a specified starting point. To start set it inactive to high. Also RESET has to be set high for normal operation. You also have to supply the reference voltages to get a output. Check all pins from the datasheet. This chip is not plug and play and need also some analog signals.

posted by Peter Drescher 18 Apr 2014

Hey Peter! Thank you again for your speedy response. So, is there a reason to use spi.write()? Also, how to I set LDAC, SYNC, CLR and RESET? Some electricians already connected the AD5791 to the LPC1768 so I believe all the reference voltages and pins are fine.

posted by Tash Woods 18 Apr 2014

You need the schematic from this electricians to see how the signals are connected. If the signals are connected to LPC1768 IO pins you have to set them.

posted by Peter Drescher 21 Apr 2014

Ok, I'll try to send you a link to the setup. Do you think there could be a way to set LDAC, SYNC, CLR and RESET in my code?

posted by Tash Woods 22 Apr 2014

I got it to work! https://gist.github.com/tashwoods/84c81f87fa6e0f1b98a2 Thank you again!!!

posted by Tash Woods 02 May 2014