QTC-UMD / dds-sweeper

Raspberry Pi Pico interface for the AD9959 DDS
BSD 2-Clause "Simplified" License
5 stars 2 forks source link

dds-sweeper

Raspberry Pi Pico interface for the AD9959 DDS.

If you use this project, please cite as:

E. Huegler, J. C. Hill, and D. H. Meyer, An agile radio-frequency source using internal sweeps of a direct digital synthesizer, Review of Scientific Instruments, 94, 094705 (2023) https://doi.org/10.1063/5.0163342

Specs

Table Mode 1 Channel 2 Channel 3 Channel 4 Channel
Single Stepping 500 750 1000 1250
Sweep Mode 1000 1500 2000 2500
Table Mode 1 Channel 2 Channel 3 Channel 4 Channel
Single Stepping 4 $\mu s$ 6 $\mu s$ 8 $\mu s$ 10 $\mu s$
Sweep Mode 8 $\mu s$ 12 $\mu s$ 16 $\mu s$ 20 $\mu s$
Table Mode 1 Channel 2 Channel 3 Channel 4 Channel
Single Stepping 5000 5000 5000 4032
Sweep Mode 5000 3895 2611 1964
Single Stepping (Ext Timer) 16656 8615 5810 4383
Sweep Mode (Ext Timer) 8327 4234 2838 2135

How to flash the firmware

Download the latest dds-sweeper.uf2 file. On your Raspberry Pi Pico, hold down the "bootsel" button while plugging the Pico into USB port on a PC (that must already be turned on). The Pico should mount as a mass storage device (if it doesn't, try again or consult the Pico documentation). Drag and drop the .uf2 file into the mounted mass storage device. The mass storage device should unmount after the copy completes. Your Pico is now running the DDS Sweeper firmware!

Notes

Sweeps

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 $\frac{1}{125 MHz} = 8 ns$ to $\frac{255}{125 MHz} = 2.04 \mu s$. Downward sweeps will apply the sweep delta every $\frac{1}{125 MHz} = 8 ns$.
Given the frequency resolution of $\frac{f_{sys clk}}{2^{32}}$, the smallest sweep delta is $= \frac{1}{2^{32}} = 0.1164$ Hz. With the maximum ramp rates, the DDS-sweeper has a minimum sweeping rate of $\approx 47871$ Hz/sec when sweeping upwards or $\approx 12207031.25$ Hz/sec when sweeping downward.

Downward Sweeps:

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 belive 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.

Serial API

Note: Commands must be terminated with \n.

Compiling the firmware

If you want to make changes to the firmware, or want to compile it yourself (because you don't trust binary blobs from the internet), we provide a docker configuration to help you do that.

  1. Install docker desktop and make sure it is running (if you are on Windows, you may have to mess around a bit to get virtualisation working at an operating system level)
  2. Clone this repository
  3. Open a terminal with the current working directory set to the repository root (the `docker-compose.yaml`` file should be there)
  4. Run docker compose build --pull to build the docker container
  5. Run docker compose up to build the PrawnBlaster firmware.

Step 4 will take a while as it has to build the docker container. If it is slow to download packages from the Ubuntu package repositories, consider providing an explicit apt mirror that is fast for you: docker compose build --pull --build-arg APT_MIRROR="http://azure.archive.ubuntu.com/ubuntu/".

If you want to change which version of the pico SDK it builds against, this is set in the build/docker/Dockerfile file. Just change the git tag of the pico SDK that gets cloned out by git, then rebuild the docker container (see step 4).

Note once the docker container is built, you can run step 5 as many times as you like. You do not need to rebuild the container, even if you make changes to the PrawnBlaster source code. You only need to rebuild the docker container if you modify the build/docker/Dockerfile file.