Hello,
Just to preface, I am relatively new to arduino.
I am using an Arduino Due to control a AD9959 DDS - I seem to of hit a bit of a roadblock. In my attempts to get amplitude modulation working, I wound up creating a for loop to continously update the values being sent to the DDS registers via SPI.transfer.
However, when I run my code (which appears to be working fine when I Serial.print debug) and look at the output on a spectrum analyser, the amplitude does not ramp up linearly, instead it begins ramping quickly and then the rate of ramp drops (non linearly by the looks of it) to a crawl, though the rate never goes down to '0' so my loops are completing.
I am not sure if it is an issue with my Arduino SPI.transfer timings, the DDS or even my measuring technique.
When I try and do 'manual' sweeps; not using a for loop, the issue does not seem to be present.
I'm just wondering if you more savvy people have any ideas or if my code seem fishy (I will also post to Analog Devices Engineer Zone).
Attached is my code, the area of interest is my void loop - what I've done in my setup is take an integer value (my Amp value) turn into binary, put into an array which I then split into two. (I'm aware this is clunky and there are better ways of doing it)
The actual loop command is meant to just be reading straight from the arrays I have prepared in my setup, so I can't really see how it would influence my problem anyway.
Cheers,
Chris
Chris_Summer_DDS_SingleFreq_AMP_SWEEP_working_code_clean.ino (4.26 KB)