![]() |
SA API
|
Now that we have seen how a typical application interfaces with the API, let’s examine the different modes of operation the API provides. Each mode will accept different configurations and have different boundary conditions. Each mode will also provide data formatted to match the mode selected. In the next sections you will see how to interact with each mode.
For a more in-depth examination of each mode of operation (read: theory) refer to the Spike User Manual.
Please also see the C++ programming examples for an example of interfacing the device for each measurement type.
Swept analysis represents the most traditional form of spectrum analysis. This mode offers the largest amount of configuration options, and returns traditional frequency domain sweeps. A frequency domain sweep displays amplitude on the vertical axis and frequency on the horizontal axis.
For a list of all examples, please see the examples/ folder in the SDK.
The configuration routines which affect the sweep results are:
Once you have configured the device, call saInitiate using the SA_SWEEPING flag.
This mode is driven by the programmer, causing a sweep to be collected only when the program requests one through the saGetSweep_32f/saGetSweep_64f functions. The length of the sweep is determined by a combination of resolution bandwidth, video bandwidth, and span.
Once the device is initialized you can determine the characteristics of the sweep you will be collecting with saQuerySweepInfo. This function returns the length of the sweep, the frequency of the first bin, and the bin size. You will need to allocate two arrays of memory, representing the minimum and maximum values for each frequency bin.
Now you are ready to call the saGetSweep_32f/saGetSweep_64f and saGetPartialSweep_32f/saGetPartialSweep_64f functions.
You can determine the frequency of any bin in the resulting sweep by the following function, where n
is the zero-based index into the sweep array:
Frequency of nth sample point in returned sweep = startFreq + n * binSize
The API provides the functionality of an online real-time spectrum analyzer for the full instantaneous bandwidth of the device (250kHz). In real-time FFTs are applied at an overlapping rate of 87.5%.
For a list of all examples, please see the examples/ folder in the SDK.
The configuration routines which affect the spectrum results are the same for swept analysis, but span is restricted to 250kHz.
Once you have configured the device, call saInitiate using the SA_REAL_TIME flag.
The number of sweep results far exceeds a program’s capability to acquire, view, and process, therefore the API combines sweeps results for a user specified amount of time. It does this in two ways. One, is the API either min/max holds or averages the sweep results into a standard sweep.
Also, the API creates an image frame which acts as a density map for every sweep result processed during a period. Both the sweep and density map are returned at rate specified by the function saConfigRealTime.
An alpha frame is also provided by the API. The alphaFrame is the same size as the frame and each index correlates to the same index in the frame. The alphaFrame values represent activity in the frame. When activity occurs in the frame, the index correlating to that activity is set to 1. As time passes and no further activity occurs in that bin, the alphaFrame exponentially decays from 1 to 0. The alphaFrame is useful to determine how recent the activity in the frame is and useful for plotting the frames.
For a full example of using real-time see Real-Time Spectrum Analysis.
The API can provide programmers with a continuous stream of digital I/Q samples from the device.
For a list of all examples, please see the examples/ folder in the SDK.
Configuration routines used to prepare streaming are:
Once configured, initialize the device with the SA_IQ mode.
The digital I/Q stream consists of interleaved 32-bit floating point I/Q pairs scaled to mW. The digital samples are amplitude corrected providing accurate measurements. The I/Q data rate at its highest is 486.111111~ kS/s and can be decimated down by a factor of up to 128 (in powers of two). Each decimation value further reduces the overall bandwidth of the I/Q samples, so the API also provides a configurable bandpass filter to control the overall passband of a given I/Q data stream. The I/Q data stream can also be tuned to an arbitrary center frequency.
Data acquisition begins immediately. The API buffers ~3/4 second worth of digital samples in circular buffers. It is the responsibility of the user application to poll the samples via saGetIQData fast enough to prevent the circular buffers from wrapping. We suggest a separate polling thread and synchronized data structure (buffer) for retrieving the samples and using them in your application.
NOTE: Decimation / filtering / calibration occur on the PC and can be processor-intensive on certain hardware. Please characterize the processor load if you think this might be an issue for your application.
Configure audio demodulation with:
Once configured, initialize the device with the SA_AUDIO mode.
Once the device is streaming, use saGetAudio to retrieve 4096 audio samples for an audio sample rate of 30382. The API buffers many seconds' worth of audio.
When a Signal Hound tracking generator is paired together with a spectrum analyzer, the product can function as a scalar network analyzer to perform insertion loss measurements,or return loss measurements by adding a directional coupler. Throughout this document, this functionality will be referred to as tracking generator (or TG) sweeps.
For a list of all examples, please see the examples/ folder in the SDK.
Scalar Network Analysis can be realized by following these steps:
If you modify the test setup or want to re-initialize the device with a new configuration, the store thru must be performed again.