IO

Link to IOs and pin mapping for Red Pitaya 125-14 devices.

Base IO

class openlabctrl.io.base.BaseIo(addr, clk_freq)[source]
reset()[source]

Reset IO instruction cache and time base.

get_time()[source]

Retrieve current IO time (in units of CLK cycles).

Return type:

int

set_time(val)[source]

Set new IO time (should be larger or equal than current IO time).

Parameters:

val (int) – time (in units of clk cycles).

set_time_increment(val)[source]

Set IO instruction time increment, i.e. time between consecutive IO instructions. Default time increment after reset is 1 clk cycle.

Parameters:

val (int) – time increment (in units of clk cycles).

get_time_increment()[source]

Retrieve current IO time increment (in units of clk cycles).

Return type:

int

delay(val)[source]

Increment current IO time by a specified delay time. Used to retard following IO instruction.

Parameters:

val (int) – Delay time (in units of clk cycles).

Digital

class openlabctrl.io.digital.DigitalIo(addr, clk_freq)[source]

Bases: BaseIo

Driver class for Digital IOs.

Note

Ports configured as inputs (high-impedance via tristate()) include internal pull-up resistors and will idle high when left undriven.

output(val, mask=0b1111)[source]

Set output value of masked ports (requires ports to be defined as outputs via DigitalIo.tristate()). E.g. val=0b0010 and mask=0b1010 will result in port[0] -> unchanged, port[1] -> 1, port[2] -> unchanged and port[3] -> 0.

Parameters:
  • val (int) – Output value.

  • mask (int) – Bit mask for updating digital ports.

tristate(val, mask=0b1111)[source]

Set direction (output/tristate) of masked ports. A 0 bit configures the corresponding port as a driven output; a 1 bit puts it in high-impedance (input) mode. E.g. val=0b0010 and mask=0b1010 will result in port[0] -> unchanged, port[1] -> high-Z (input), port[2] -> unchanged and port[3] -> driven (output).

Parameters:
  • val (int) – Direction value (0 = driven output, 1 = high-impedance / input).

  • mask (int) – Bit mask for updating digital ports.

delay()

See BaseIo.delay().

get_time()

See BaseIo.get_time().

get_time_increment()

See BaseIo.get_time_increment().

reset()

See BaseIo.reset().

set_time()

See BaseIo.set_time().

set_time_increment()

See BaseIo.set_time_increment().

Analog

class openlabctrl.io.analog.AnalogOut(addr, clk_freq)[source]

Bases: BaseIo

Driver class for low speed analog IOs (PWM + Low Pass Filter).

duty_cycle(val)[source]

Define scale of underlying Sigma-Delta Modulator.

Parameters:

val (float) – Relative scale in range [0.0, 1.0].

delay()

See BaseIo.delay().

get_time()

See BaseIo.get_time().

get_time_increment()

See BaseIo.get_time_increment().

reset()

See BaseIo.reset().

set_time()

See BaseIo.set_time().

set_time_increment()

See BaseIo.set_time_increment().

RF

class openlabctrl.io.rf.RfBase(addr, clk_freq)[source]

Bases: BaseIo

Base driver class for RF IOs (DDS-based signal generation).

Wraps a direct digital synthesizer (DDS) core and provides control over frequency, phase, and amplitude. The update flag on each method controls whether the new value is applied immediately (True) or staged for a later atomic update (False), which allows frequency, phase, and amplitude to be changed simultaneously.

frequency(val, update=True)[source]

Set the output frequency.

The valid range is [-clk_freq/2, clk_freq/2] (i.e. ±62.5 MHz for a 125 MHz clock).

Parameters:
  • val (float) – Frequency in Hz.

  • update (bool) – If True, apply the new value immediately. Set to False to stage the change and apply it atomically together with other staged parameters.

phase(val, update=True)[source]

Set the output phase.

Parameters:
  • val (float) – Phase in degrees.

  • update (bool) – If True, apply the new value immediately. Set to False to stage the change and apply it later with other staged parameters.

amplitude(val, update=True)[source]

Set the output amplitude.

Parameters:
  • val (float) – Relative amplitude in range [-1, 1].

  • update (bool) – If True, apply the new value immediately. Set to False to stage the change and apply it later with other staged parameters.

