S5k_module


In addition to the software interface described on this page, some S5k notebooks have been shared by the user community. They are available here and here. You are welcome to view them though they have not been fully verified by the developers.


class spirack.S5k_module(spi_rack, module)

SPI Rack interface code for the S5k module: a low-cost 8-16-channel AWG.

Parameters:

  • spi_rack (SPI_rack) - SPI_rack class object via which the communication runs
  • module (int) - module number set in hardware

Methods

set_waveform_mode(DAC, waveform)

Set the given DAC (output channel) to a selected waveform mode. Allowed values for the waveform are 'DC', 'sawtooth', 'noise' or 'AWG', as described in the module page.

Parameters:

  • DAC (int: 1-16) - DAC for which to change the mode
  • waveform (string) - waveform type to set

get_waveform_mode(DAC)

Returns the waveform mode set for the given DAC.

Parameters:

  • DAC (int: 1-16) - DAC for which to read the mode

set_DAC_scale(DAC, Vmax, Vmin)

Sets high and low voltage limits for the given DAC. The high limit given must be positive and the low limit given must be negative, and both must be in the ±2.875V range.

It may seem beneficial for the user to narrow the scale down to the requested output range in order to achieve better resolution. However, the function 'set_DAC_scale' represents the scale achieveable by the given hardware and not the scale of an arbitrary output waveform.

The S5k settings match by default to +2.875V or -2.875V, which is the scale of the default S5k hardware. The users are expected to use the 'set_DAC_scale' function rarely and only for S5k with a non-default build. Using this funtion incorrectly will result in wrong output levels.

Parameters:

  • DAC (int: 1-16) - DAC for which the limits are set
  • Vmax (float) - high limit of the output range in Volts
  • Vmin (float) - low limit of the output range in Volts

set_DC_value(DAC, value)

Sets the DC level for a given DAC. Caution - the function 'set_DAC_scale' must preceed this function or results would be erronous.

This function is primarily intended for DACs set to the 'DC' mode. It can also be used for DACs set to non-DC mode, but the DC level would only show when the DAC is not running its specified waveform. The level must be within the 'Vmax' to 'Vmin' limits.

The resolution of the DC level is the S5k range (determined as Vman - Vmin) divided by 4096. For example, at the specified range of ±2.875V the resolutuion is roughly 1.4mV. This means that the actual level set in the S5k may be slightly rounded from the value given by the user to align with the S5k resolution. The actual level can be received through the 'get_DC_value' function.

Parameters:

  • DAC (int: 1-16) - DAC for which the level is set
  • value (float) - the desired DC level in Volts

get_DC_value(DAC)

Returns the DC value for the given DAC. This is the actual value set in the S5k module, aligned with the S5k resolution, which may be slightly rounded from the value given by the user.

Parameters:

  • DAC (int: 1-16) - DAC for which the level is read
  • Returns - the DC level set for the DAC


set_sawtooth_parameters(DAC, sawtooth_type, stepsize)

Sets the sawtooth parameters for a given DAC. It can only be used on DACs set to 'sawtooth' mode.

The type can be either 'ramp_up', 'ramp_down', 'triangle', or 'no_wave'. The stepsize controls the sawtooth period. Nominally the number of steps for any sawtooth waveform is fixed at 16384 (or 2^14). However the duration of a step can be controlled. The fastest sawtooth would update steps at the full (highest) clock frequency. A slower sawtooth would update steps at a divided clock frequency. The division ratio is the stepsize parameter, taking values between 1 to 63.

Parameters:

  • DAC (int: 1-16) - DAC for which the settings are given
  • sawtooth_type (string) - type of sawtooth to output. Possible values: 'ramp_up', 'ramp_down', 'triangle', or 'no_wave'
  • stepsize (int: 1-63) - clock cycles per output level. In terms of the output sawtooth, this is the desired multiplier of the sawtooth duration relative to the baseline fastest sawtooth. By default each step lasts 5ns, derived from a 200MHz clock

upload_waveform(DAC, waveform, start_addr, set_pattern_length=True)

Uploads a user-defined waveform to the module memory and assigns it to a DAC.

