SM API
Basic API Usage

Any application using the SM API will follow these steps to interact and perform measurements on the device.

  1. Open the device and receive a handle to the device resources.
  2. Configure the device.
  3. Acquire measurements.
  4. Stop acquisitions, abort the current operation.
  5. Close the device.
  6. (Recalibration)

Opening a Device

How a device is opened depends on whether the device operates over USB 3.0 or 10GbE.

Opening a USB 3.0 device is done through the smOpenDevice or smOpenDeviceBySerial functions. These functions will perform the full initialization of the device and if successful, will return an integer handle which can be used to reference the device for the remainder of your program. See the list of all USB SM devices connected to the PC via the smGetDeviceList function.

Opening a networked device is done through the smOpenNetworkedDevice function. All networked devices have a default network configuration that can be modified using the methods described below.

Configuring a Networked Device

There are two ways to change the network settings of a 10GbE based SM spectrum analyzer.

  1. Through the smNetworkConfig*** functions. This method allows you to set the network settings over USB. This method does not require the unit to have a 10GbE connection at the time of configuration. This method is ideal when the device may or may not be on a different subnet and cannot be addressed via the broadcast method. This method is also helpful when needing to interface several networked devices that might share a network and thus aren’t individually addressable via the broadcast method.
  2. Through the smBroadcastNetworkConfig function. The device must have a valid 10GbE connection. A broadcast UDP message is sent to the receiver to reconfigure its network settings. This method is ideal for single device and single use applications to quickly modify the network settings.

Configuring the Device

Once the device is open, the next step is to configure the device for a measurement. The available measurement modes are listed on the mainpage. Each mode has specific configurations routines, which set a temporary configuration state. Once all configuration routines have been called, calling the smConfigure function copies the temporary configuration state into the active measurement state and the device is ready for measurements. The provided code examples showcase how to configure the device for each measurement mode.

Acquiring Measurements

After the device has been successfully configured, the API provides several functions for acquiring measurements. Only certain measurements are available depending on the active measurement mode. For example, I/Q data acquisition is not available when the device is in a sweep measurement mode.

Stopping the Measurements

Stopping all measurements is achieved through the smAbort function. This causes the device to cancel or finish any pending operations and return to an idle state. Calling smAbort is never required, as it is called by default if you attempt to change the measurement mode or close the device, but it can be useful to do this.

  • Certain measurement modes can consume large amounts of resources such as memory and CPU usage. Returning to an idle state will free those resources.
  • Returning to an idle state will help reduce power consumption.

Closing the Device

When finished making measurements, you can close the device and free all resources related to the device with the smCloseDevice function. Once closed, the device will appear in the open device list again. It is possible to open and close a device multiple times during the execution of a program.

Recalibration

Recalibration is performed each time the device is reconfigured (smConfigure). For instance, when the device is configured for I/Q streaming, the instrument and measurement is calibrated for the current environment and will not be calibrated again until the device measurement is aborted and started again (read: the device will not recalibrate in the middle of measurements, as this would interrupt measurements such as I/Q streaming or real-time analysis).

Large temperature changes affect measurements the most, and it is recommended to reconfigure the device once a large temperature delta has been recorded.

It is recommended to use the RFBoard temperature from the smGetFullDeviceDiagnostics function to detect a temperature drift and recalibrate again when you see a drift of 2-4 degrees Celsius. Using the temperature returned from smGetDeviceDiagnostics is also a valid approach but this function returns the FPGA temperature which has less correlation with the temperature corrections and tends to be more volatile.