-
Notifications
You must be signed in to change notification settings - Fork 14
Home
The Valon 5007 board houses two synthesizers. The reference signal, reference select, and flash commands are shared between synthesizers. All other settings are independent, so a synthesizer must be specified when getting and setting values. Frequency values are specified in MegaHertz (MHz) unless otherwise noted.
The python code works with the standard distutils/setuptools installer. To install the library, download the code and extract it.
$ cd path/to/code
$ python setup.py build
$ python setup.py install --prefix=path/to/install
Included with the C++ code is a simple makefile that produces staticly-linked (.a) and dynamicly-linked (.so) libraries. Installing these to the proper directory must be done manually.
$ cd path/to/code
$ make
$ cp ValonSynth.a path/to/install
$ cp ValonSynth.so path/to/install
Text in square brackets [ ], unless otherwise noted, denote a C++ version of the function which fills a value or structure rather than returning a new object. All C++ functions which use this convention return a boolean (true/false) indicating success or failure of the function’s task.
Reads the current settings from the synthesizer and returns the frequency in MHz.
- synthesizer (unsigned char) – Specifies which synthesizer this command affects. Values are aliased for convenience: SYNTH_A and SYNTH_B (Python) or ValonSynth::A and ValonSynth::B (C++)
Sets the synthesizer to the desired frequency, or closest possible frequency (depending on the channel spacing).
- synthesizer (unsigned char) – Specifies which synthesizer this command affects. Values are aliased for convenience: SYNTH_A and SYNTH_B (Python) or ValonSynth::A and ValonSynth::B (C++).
- frequency (float) – Specifies the desired output frequency of the synthesizer. Range is determined by the minimum and maximum VCO frequency. See Calculations section for more details.
- channel_spacing (float) [optional] – Specifies the “resolution” of the synthesizer. See Calculations section for more details.
Reads the current settings from the synthesizer and returns the reference frequency in Hertz (Hz). This setting is shared between synthesizers.
None.
Sets the synthesizer reference register to the desired frequency in Hertz (Hz). This does not appear to change the actual reference frequency of the synthesizer for either internal or external reference modes (?).
- frequency (float) – Specifies the desired reference frequency in Hz.
Reads the current settings from the synthesizer and returns the options fields. The Python version returns the following fields as a tuple. The C++ version returns a structure which contains the following fields.
- double_ref – Doubles the input reference frequency.
- half_ref – Halves the input reference frequency.
- r – Divides the input reference frequency by an integer.
- low_spur – Sets the synthesizer to operate in either “low noise” or “low spur” mode. Note that the reference frequency options are applied to a single synthesizer, even though the base reference frequency input is shared.
- synthesizer (unsigned char) – Specifies which synthesizer this command affects. Values are aliased for convenience: SYNTH_A and SYNTH_B (Python) or ValonSynth::A and ValonSynth::B (C++).
Sets the desired options on the selected synthesizer. This is the Python version of set_options.
All arguments are optional, and may be specified either positionally or by keyword.
- double_ref (bool) – Doubles the input reference frequency.
- half_ref (bool) – Halves the input reference frequency.
- r (int) – Divides the input reference frequency by an integer.
- low_spur (bool) – Sets the synthesizer to operate in either “low noise” or “low spur” mode.
This is the C++ version of set_options.
- opts (struct options) – Structure containing double_ref, half_ref, r, and low_spur described in the Python version of set_options.
Reads the current settings from the synthesizer and returns the state of the internal/external reference select.
None.
Sets the synthesizer reference select to use either the internal reference source or an external reference source.
- e_not_i (bool) – If true, uses an external reference source; if false, uses the internal reference source.
Reads the current synthesizer settings and returns the VCO range settings. The Python version returns a tuple of the form (minimum, maximum). The C++ version fills a structure containing min and max fields.
- synthesizer (unsigned char) – Specifies which synthesizer this command affects. Values are aliased for convenience: SYNTH_A and SYNTH_B (Python) or ValonSynth::A and ValonSynth::B (C++).
Sets the min and max allowable VCO frequencies. These values are used to calculate the allowable frequency range for the output frequency, see Calculations for details. This is the Python version of set_vco_range.
- min (short) – The minimum allowable VCO frequency.
- max (short) – The maximum allowable VCO frequency.
Sets the minimum and maximum allowable VCO frequencies. This is the C++ version of set_vco_range.
- vcor (struct vco_range) – Contains the min and max fields, respectively, as described above in the Python version of set_vco_range.
Returns a bool indicating whether the specified synthesizer is phase-locked to the input reference.
- synthesizer (unsigned char) – Specifies which synthesizer this command affects. Values are aliased for convenience: SYNTH_A and SYNTH_B (Python) or ValonSynth::A and ValonSynth::B (C++).
Retrieves the current label for the specified synthesizer. The C++ version requires that the input pointer be valid and point to currently allocated memory of the correct size.
- synthesizer (unsigned char) – Specifies which synthesizer this command affects. Values are aliased for convenience: SYNTH_A and SYNTH_B (Python) or ValonSynth::A and ValonSynth::B (C++).
Sets the label for the selected synthesizer.
- synthesizer (unsigned char) – Specifies which synthesizer this command affects. Values are aliased for convenience: SYNTH_A and SYNTH_B (Python) or ValonSynth::A and ValonSynth::B (C++).
- label (char*) - The new synthesizer label.
Flashes all current settings for both synthesizers into non-volatile memory.
None.
#Calculations In order to set the output frequency of the synthesizer, several calculations are done using the settings of the synthesizer. EPDF stands for Effective Phase Detector Frequency, which is the reference frequency after applying the relevant options (double_ref, half_ref, r).
[ 1 \leq dbf = 2^n \leq 16 ]
[ vco = frequency \times dbf ]
[ ncount = \lfloor {{vco} \over {EPDF}} \rfloor ]
[ frac = \lfloor {{vco - ncount \times EPDF} \over {channel_spacing}} \rfloor ]
[ mod = \lfloor {{EPDF} \over {channel_spacing}} + 0.5 \rfloor ]
frac and mod are a ratio, and can be reduced to the simplest fraction after the calculations above. To compute the output frequency, use the following equation.
[ frequency = (ncount + {{frac} \over {mod}}) \times {{EPDF} \over {dbf}} ]