Giter Club home page Giter Club logo

ad9959's People

Contributors

b-d-doyle avatar cjheath avatar maggo1404 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ad9959's Issues

use of sweep...( )

@cjheath

After a long time of trial and error, I was able to get the the sine wave generated from AD9959 evaluation board using ArduinoUNO. Thank you for your help.

Here is the evaluation board, arduino uno, and two level shifters

board setting

Below is an oscilloscope output plot.

sine wave from AD9958

However, when I try "Sweeps", it doesn't work yet. Is there something not right in my code? I attached my current code at the end of this message.

Here is warning messages from my Arduino IDE.

...\libraries\AD9959/AD9959.h:224:32: warning: invalid conversion from 'long int' to 'AD9959<10, 7, 2, 10000000, 100000, 13, 12, 11>::CFR_Bits' [-fpermissive]

...\libraries\AD9959/AD9959.h: In instantiation of 'void AD9959<ResetPin, ChipEnablePin, UpdatePin, reference_freq, SPIRate, SPIClkPin, SPIMISOPin, SPIMOSIPin>::sweepAmplitude(AD9959<ResetPin, ChipEnablePin, UpdatePin, reference_freq, SPIRate, SPIClkPin, SPIMISOPin, SPIMOSIPin>::ChannelNum, uint16_t, bool) [with unsigned char ResetPin = 10; unsigned char ChipEnablePin = 7; unsigned char UpdatePin = 2; long unsigned int reference_freq = 10000000; long int SPIRate = 100000; unsigned char SPIClkPin = 13; unsigned char SPIMISOPin = 12; unsigned char SPIMOSIPin = 11; uint16_t = unsigned int]':

...\transmitter_modulation2.ino:38:43: required from here

...\libraries\AD9959/AD9959.h:360:44: warning: left shift count >= width of type [-Wshift-count-overflow]

 write(CW1, ((uint32_t)amplitude) * (0x1<<(32-10)));

                                    ~~~~^~~~~~~~~~

Below is the full code that worked to generate single tone signal and the "Sweeps" that I am trying.

`#include "AD9959.h"

class MyAD9959 : public AD9959<
10, // ResetPin
7, // ChipEnablePin
2, // UpdatePin
10000000, // (reference_frequency)
100000,//
13,//
12,//
11//
// SPIRate, SPIClkPin, SPIMISOPin, SPIMOSIPin

{};

void setup() {
pinMode(6, OUTPUT); //

//SPI.begin(); // start the SPI library:

MyAD9959 dds;
//delay(1);

dds.setClock(20, 0);

uint32_t delta;
delta = dds.frequencyDelta(5000);

delta=dds.frequencyDelta(455000);
dds.setFrequency(MyAD9959::Channel2, 5000000UL); // shorthand for:
dds.setDelta(MyAD9959::Channel2, dds.frequencyDelta(5000000UL)); // 7.14MHz
dds.setAmplitude(MyAD9959::Channel2, 1023); // Maximum amplitude value
dds.setPhase(MyAD9959::Channel2, 16383); // Maximum phase value (same as -1)
dds.update();

dds.sweepFrequency(MyAD9959::Channel2, 8000000); // Target frequency
dds.sweepDelta(MyAD9959::Channel2, delta, false);// Target frequency delta
dds.sweepAmplitude(MyAD9959::Channel2, 512); // Target amplitude (half)
//dds.sweepPhase(MyAD9959::Channel2, 8192); // Target phase (180 degrees)
dds.sweepRates(MyAD9959::Channel2, 100, 125, 1000, 250);

digitalWrite(6, HIGH);
delay(1000);

digitalWrite(6, LOW);
delay(1000);

}

void loop() {
digitalWrite(6, HIGH);
delay(1000);

digitalWrite(6, LOW);
delay(1000);

}`

Arduino DUE error

Hi, I am testing this library with an Arduino DUE, but immediately run into a problem. I get the following error when trying to create the AD9959 class:

 reset();

      ^

Documents\Arduino\libraries\AD9959/AD9959.h:212:10: error: invalid conversion from 'int' to 'AD9959<2u, 3u, 4u, 25000000ul>::CFR_Bits' [-fpermissive]

Could you help me along on how to fix this?

Best,

Sander

possible bug

hey, i was using your code as reference to use an stm32 microcontroller to control the ad9959 and was wondering if you shouldn't have used a pre-increment (--len) or used a 'greater than' (>) signal at line 420:

AD9959/AD9959.h

Line 420 in 251e54b

while (len-- >= 0)

this while loop will run an extra time (5 times if len=4)

Bug with reading register?

Hi, to get read(reg) to work for me, I had to make a small change to write(reg,value).

To read register reg, you write 0x80|reg. But this bit makes the write function always think the register's length is 4.

AD9959/AD9959.h

Line 448 in eefac4c

int len = reg < sizeof(register_length) ? register_length[reg] : 4;

I got it to work for me by changing line 448 to:
int len = (reg&0x1F) < sizeof(register_length) ? register_length[reg&0x1F] : 4;

AD9959's suitability as a transceiver VFO

