- Setting up a sweep:

Sweeps are defined by two parameters, sweep delta and ramp rate. - Sweep Delta defines the change in output amplitude/frequency/phase on each sweep step.
- Ramp rate defines how often a sweep step is taken. It is based off of the AD9959's sync clock signal which will be one quarter of the AD9959's system clock. The ramp rate parameter specifies the number of sync clock cycles per sweep step. A ramp rate of 1 will cause the sweep delta to be applied every 1 sync clock cycle. For upward sweeps, the ramp rate parameter can have a value of 1-255. For downward sweeps the ramp rate can only be 1.
The time between sweep steps can be calculated with:
$ t = \frac{\textrm{Ramp Rate}}{\textrm{Sync Clock}} $
Using the Pico's 125 Mhz with a 4 times PLL Multiplier gives the AD9959 a system clock of 500 MHz and therefore a sync clock of 125 MHz.
For upward sweeps the time between sweeps can range from
Given the frequency resolution of
The set command will internally calculate the sweep delta and ramp rate by given the user provided sweep_rate using the continued fraction algorithm. Given a conversion factor
the ratio of sweep delta
$$ \frac{d}{r} = B\frac{4R}{f_{sysclk}} $$.
The continued fraction algorithm then returns the integer ratio approximation of the desired sweep_rate float and therefore set an integer sweep delta and ramp rate. The algorithm will respect the limits of each sweep mode, so the frequency tuning word sweep deltas can be between
Downward sweeps are not well supported by the AD9959, but they can still be done. The best method I have found for doing a downward sweep is to send the instructions via serial first, with the sweep autoclear bit set to active and the rising sweep tuning word set to the maximum. Then issue the IO_UPDATE signal while keeping the profile pin for that channel high. I believe this clears the sweep accumulator then quickly refills it with a max rate sweep before beginning the downward sweep. Other combinations of autoclear bit active or not and timing of the profile pins seem to cause even more issues with downward sweeps. The biggest downside of this method is that you cannot slow down the downward sweep ramp rate as much as the upward sweep ramp rate.
-
Autoclear Accumulator Active, drop the pin after the update:
Seems to work, you just cannot slow down downward sweeps.

-
Autoclear Accumulator Active, drop the pin before the update:
Downward sweeps just dont work at all.


-
no autoclear, drop pin before update:
You cannot do consecutive down sweeps - every down sweep must be preceeded by an up sweep


-
no autoclear, drop pin after update: A down sweep after an up sweep cannot cover a greater distance than the upward sweep


-
You can also generate a downward sweep by operating the AS9959 above the nyquist frequency. This method does work but causes discontinuity when switching which band the AD9959 is working in.
