LMS API Documentation v19.01.0

Enumerations | Functions | Variables
Advanced control functions
High-level control functions

## Enumerations
enum | lms_gfir_t { LMS_GFIR1 = 0, LMS_GFIR2, LMS_GFIR3 }
| Enumeration of LMS7 GFIRS.

## Functions
API_EXPORT int CALL_CONV | LMS_SetSampleRateDir (lms_device_t *device, bool dir_tx, float_type rate, size_t oversample)
API_EXPORT int CALL_CONV | LMS_SetNCOFrequency (lms_device_t *device, bool dir_tx, size_t chan, const float_type *freq, float_type pho)
API_EXPORT int CALL_CONV | LMS_GetNCOFrequency (lms_device_t *device, bool dir_tx, size_t chan, float_type *freq, float_type *pho)
API_EXPORT int CALL_CONV | LMS_SetNCOPhase (lms_device_t *device, bool dir_tx, size_t chan, const float_type *phases, float_type fcw)
API_EXPORT int CALL_CONV | LMS_GetNCOPhase (lms_device_t *device, bool dir_tx, size_t chan, float_type *phases, float_type *fcw)
API_EXPORT int CALL_CONV | LMS_SetNCOIndex (lms_device_t *device, bool dir_tx, size_t chan, int index, bool downconv)
API_EXPORT int CALL_CONV | LMS_GetNCOIndex (lms_device_t *device, bool dir_tx, size_t chan)
API_EXPORT int CALL_CONV | LMS_SetGFIRCoeff (lms_device_t *device, bool dir_tx, size_t chan, lms_gfir_t filt, const float_type *coef, size_t count)
API_EXPORT int CALL_CONV | LMS_GetGFIRCoeff (lms_device_t *device, bool dir_tx, size_t chan, lms_gfir_t filt, float_type *coef)
API_EXPORT int CALL_CONV | LMS_SetGFIR (lms_device_t *device, bool dir_tx, size_t chan, lms_gfir_t filt, bool enabled)
API_EXPORT int CALL_CONV | LMS_EnableCalibCache (lms_device_t *dev, bool enable)
API_EXPORT int CALL_CONV | LMS_EnableCache (lms_device_t *dev, bool enable)

## Variables
static const int | LMS_NCO_VAL_COUNT = 16
| Number of NCO frequency/phase offset values.

## Detailed Description

The functions in this section provides some additional control compared to High-Level functions. They are labeled advanced because they require better understanding of hardware and provide functionality that may conflict with other High-Level functions.

## Function Documentation

## ◆ LMS_EnableCache()

API_EXPORT int CALL_CONV LMS_EnableCache | ( | lms_device_t * | dev,
|  | bool | enable
| ) |  |

Enables or disable caching of LMS7 and FPGA register values.

Parameters

  dev | Device handle previously obtained by LMS_Open().
  enable | true to enable cache

Returns
  0 on success, (-1) on failure

## ◆ LMS_EnableCalibCache()

API_EXPORT int CALL_CONV LMS_EnableCalibCache | ( | lms_device_t * | dev,
|  | bool | enable
| ) |  |

Enables or disable caching of calibration values.

Deprecated:
  calibration cache has been removed from LimeSuite. Use LMS_EnableCache() to enable caching of register values

Parameters

  dev | Device handle previously obtained by LMS_Open().
  enable | true to enable cache

Returns
  0 on success, (-1) on failure

## ◆ LMS_GetGFIRCoeff()

API_EXPORT int CALL_CONV LMS_GetGFIRCoeff | ( | lms_device_t * | device,
|  | bool | dir_tx,
|  | size_t | chan,
|  | lms_gfir_t | filt,
|  | float_type * | coef
| ) |  |

Get currently set GFIR coefficients.

Parameters

  | device | Device handle previously obtained by LMS_Open().
  | dir_tx | Select RX or TX
  | chan | Channel index
  | filt | GFIR to configure
  [out] | coef | Current GFIR coefficients. Array must be big enough to hold 40 (GFIR1, GFIR2) or 120 (GFIR3) values.

Returns
  0 on success, (-1) on failure

## ◆ LMS_GetNCOFrequency()

API_EXPORT int CALL_CONV LMS_GetNCOFrequency | ( | lms_device_t * | device,
|  | bool | dir_tx,
|  | size_t | chan,
|  | float_type * | freq,
|  | float_type * | pho
| ) |  |

Get the current NCO FCW mode configuration.

Parameters

  | device | Device handle previously obtained by LMS_Open().
  | dir_tx | Select RX or TX
  | chan | Channel index
  [out] | freq | List of NCO frequencies. Must be at least LMS_NCO_VAL_COUNT length;
  [out] | pho | Phase offset in deg

Returns
  0 on success, (-1) on failure

## ◆ LMS_GetNCOIndex()

API_EXPORT int CALL_CONV LMS_GetNCOIndex | ( | lms_device_t * | device,
|  | bool | dir_tx,
|  | size_t | chan
| ) |  |

Get the currently active NCO frequency/phase offset index

Parameters

  device | Device handle previously obtained by LMS_Open().
  dir_tx | Select RX or TX
  chan | Channel index

Returns
  Current NCO frequency/phase index on success, (-1) on failure

## ◆ LMS_GetNCOPhase()

API_EXPORT int CALL_CONV LMS_GetNCOPhase | ( | lms_device_t * | device,
|  | bool | dir_tx,
|  | size_t | chan,
|  | float_type * | phases,
|  | float_type * | fcw
| ) |  |

