Skip to content
A set of scripts for the ARTIQ suservo device.
Python Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
__pycache__
compiled
data
old
scope
.gdb_history
README.md
amp.sh
backup.py
dataset_db.pyon
device_db.py
devices.txt
flash_storage.img
flashstorage.img
graph-output.py
ip.sh
notes.txt
original.py
output.txt
output_backup.txt
power-spectral-density.py
presentation.txt
run
scan.sh
suservo2.py

README.md

ARTIQ SUSERVO

This repository contains a set of scripts for the ARTIQ suservo module.

After activating the conda environment, the script can be run using

(artiq-main) bash@bash:~$ artiq_run suservo2.py
>>

or with the shortcut bash file

(artiq-main) bash@bash:~$ ./run.sh
>>

Possible commands can be viewed using the help command.

>> help
on/off: turns channel 0 on or off
freq {val}: sets the channel 0 frequency in MHz
att {val}: sets the channel 0 attenuation
help, clear, exit

To start the suservo module, use the init command.

>> init
ftw1: 0x35c2 = 13762
b1: 0x199 = 409
pow: 0x0 = 0
cfg: 0x7 = 7
offset: -0x10000 = -65536
a1: 0x800 = 2048
ftw0: -0x170a4 = -94372
b0: -0x19a = -410
>>

The script contains several convenience methods for tuning various suservo parameters. These include off (stops iir and output), on (restores iir and output), freq {value in MHz} (sets the dds frequency), att {value in dbm} (sets the dds attenuation), and gain {value 0-3} (sets the input gain). Note that running init will reset all these values to the defaults set in the code.

The example below first initializes the module. Output is then turned off, the dds attenuation is set to 10, the gain is set to 1, the frequency is set to 220 MHz, and then output is turned back on.

>> init
>> off
>> att 10
>> gain 1
>> freq 220
>> on
>>

A note on the gain command. As commented in the ARTIQ suservo code, the four gain settings (0, 1, 2, 3) correspond to gains of (1, 10, 100, 1000) respectively.

The script also contains several methods for reading data. The first is the watch command, which will continuously print the ADC voltage and integrator values. To stop reading, use CTRL-C.

>> watch
Input Voltage:   4.981079 [#########           ], Integrator:   0.732231 [##############      ]
>>

Another option is the read command, which reads the input voltage and integrator value once. In the example below, these values are read. As expected, after adding attenuation, the integrator value is higher to compensate and keep the input voltage the same.

>> read
Input Voltage:   5.005798 [##########          ], Integrator:   0.469810 [#########           ]
>> att 5
>> read
Input Voltage:   5.025940 [##########          ], Integrator:   0.840363 [################    ]
>>

Status command???

The script also includes the tune command for automatically optimizing the iir parameters. This command does several things in sequence. First, it reads from the ADC and estimates the gain value. Next it searches for the optimal ki parameter (integrator gain) by taking 100 input samples, splitting the list in two by the values that are higher and lower than the average, averaging the elements in high and low lists, subtracting these values, and repeating this for different values for ki. Running this should take a minute or so.

>> tune
Average ADC value is: 0.76812744140625
Setting gain to 1
Average ADC value is now: 0.53399658203125
Testing integrator gain value 1/8: [################### ]
0.0010382570997148344
Testing integrator gain value 2/8: [################### ]
0.0015478515625000355
Testing integrator gain value 3/8: [################### ]
0.0012301420554136078
Testing integrator gain value 4/8: [################### ]
0.0011750496144072309
Testing integrator gain value 5/8: [################### ]
0.001109734559670561
Testing integrator gain value 6/8: [################### ]
0.0018041266920287846
Testing integrator gain value 7/8: [################### ]
0.0011460230900691148
Testing integrator gain value 8/8: [################### ]
0.002077918569771686
>>

Graph command??? Test command??? Misc commands??? Dependicies

You can’t perform that action at this time.