Difference between revisions of "Arbitrary Waveform Generator"
(→Commands and Usage) |
|||
(19 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
− | + | For running simple parameter ramps on the MCE using internal commanding, see [[ Ramp Generator ]]. | |
− | + | * The Arbitrary Waveform Generator (AWG) permits users to configure a sequence of values which will be written at regular intervals to some MCE register. The AWG is an MCE firmware feature. | |
− | + | * A RAM block has been allocated in the Clock Card FPGA to store arbitrary waveform values. | |
+ | * Commands have been implemented to read to and write from the RAM (awg_data, awg_addr). | ||
+ | * A FSM has been implemented that can apply a set number of values (awg_sequence_length) from the RAM block to any internal register (ramp_card_addr, ramp_param_id, ramp_step_data_num) in the MCE at a certain rate (ramp_step_period). | ||
− | + | = Script-level support: mce_awg = | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | * | + | The script '''<tt>mce_awg</tt>''', in combination with <tt>[[mce_internal_ramp]]</tt>, may be used to control the AWG features of the MCE. |
− | wb cc ramp_step_period 10 | + | * mce_awg is used to load the AWG data into CC RAM, and to start and stop the AWG loop. |
− | wb cc ramp_param_id 153 //LED, for example | + | * mce_internal_ramp is used to set the timing parameters and the target register for the AWG loop. |
− | wb cc ramp_card_addr 2 //Clock Card, for example | + | |
− | wb cc ramp_step_data_num 1 | + | == Example == |
− | wb cc | + | |
+ | The following commands will load a triangle wave into a 400 sample buffer, and try to run it with 50 Hz updating (so an 1/8 Hz repeat frequency) on tes bias[0]: | ||
+ | |||
+ | mce_awg stop | ||
+ | mce_internal_ramp setup --target tes bias --count=1 --range 0 0 1 --step-frequency=50. | ||
+ | mce_awg setup --triangle 8000 100 --count 400 | ||
+ | mce_awg start | ||
+ | |||
+ | == Disabling the AWG loop == | ||
+ | |||
+ | To disable the AWG, run either of | ||
+ | mce_awg stop | ||
+ | mce_internal_ramp stop | ||
+ | |||
+ | == Setting timing parameters and target register == | ||
+ | |||
+ | The timing parameters and target register are set using mce_internal_ramp. See [[mce_internal_ramp]], or run <tt>mce_internal_ramp -h</tt> for more details. | ||
+ | mce_internal_ramp --stage=sa_bias --count=8 --offset 8 --step-frequency 100 --range 0 0 1 setup | ||
+ | |||
+ | Note that the <tt>--range</tt> option is a dummy parameter here, as it is our intention to run an AWG loop, not an internal ramp. | ||
+ | |||
+ | == Loading a waveform == | ||
+ | |||
+ | The waveform may be taken from an ascii file, read from stdin, or generated automatically. Examples: | ||
+ | |||
+ | From a file: | ||
+ | mce_awg setup --filename my_weird_wave.txt | ||
+ | |||
+ | From stdin: | ||
+ | cat my_weird_wave.txt | mce_awg setup --stdin | ||
+ | |||
+ | (For multi-column ascii data, from either a file or stdin, pass --column=<int> to specify the source column. In both cases, blank lines and lines beginning with a # are ignored.) | ||
+ | |||
+ | A sine wave with a period of 400 steps, amplitude 1000 and offset 20000 | ||
+ | mce_awg setup --sine 20000 1000 --count 400 | ||
+ | |||
+ | A triangle wave with a period of 8192 (max, default), from 1500 to 2500 and back again: | ||
+ | mce_awg setup --triangle 2000 500 | ||
+ | |||
+ | == Starting the AWG loop == | ||
+ | |||
+ | mce_awg start | ||
+ | |||
+ | |||
+ | = Targeting TES and heater biases with mod_val = | ||
+ | |||
+ | |||
+ | |||
+ | = Low-Level MCE Parameters for AWG = | ||
+ | |||
+ | If you are writing your own script, the following MCE parameters need to be set: | ||
+ | * {{param|cc|internal_cmd_mode}}, {{param|cc|awg_sequence_length}}, {{param|cc|awg_addr}}, {{param|cc|ramp_step_period}}, {{param|cc|ramp_param_id}}, {{param|cc|ramp_card_addr}}, {{param|cc|ramp_step_data_num}}, {{param|cc|ramp_step_phase}} (optional). | ||
+ | |||
+ | * Refer to [[MCE commands]] for details. | ||
+ | * Refer to [[MCE Timing Diagram#Timing_of_Internal_command|Timing of Internal Commands]]. | ||
+ | |||
+ | Example: | ||
+ | wb cc {{param|cc|ramp_step_period}} 10 | ||
+ | wb cc {{param|cc|ramp_param_id}} 153 //LED, for example | ||
+ | wb cc {{param|cc|ramp_card_addr}} 2 //Clock Card, for example | ||
+ | wb cc {{param|cc|ramp_step_data_num}} 1 | ||
+ | wb cc {{param|cc|awg_sequence_length}} 8192 //Currently the maximum size of the AWG RAM block | ||
− | wb cc awg_addr 0 //Set the AWG RAM address to zero before writing new values | + | wb cc {{param|cc|internal_cmd_mode}} 0 //Disable internal AWG commands BEFORE writing the data!!! |
− | wb cc awg_data 1 2 1 2 ... //Write AWG values | + | wb cc {{param|cc|awg_addr}} 0 //Set the AWG RAM address to zero before writing new values |
− | wb cc awg_data 1 2 1 2 ... //Write more AWG values, appended to the end of the first set of values | + | wb cc {{param|cc|awg_data}} 1 2 1 2 ... //Write AWG values |
+ | wb cc {{param|cc|awg_data}} 1 2 1 2 ... //Write more AWG values, appended to the end of the first set of values | ||
... | ... | ||
− | wb cc awg_data 1 2 1 2 ... //Write the last few AWG values, which must number as many as specified by | + | wb cc {{param|cc|awg_data}} 1 2 1 2 ... //Write the last few AWG values, which must number as many as specified by awg_sequence_length above |
− | + | ||
− | wb cc awg_addr 0 //Set the AWG RAM address to zero before reading values | + | wb cc {{param|cc|awg_addr}} 0 //Set the AWG RAM address to zero before reading values |
− | rb cc awg_data | + | rb cc {{param|cc|awg_data}} //Read AWG values |
− | rb cc awg_data | + | rb cc {{param|cc|awg_data}} |
... | ... | ||
− | rb cc awg_data | + | rb cc {{param|cc|awg_data}} |
+ | |||
+ | wb cc {{param|cc|awg_addr}} 0 //Set the AWG RAM address to zero before changing the internal command mode | ||
+ | wb cc {{param|cc|internal_cmd_mode}} 3 //Enable internal AWG commands AFTER writing the data!!! | ||
+ | |||
+ | wb cc {{param|cc|data_rate}} 10 | ||
+ | acq_config awg_test rcs | ||
+ | acq_go 1000 | ||
− | + | *Note 1: The awg_addr register and awg_data are readable when internal-commanding is turned off. | |
− | + | *Note 2: You need to set awg_addr to 0 to read the awg_data sequence in full. | |
− | |||
− | |||
− | |||
− | |||
− | + | [[Category:Clock Card Firmware]] | |
− | + | [[Category:MCE Script]] | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 12:41, 23 June 2017
For running simple parameter ramps on the MCE using internal commanding, see Ramp Generator .
- The Arbitrary Waveform Generator (AWG) permits users to configure a sequence of values which will be written at regular intervals to some MCE register. The AWG is an MCE firmware feature.
- A RAM block has been allocated in the Clock Card FPGA to store arbitrary waveform values.
- Commands have been implemented to read to and write from the RAM (awg_data, awg_addr).
- A FSM has been implemented that can apply a set number of values (awg_sequence_length) from the RAM block to any internal register (ramp_card_addr, ramp_param_id, ramp_step_data_num) in the MCE at a certain rate (ramp_step_period).
Contents
[hide]Script-level support: mce_awg
The script mce_awg, in combination with mce_internal_ramp, may be used to control the AWG features of the MCE.
- mce_awg is used to load the AWG data into CC RAM, and to start and stop the AWG loop.
- mce_internal_ramp is used to set the timing parameters and the target register for the AWG loop.
Example
The following commands will load a triangle wave into a 400 sample buffer, and try to run it with 50 Hz updating (so an 1/8 Hz repeat frequency) on tes bias[0]:
mce_awg stop mce_internal_ramp setup --target tes bias --count=1 --range 0 0 1 --step-frequency=50. mce_awg setup --triangle 8000 100 --count 400 mce_awg start
Disabling the AWG loop
To disable the AWG, run either of
mce_awg stop mce_internal_ramp stop
Setting timing parameters and target register
The timing parameters and target register are set using mce_internal_ramp. See mce_internal_ramp, or run mce_internal_ramp -h for more details.
mce_internal_ramp --stage=sa_bias --count=8 --offset 8 --step-frequency 100 --range 0 0 1 setup
Note that the --range option is a dummy parameter here, as it is our intention to run an AWG loop, not an internal ramp.
Loading a waveform
The waveform may be taken from an ascii file, read from stdin, or generated automatically. Examples:
From a file:
mce_awg setup --filename my_weird_wave.txt
From stdin:
cat my_weird_wave.txt | mce_awg setup --stdin
(For multi-column ascii data, from either a file or stdin, pass --column=<int> to specify the source column. In both cases, blank lines and lines beginning with a # are ignored.)
A sine wave with a period of 400 steps, amplitude 1000 and offset 20000
mce_awg setup --sine 20000 1000 --count 400
A triangle wave with a period of 8192 (max, default), from 1500 to 2500 and back again:
mce_awg setup --triangle 2000 500
Starting the AWG loop
mce_awg start
Targeting TES and heater biases with mod_val
Low-Level MCE Parameters for AWG
If you are writing your own script, the following MCE parameters need to be set:
- internal_cmd_mode, awg_sequence_length, awg_addr, ramp_step_period, ramp_param_id, ramp_card_addr, ramp_step_data_num, ramp_step_phase (optional).
- Refer to MCE commands for details.
- Refer to Timing of Internal Commands.
Example:
wb cc ramp_step_period 10 wb cc ramp_param_id 153 //LED, for example wb cc ramp_card_addr 2 //Clock Card, for example wb cc ramp_step_data_num 1 wb cc awg_sequence_length 8192 //Currently the maximum size of the AWG RAM block wb cc internal_cmd_mode 0 //Disable internal AWG commands BEFORE writing the data!!! wb cc awg_addr 0 //Set the AWG RAM address to zero before writing new values wb cc awg_data 1 2 1 2 ... //Write AWG values wb cc awg_data 1 2 1 2 ... //Write more AWG values, appended to the end of the first set of values ... wb cc awg_data 1 2 1 2 ... //Write the last few AWG values, which must number as many as specified by awg_sequence_length above wb cc awg_addr 0 //Set the AWG RAM address to zero before reading values rb cc awg_data //Read AWG values rb cc awg_data ... rb cc awg_data wb cc awg_addr 0 //Set the AWG RAM address to zero before changing the internal command mode wb cc internal_cmd_mode 3 //Enable internal AWG commands AFTER writing the data!!! wb cc data_rate 10 acq_config awg_test rcs acq_go 1000
- Note 1: The awg_addr register and awg_data are readable when internal-commanding is turned off.
- Note 2: You need to set awg_addr to 0 to read the awg_data sequence in full.