phase_reset(update=True)[source]

Reset the DDS phase accumulator to zero.

Parameters:

update (bool) – If True, apply immediately. Set to False to stage the reset and apply it later with other staged parameters.

delay()

See BaseIo.delay().

get_time()

See BaseIo.get_time().

get_time_increment()

See BaseIo.get_time_increment().

reset()

See BaseIo.reset().

set_time()

See BaseIo.set_time().

set_time_increment()

See BaseIo.set_time_increment().

class openlabctrl.io.rf.RfOut(addr, clk_freq)[source]

Bases: RfBase

Driver class for RF output channels.

amplitude()

See RfBase.amplitude().

delay()

See BaseIo.delay().

frequency()

See RfBase.frequency().

get_time()

See BaseIo.get_time().

get_time_increment()

See BaseIo.get_time_increment().

phase()

See RfBase.phase().

phase_reset()

See RfBase.phase_reset().

reset()

See BaseIo.reset().

set_time()

See BaseIo.set_time().

set_time_increment()

See BaseIo.set_time_increment().

Scope (Digital, Analog, RF acquisition)

class openlabctrl.io.scope.ScopeSource(value)[source]
RF_IN_0 = 0
RF_IN_1 = 1
RF_OUT_0 = 2
RF_OUT_1 = 3
DIGITAL_IO_0 = 4
DIGITAL_IO_1 = 5
DIGITAL_IO_2 = 6
DIGITAL_IO_3 = 7
ANALOG_OUT_0 = 8
ANALOG_OUT_1 = 9
ANALOG_OUT_2 = 10
ANALOG_OUT_3 = 11
ANALOG_IN_0 = 14
ANALOG_IN_1 = 12
ANALOG_IN_2 = 13
ANALOG_IN_3 = 15
class openlabctrl.io.scope.Scope(addr, clk_freq)[source]

Bases: BaseIo

Driver class for signal acquisition (digital oscilloscope).

Before calling acquire(), both source() and decimation() must be set within the same frame. Each acquire() call is registered under a label and can be retrieved after the frame is executed.

reset()[source]

See BaseIo.reset().

source(src)[source]

Set the acquisition source.

Must be called before acquire() within the same frame.

Parameters:

src (ScopeSource) – Signal source to capture. Must be a ScopeSource member.

decimation(dec=1)[source]

Set the decimation factor.

The effective sample rate is clk_freq / dec. A value of 1 captures every clock cycle (no decimation).

Parameters:

dec (int) – Decimation factor in the range [1, 2**32 - 1].

acquire(samples, label=None, run_async=False)[source]

Schedule an acquisition from the current source.

source() and decimation() must have been called earlier in the same frame. Acquired data is stored under label and can be retrieved after the frame executes.

Parameters:
  • samples (int) – Number of samples to acquire, in the range [1, 2**32 - 1].

  • label (str | None) – Key used to retrieve the acquisition data. Auto-generated as acq_0, acq_1, … if not provided.

  • run_async (bool) – If False (default), the frame waits for all samples before continuing. If True, the frame proceeds immediately after issuing the acquisition command (non-blocking).

delay()

See BaseIo.delay().

get_time()

See BaseIo.get_time().

get_time_increment()

See BaseIo.get_time_increment().

set_time()

See BaseIo.set_time().

set_time_increment()

See BaseIo.set_time_increment().

LED

class openlabctrl.io.led.Led(addr, clk_freq)[source]

Bases: BaseIo

Driver class for the onboard LEDs.

output(val, mask=0xffff)[source]

Set the on/off state of masked LEDs. E.g. val=0b0010 and mask=0b1010 will result in LED[0] -> unchanged, LED[1] -> on, LED[2] -> unchanged and LED[3] -> off.

Parameters:
  • val (int) – LED state value (1 = on, 0 = off).

  • mask (int) – Bit mask for selecting which LEDs to update.

delay()

See BaseIo.delay().

get_time()

See BaseIo.get_time().

get_time_increment()

See BaseIo.get_time_increment().

reset()

See BaseIo.reset().

set_time()

See BaseIo.set_time().

set_time_increment()

See BaseIo.set_time_increment().