-
Notifications
You must be signed in to change notification settings - Fork 69
AD9959 DDS Sweeper #126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
carterturn
wants to merge
44
commits into
labscript-suite:master
Choose a base branch
from
carterturn:carterturn-dds-sweeper
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
AD9959 DDS Sweeper #126
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
a658582
Initial draft of DDS sweeper
carterturn 9e946f7
updating worker functions to match current firmware
Json-To-String 1a42e34
Merge branch 'labscript-suite:master' into carterturn-dds-sweeper
carterturn 2ffb2ba
added logic for max instructions per channel, getting pico board, and…
Json-To-String 24e00ae
change assert_OK() calls in __init__ to match current firmware
Json-To-String 4048745
Some initial docs additions
Json-To-String b02ec9b
Indenting python block properly
Json-To-String 71e107b
fix uf2 link rendering and renamed runviewer parser to plural
Json-To-String 03352fd
adding support for simultaneous dynamic and static instructions
Json-To-String 5630a47
Add check that device is ready for the number of bytes we will send i…
carterturn 4387a42
Add overview and specifications for docs.
carterturn 0595dd4
Add option for external reference clock
carterturn 68c25c5
Expand docstring for labscript device
carterturn 9469d0b
removing internal timing, added a parentheses to table size check
Json-To-String 7b20811
pluralism
Json-To-String 1f6bc6b
Some documentation and docstring updates
carterturn fb5acda
min version and status map update
Json-To-String a8adf76
no s in readline
Json-To-String 43b4821
Add Pico2 instruction counts to docs.
carterturn aed9873
saving progress, all static ins works, final value update works, stil…
Json-To-String eebf6f6
Graceful aborts and docstring updates
Json-To-String 995a0f4
status string format specifier fix
Json-To-String b821fea
transition_to_buffered supports smart cache, borrowing logic from Pra…
Json-To-String 0c02e78
adding clock_limit class attribute
Json-To-String c2ec2b9
limit calculation uses dynamic channels, not all, and ref clk freq be…
Json-To-String 146157a
removed unnecessary if statement checks for both dyn and stat DDSs
Json-To-String d3671af
More docstrings
carterturn 46bcc9f
Default connection table example
Json-To-String 4580b06
Cleaned up extra imports in the examples
Json-To-String f1985c5
smart cache logic cleanup, removed inaccurate debug msg, moved explic…
Json-To-String d7b0dfc
Conversion to DDS units is done on Pi Pico for set_output.
carterturn 5377b59
Placeholder values for scale factor when only static channels are used.
carterturn b0797fe
Don't need to do unit conversions for set output
carterturn adfa697
Remove stray? factor of 10 from tuning_words_to_SI dictionary.
carterturn 3f55bde
removing explicit break, is the same as returning self.final_values
Json-To-String fe811ef
program manual will invalidate static cache
Json-To-String e0fe6ee
Add dynamic channels to constructor, and add checks in add_device to …
carterturn 273c42d
calculate max freq
Json-To-String 10911d6
program manual should only invalidate static cache
Json-To-String 0fe0504
update examples with dynamic_channels parameter
Json-To-String 9f37751
Compute scale factors separately from quantising data.
carterturn 9854b3c
Cache scale factor calculations and fully separate for quantization f…
dihm 34436d5
Move `generate_code` break if no channels are connected earlier in th…
dihm b3aee0a
Tidy up some lints
dihm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
AD9959DDSSweeper | ||
================ | ||
|
||
This labscript device controls the `DDSSweeper <https://github.com/qtc-umd/dds-sweeper>`_, an interface to the `AD9959 eval board <https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/eval-ad9959.html>`_ four channel direct digital synthesizer (DDS) using the `Raspberry Pi Pico <https://www.raspberrypi.org/documentation/rp2040/getting-started/>`_ platform. | ||
|
||
The DDS Sweeper is described in more detail in 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 . | ||
|
||
Specifications | ||
~~~~~~~~~~~~~~ | ||
|
||
The AD9959 evaluation board provides the following: | ||
|
||
* 4 DDS channels | ||
|
||
- 100 kHz - 250 MHz output frequency with 32 bit frequency resolution (~0.1 Hz) | ||
- Up to 0 dBm output power with 10 bit amplitude resolution | ||
- Phase control with 16 bit resolution (~48 uRad) | ||
|
||
The Pico interface allows the evaluation board parameters to be reprogrammed during a sequence. | ||
At this time, stepping of frequency, amplitude, and phase parameters is supported. | ||
Parameter ramping is possible, but not currently supported by the labscript device (if support for this is of interest, please `open an issue <https://github.com/labscript-suite/labscript-devices/issues>`). | ||
The Pico interface provides the following: | ||
|
||
* For the Pico 1: 16,656 instructions distributed evenly among the configured channels; 16,656, 8,615, 5,810, and 4,383 for 1, 2, 3, 4 channels respectively. | ||
* For the Pico 2: 34,132 instructions distributed evenly among the configured channels; 34,132, 17,654, 11,905, and 8,981 for 1, 2, 3, 4 channels respectively. | ||
* External timing via a pseudoclock clockline. | ||
* By default, the AD9959 system reference clock is taken from the Pi Pico. If a higher quality clock is needed, the user can provide an external system reference clock to the AD9959. For more details on clocking, see the Usage section. | ||
|
||
Installation | ||
~~~~~~~~~~~~ | ||
|
||
- **For Pi Pico (RP2040)**: | ||
`dds-sweeper_rp2040.uf2 <https://github.com/QTC-UMD/dds-sweeper/releases/latest/download/dds-sweeper_rp2040.uf2>`_ | ||
|
||
- **For Pi Pico 2 (RP2350)**: | ||
`dds-sweeper_rp2350.uf2 <https://github.com/QTC-UMD/dds-sweeper/releases/latest/download/dds-sweeper_rp2350.uf2>`_ | ||
|
||
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! | ||
|
||
Note that this device communicates using a virtual COM port. | ||
The number is assigned by the controlling computer and will need to be determined in order for BLACS to connect to the PrawnDO. | ||
|
||
|
||
Usage | ||
~~~~~ | ||
|
||
An example connection table with the default settings of the sweeper: | ||
|
||
.. code-block:: python | ||
|
||
from labscript import start, stop, DDS, StaticDDS | ||
from labscript_devices.PrawnBlaster.labscript_devices import PrawnBlaster | ||
from labscript_devices.AD9959DDSSweeper.labscript_devices import AD9959DDSSweeper | ||
|
||
# prawnblaster for external timing | ||
prawn = PrawnBlaster( | ||
name='prawn', | ||
com_port='COM7', | ||
num_pseudoclocks=1 | ||
) | ||
|
||
AD9959 = AD9959DDSSweeper( | ||
name='AD9959', | ||
parent_device=prawn.clocklines[0], | ||
com_port='COM11', | ||
dynamic_channels=2 | ||
) | ||
|
||
|
||
chann0 = DDS( 'chann0', AD9959, 'channel 0') | ||
chann1 = DDS( 'chann1', AD9959, 'channel 1') | ||
chann2 = StaticDDS( 'chann2', AD9959, 'channel 2') | ||
chann3 = StaticDDS( 'chann3', AD9959, 'channel 3') | ||
|
||
|
||
start() | ||
|
||
stop(1) | ||
|
||
An example connection table that uses the PrawnBlaster and sweeper with three | ||
dynamic channels, an external, 100 MHz clock and pll multiplier of 5: | ||
|
||
.. code-block:: python | ||
|
||
from labscript import start, stop, DDS, StaticDDS | ||
from labscript_devices.PrawnBlaster.labscript_devices import PrawnBlaster | ||
from labscript_devices.AD9959DDSSweeper.labscript_devices import AD9959DDSSweeper | ||
|
||
# prawnblaster for external timing | ||
prawn = PrawnBlaster( | ||
name='prawn', | ||
com_port='COM7', | ||
num_pseudoclocks=1 | ||
) | ||
|
||
AD9959 = AD9959DDSSweeper( | ||
name='AD9959', | ||
parent_device=prawn.clocklines[0], | ||
com_port='COM11', | ||
dynamic_channels=3, | ||
pico_board='pico2', | ||
ref_clock_external=1, | ||
ref_clock_frequency=100e6, | ||
pll_mult=5 | ||
) | ||
|
||
|
||
chann0 = DDS( 'chann0', AD9959, 'channel 0') | ||
chann1 = DDS( 'chann1', AD9959, 'channel 1') | ||
chann2 = DDS( 'chann2', AD9959, 'channel 2') | ||
chann3 = StaticDDS( 'chann3', AD9959, 'channel 3') | ||
|
||
|
||
start() | ||
|
||
stop(1) | ||
|
||
.. note:: | ||
|
||
**Clocking** | ||
|
||
If the Pi Pico is used as the AD9959 system reference clock, pin 21 of the Pi Pico should be connected to the REF CLK input (J9) of the AD9959 eval board. Otherwise, another clock source should be connected to REF CLK input and its frequency provided as the ref_clock_frequency. | ||
|
||
Detailed Documentation | ||
~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. automodule:: labscript_devices.AD9959DDSSweeper | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
:private-members: | ||
|
||
.. automodule:: labscript_devices.AD9959DDSSweeper.labscript_devices | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
:private-members: | ||
|
||
.. automodule:: labscript_devices.AD9959DDSSweeper.blacs_tabs | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
:private-members: | ||
|
||
.. automodule:: labscript_devices.AD9959DDSSweeper.blacs_workers | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
:private-members: | ||
|
||
.. automodule:: labscript_devices.AD9959DDSSweeper.runviewer_parsers | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
:private-members: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
##################################################################### | ||
# # | ||
# /labscript_devices/AD9959DDSSweeper/blacs_tabs.py # | ||
# # | ||
# Copyright 2025, Carter Turnbaugh # | ||
# # | ||
# This file is part of the module labscript_devices, in the # | ||
# labscript suite (see http://labscriptsuite.org), and is # | ||
# licensed under the Simplified BSD License. See the license.txt # | ||
# file in the root of the project for the full license. # | ||
# # | ||
##################################################################### |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
##################################################################### | ||
# # | ||
# /labscript_devices/AD9959DDSSweeper/blacs_tabs.py # | ||
# # | ||
# Copyright 2025, Carter Turnbaugh # | ||
# # | ||
# This file is part of the module labscript_devices, in the # | ||
# labscript suite (see http://labscriptsuite.org), and is # | ||
# licensed under the Simplified BSD License. See the license.txt # | ||
# file in the root of the project for the full license. # | ||
# # | ||
##################################################################### | ||
|
||
from blacs.device_base_class import DeviceTab | ||
|
||
|
||
class AD9959DDSSweeperTab(DeviceTab): | ||
def initialise_GUI(self): | ||
device = self.settings['connection_table'].find_by_name(self.device_name) | ||
|
||
ref_clk_freq = device.properties['ref_clock_frequency'] | ||
pll_mult = device.properties['pll_mult'] | ||
self.com_port = device.properties['com_port'] | ||
|
||
max_freq = 0.5 * (ref_clk_freq * pll_mult) | ||
# Capabilities | ||
self.base_units = {'freq':'Hz', 'amp':'Arb', 'phase':'Degrees'} | ||
self.base_min = {'freq':0.0, 'amp':0, 'phase':0} | ||
self.base_max = {'freq':max_freq, 'amp':1, 'phase':360} | ||
self.base_step = {'freq':10**6, 'amp':1/1023., 'phase':1} | ||
self.base_decimals = {'freq':1, 'amp':4, 'phase':3} | ||
self.num_DDS = 4 | ||
|
||
dds_prop = {} | ||
for i in range(self.num_DDS): | ||
dds_prop['channel %d' % i] = {} | ||
for subchnl in ['freq', 'amp', 'phase']: | ||
dds_prop['channel %d' % i][subchnl] = {'base_unit':self.base_units[subchnl], | ||
'min':self.base_min[subchnl], | ||
'max':self.base_max[subchnl], | ||
'step':self.base_step[subchnl], | ||
'decimals':self.base_decimals[subchnl] | ||
} | ||
|
||
self.create_dds_outputs(dds_prop) | ||
dds_widgets, _, _ = self.auto_create_widgets() | ||
self.auto_place_widgets(('DDS Outputs', dds_widgets)) | ||
|
||
self.supports_remote_value_check(False) | ||
self.supports_smart_programming(True) | ||
|
||
def initialise_workers(self): | ||
self.create_worker( | ||
"main_worker", | ||
"labscript_devices.AD9959DDSSweeper.blacs_workers.AD9959DDSSweeperWorker", | ||
{ | ||
'com_port': self.com_port, | ||
}, | ||
) | ||
self.primary_worker = "main_worker" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.