Get the current NCO PHO mode configuration.

Parameters

  | device | Device handle previously obtained by LMS_Open().
  | dir_tx | Select RX or TX
  | chan | channel index
  [out] | phases | List of configured NCO phases Must be at least LMS_NCO_VAL_COUNT length;
  [out] | fcw | Current NCO frequency

Returns
  0 on success, (-1) on failure

## ◆ LMS_SetGFIR()

API_EXPORT int CALL_CONV LMS_SetGFIR | ( | lms_device_t * | device,
|  | bool | dir_tx,
|  | size_t | chan,
|  | lms_gfir_t | filt,
|  | bool | enabled
| ) |  |

Enables or disables specified GFIR.

Parameters

  device | Device handle previously obtained by LMS_Open().
  dir_tx | Select RX or TX
  chan | Channel index
  filt | GFIR to configure
  enabled | true(1) enable, false(0) disable.

Returns
  0 on success, (-1) on failure

## ◆ LMS_SetGFIRCoeff()

API_EXPORT int CALL_CONV LMS_SetGFIRCoeff | ( | lms_device_t * | device,
|  | bool | dir_tx,
|  | size_t | chan,
|  | lms_gfir_t | filt,
|  | const float_type * | coef,
|  | size_t | count
| ) |  |

Configure LMS GFIR using specified filter coefficients. Maximum number of coefficients is 40 for GFIR1 and GFIR2, and 120 for GFIR3.

Parameters

  | device | Device handle previously obtained by LMS_Open().
  | dir_tx | Select RX or TX
  | chan | Channel index
  | filt | GFIR to configure
  [in] | coef | Array of filter coefficients. Coeff range [-1.0, 1.0].
  | count | number of filter coefficients.

Returns
  0 on success, (-1) on failure

## ◆ LMS_SetNCOFrequency()

API_EXPORT int CALL_CONV LMS_SetNCOFrequency | ( | lms_device_t * | device,
|  | bool | dir_tx,
|  | size_t | chan,
|  | const float_type * | freq,
|  | float_type | pho
| ) |  |

Configure NCO to operate in FCW mode. Configures NCO with up to 16 frequencies that can be quickly switched between. Automatically starts NCO with frequency at index 0 Use LMS_SetNCOindex() to switch between NCO frequencies.

Parameters

  | device | Device handle previously obtained by LMS_Open().
  | dir_tx | Select RX or TX
  | chan | Channel index
  [in] | freq | List of NCO frequencies. Values cannot be negative. Must be at least LMS_NCO_VAL_COUNT length;
  | pho | NCO phase offset in deg

Returns
  0 on success, (-1) on failure

## ◆ LMS_SetNCOIndex()

API_EXPORT int CALL_CONV LMS_SetNCOIndex | ( | lms_device_t * | device,
|  | bool | dir_tx,
|  | size_t | chan,
|  | int | index,
|  | bool | downconv
| ) |  |

Switches between configured list of NCO frequencies/phase offsets. Also Allows to switch CMIX mode to either downconvert or upconvert.

Parameters

  device | Device handle previously obtained by LMS_Open().
  dir_tx | Select RX or TX
  chan | channel index
  index | NCO frequency/phase index to activate or (-1) to disable NCO
  downconv | true(1) CMIX downconvert, false(0) CMIX upconvert

Returns
  0 on success, (-1) on failure

## ◆ LMS_SetNCOPhase()

API_EXPORT int CALL_CONV LMS_SetNCOPhase | ( | lms_device_t * | device,
|  | bool | dir_tx,
|  | size_t | chan,
|  | const float_type * | phases,
|  | float_type | fcw
| ) |  |

Configure NCO to operate in PHO mode. Configures NCO with up to 16 phase offsets that can be quickly switched between. Automatically starts NCO with phase at index 0 Use LMS_SetNCOindex() to switch between NCO phases.

Parameters

  | device | Device handle previously obtained by LMS_Open().
  | dir_tx | Select RX or TX
  | chan | Channel index
  [in] | phases | List of NCO phases. Values cannot be negative. Must be at least LMS_NCO_VAL_COUNT length;
  | fcw | NCO frequency in Hz

Returns
  0 on success, (-1) on failure

## ◆ LMS_SetSampleRateDir()

API_EXPORT int CALL_CONV LMS_SetSampleRateDir | ( | lms_device_t * | device,
|  | bool | dir_tx,
|  | float_type | rate,
|  | size_t | oversample
| ) |  |

Set sampling rate for all RX or TX channels. Sample rate is in complex samples (1 sample = I + Q). The function sets sampling rate that is used for data exchange with the host. It also allows to specify higher sampling rate to be used in RF by setting oversampling ratio. Valid oversampling values are 1, 2, 4, 8, 16, 32 or 0 (use device default oversampling value).

Note
  RX and TX rates sampling are closely tied in LMS7 chip. Changing RX or TX will often result in change of both (RX and TX). RX/TX ratio can only be power of 2 and is also limited by other factors. Use LMS_GetSampleRate() to obtain actual sample rate values. The function returns success if it is able to achieve desired sample rate and oversampling for the specified direction (RX or TX) ignoring possible value changes in other direction channels.

Parameters

  [in] | device | Device handle previously obtained by LMS_Open().
  | dir_tx | Select RX or TX
  | rate | Sampling rate in Hz to set
  | oversample | RF oversampling ratio.

Returns
  0 on success, (-1) on failure