Parameters:

  • DAC (int: 1-16) - DAC to which this waveform is associated
  • waveform (int array) - integer array containing values between -2048 and 2047
  • start_addr (int) - location of first address in the module memory to upload to. It is up to the user to avoid conflicts in memory use due to memory limitations and multiple DACs
  • set_pattern_length (bool) - a flag to automatically match the pattern length of the specified DAC to the uploaded waveform length. Under default settings the S5k has no start delays, meaning this optin ensures the waveform runs fully and there are no start or end delays. The pattern length is shared across groups of four consecutive DACs (outputs 1,2,3,4; outputs 5,6,7,8; etc), so selecting this action would affect all four DACs. See also the 'set_pattern_length_DAC' function

set_RAM_address(DAC, start_pos, stop_pos)

Sets the start address and stop address in the AWG memory for the selected DAC. This function is only relevant for DACs in AWG mode. When the DAC is running it will output data from this address range.

Parameters:

  • DAC (int: 1-16) - DAC for which the address is given
  • start_pos (int) - start address of waveform
  • start_pos (int) - stop address of waveform

set_pattern_length_DAC(DAC, length)

Sets the pattern length (a.k.a. pattern period) for a DAC in the 'waveform' mode.

In most practical cases the pattern length is chosen to include the waveform length alone. In less common cases the pattern length may be longer than the waveform length to include additional pre- or post-waveform delays but these options are not offered by default. If the pattern length is shorter than the waveform length the waveform would not be output in full. It is up to the user to set the appropriate pattern length. In all cases the pattern length is limited to 65535 (or 2^16 - 1).

The pattern length is shared across groups of four consecutive DACs (outputs 1,2,3,4; outputs 5,6,7,8; etc). An update to any DAC in the group would affect all four DACs.

Parameters:

  • DAC (int: 1-16) - DAC for which the limits are set
  • length (int: 0-20) - the desired filter setting

set_pattern_length_trigger(length, S5k_version = 1.0)

Sets the initial delay from trigger to output. This applies to all 16 outputs of the module.

Parameters:

  • S5k_version (int) - represents the version of the S5k module in use. Possible values: 1.0 or 1.1. The initial version used jumper-based addressing and had a 14-bit limit on the trigger length. The later version used slot-based addressing for SPI2.0 racks and had a higher limit of 16-bit limit on the trigger length.
  • length (float) - the trigger delay. It must be up to 4095 for S5k_version == 1.0 or up to 16383 for S5k_version == 1.1

set_clock_source(source)

Sets the clock source for the S5k to either an 'external' reference clock or an 'internal' 200MHz clock.

Parameters:

  • source (string) - Possible values: 'internal' or 'external'

sync_clock()

Synchs the different clocks used in the S5k. Necessary after any clock change


set_clock_division(DAC, divisor)

Sets a division of the clock to a lower frequency. Allowed dividers are 1 and any even number between 2 and 510. This setting is shared across groups of four consecutive DACs (outputs 1,2,3,4; outputs 5,6,7,8; etc).

Parameters:

  • DAC (int: 1-16) - DAC for which the clock division is set
  • divisor (int) - the divider of the clock frequency. Allowed dividers are 1 and any even number between 2 and 510

set_digital_gain(DAC, gain)

Sets a gain for the given DAC. This is applied arithmetically and implemented in the digital domain. During calculation the user-given value may be rounded down to align with the S5k resolution, typically up to 0.00006 (~60ppm) of gain rounding. The allowed digital gains are between -1.99 and 2.00. A value exceeding these will be clipped to the nearest limit.

Parameters:

  • DAC (int: 1-16) - DAC to which the gain is applied
  • gain (float) - a gain value between -1.99 and 2.0

set_digital_offset(DAC, offset)

Sets an offset for the given DAC. This is applied arithmetically and implemented in the digital domain. During calculation the user-given value may be rounded down to align with the S5k resolution, typically up to ~1.4mV of offset rounding. The allowed digital offsets are between -2.857V and 2.857V. A value exceeding these will be clipped to the nearest limit.

Parameters:

  • DAC (int: 1-16) - DAC to which the offset is applied
  • gain (float) - an offset value between -2.85 and 2.85

run_module(run)

Instructs all DAC outputs to produce the configured waveform and start outputting a trigger. This can also be done by an external trigger-in on the front of the module.

Parameters:

  • run (bool) - set the module to run according to True or False

get_S5k_run_status()

Returns the present status of the S5k, whether running or idle.

Parameters:

    Returns - the present status of the S5k (bool)


reset_DACs()

Clears the RAM of the AWG chip and resets registers to 0 for all DACs