Hi Clifford,
I'd like to move on from si5351 VFOs in transceiver projects, and the AD9959 looks like an obvious candidate, now that the 5V boards are on eBay and Ali at good prices. The issue is update speed. Do you expect setFrequency() would adjust one of the channel's frequencies sufficiently fast to emulate an analogue VFO? You want to be able to spin an optical encoder and have the DDS keep up.
regards Paul VK3HN.

PS. We did CS together if I remember correctly!

How to set the profile pins using the software -urgent request

Hi

I have been able to get your code working but I was wondering how to set the profile pins without making use of an external signal to the profile pins in the U2 header. As it is possible in the proprietary software I assume it should be possible to set these pins in the software as well. Could you please advise me.

SDIO_0 insufficient drive current?

I was able to use the GUI software with the AD9959 eval board included software from the manufacturer to correctly control and generate sinusoids on all four channels. So I felt confident the DDS board was clocked correctly and working. Then I changed the jumper headers as needed to take over control with a micro controller (Arduino MEGA) and found no sinusoid signal output. The details are as follows.

Is there a known issue with the SDIO_N pins not being set to "output" or having enough drive current capacity? The following is a screenshot of the the SDIO_0 trace with and without connection to the actual AD9959 DDS.

b03

The actual connection is an Arduino MEGA Pin 51 to Bi-directional Level Shifter ([*1]) to the AD9959 SDIO_0 eval board pin.

Note, all the connections are the same as the AD9959.h file except the change for the MEGA SPI pins

  • Your chosen Chip Enable pin (3) to AD9959 CS (downshift to 3v3)
  • Your chosen Reset pin (2) to AD9959 RESET (downshift to 3v3)
  • Your chosen "Update" pin (4) to AD9959 I/O_UPDATE (downshift to 3v3)
  • Your chosen Sweep pin (Not connected) to Profile 0, 1, 2, 3 (downshift to 3v3)
  • SPI CLK (default: pin 52) to AD9959 SCLK (downshift to 3v3)
  • SPI MOSI (default: pin 51) to AD9959 SDIO_0 (downshift to 3v3)
  • Nothing (floating) to AD9959 SDIO_1
  • SPI MISO (default: pin 50) to AD9959 SDIO_2 (upshift from 3v3)
  • Ground to AD9959 SDIO_3
  • Ground to AD9959 Ground
  • 3v3 to AD9959 Digital Vcc
  • 3v3 to AD9959 Analog Vcc (+bead/filter)
  • Note, all these pins are left floating: PWR_DWN_U, RESET_U, SCLK_U, CSB_U, IO_UPDATE_U, P3_U, P2_U, P1_U, P0_U and P0, P1, P2, P3, PWR_DWN, SDIO_1
  • Note, using Arduino IDE 1.8.8

The goal is to get a single tone out of each of the 4 channels with the following code;
`
void setup() {

dds = new MyAD9959();

DDS_D0 = dds->frequencyDelta(7140000UL); // slow-expensive operation
DDS_A0 = 1023;
DDS_P0 = 4096;
DDS_D1 = dds->frequencyDelta(7140000UL); // slow-expensive operation
DDS_A1 = 1023;
DDS_P1 = 8192;
DDS_D2 = dds->frequencyDelta(7140000UL); // slow-expensive operation
DDS_A2 = 1023;
DDS_P2 = 12288;
DDS_D3 = dds->frequencyDelta(7140000UL); // slow-expensive operation
DDS_A3 = 1023;
DDS_P3 = 16383;

dds->setDelta(MyAD9959::Channel0, DDS_D0);
dds->setAmplitude(MyAD9959::Channel0, DDS_A0);
dds->setPhase(MyAD9959::Channel0, DDS_P0);

dds->setDelta(MyAD9959::Channel1, DDS_D1);
dds->setAmplitude(MyAD9959::Channel1, DDS_A1);
dds->setPhase(MyAD9959::Channel1, DDS_P1);

dds->setDelta(MyAD9959::Channel2, DDS_D2);
dds->setAmplitude(MyAD9959::Channel2, DDS_A2);
dds->setPhase(MyAD9959::Channel2, DDS_P2);

dds->setDelta(MyAD9959::Channel3, DDS_D3);
dds->setAmplitude(MyAD9959::Channel3, DDS_A3);
dds->setPhase(MyAD9959::Channel3, DDS_P3);

dds->update();
}
`
Perhaps my C-code is missing something? Or the hardware is not able to correctly drive the SDIO_N pins with enough current thru the bi-directional level shifter? Any other obvious issues?

Thank you for this library. Hoping I am doing some simple error :)

[*1] Adafruit's 8-channel Bi-directional Logic Level Converter - TXB0108. link

Found misprint in sweepPhase()

Hi!
I found a typo in the code - it should be CFR_Bits::MatchPipeDelay instead of CFR_Bits::MatchPipeDela

  void sweepPhase(ChannelNum chan, uint16_t phase, bool follow = true)          // Target phase (180 degrees)
  {
    setChannels(chan);

    // Set up for phase sweep
    write(
      CFR,
      CFR_Bits::PhaseModulation |
      CFR_Bits::SweepEnable |
      CFR_Bits::DACFullScale |
      CFR_Bits::MatchPipeDela |
      (follow ? 0 : CFR_Bits::SweepNoDwell)
    );

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.