LMS API Documentation  v18.06.0
Low-Level control functions

Modules

 Clock definitions
 

Functions

API_EXPORT int CALL_CONV LMS_Reset (lms_device_t *device)
 
API_EXPORT int CALL_CONV LMS_ReadLMSReg (lms_device_t *device, uint32_t address, uint16_t *val)
 
API_EXPORT int CALL_CONV LMS_WriteLMSReg (lms_device_t *device, uint32_t address, uint16_t val)
 
API_EXPORT int CALL_CONV LMS_ReadParam (lms_device_t *device, struct LMS7Parameter param, uint16_t *val)
 
API_EXPORT int CALL_CONV LMS_WriteParam (lms_device_t *device, struct LMS7Parameter param, uint16_t val)
 
API_EXPORT int CALL_CONV LMS_ReadFPGAReg (lms_device_t *device, uint32_t address, uint16_t *val)
 
API_EXPORT int CALL_CONV LMS_WriteFPGAReg (lms_device_t *device, uint32_t address, uint16_t val)
 
API_EXPORT int CALL_CONV LMS_ReadCustomBoardParam (lms_device_t *device, uint8_t id, float_type *val, lms_name_t units)
 
API_EXPORT int CALL_CONV LMS_WriteCustomBoardParam (lms_device_t *device, uint8_t id, float_type val, const lms_name_t units)
 
API_EXPORT int CALL_CONV LMS_GetClockFreq (lms_device_t *dev, size_t clk_id, float_type *freq)
 
API_EXPORT int CALL_CONV LMS_SetClockFreq (lms_device_t *dev, size_t clk_id, float_type freq)
 
API_EXPORT int CALL_CONV LMS_VCTCXOWrite (lms_device_t *dev, uint16_t val)
 
API_EXPORT int CALL_CONV LMS_VCTCXORead (lms_device_t *dev, uint16_t *val)
 
API_EXPORT int CALL_CONV LMS_Synchronize (lms_device_t *dev, bool toChip)
 
API_EXPORT int CALL_CONV LMS_GPIORead (lms_device_t *dev, uint8_t *buffer, size_t len)
 
API_EXPORT int CALL_CONV LMS_GPIOWrite (lms_device_t *dev, const uint8_t *buffer, size_t len)
 
API_EXPORT int CALL_CONV LMS_GPIODirRead (lms_device_t *dev, uint8_t *buffer, size_t len)
 
API_EXPORT int CALL_CONV LMS_GPIODirWrite (lms_device_t *dev, const uint8_t *buffer, size_t len)
 

Detailed Description

The functions in this section provide a low access to device such as modifying device internal register or clock frequency. Low-Level functions can be used to configure device entirely, however a more practical use is to fine-tune device settings after configuring it with /ref FN_HIGH_LVL.

Function Documentation

API_EXPORT int CALL_CONV LMS_GetClockFreq ( lms_device_t dev,
size_t  clk_id,
float_type freq 
)

Get frequency of the specified clock.

Parameters
devDevice handle previously obtained by LMS_Open().
clk_idClock identifier (Clock definitions)
freqClock frequency in Hz
Returns
0 on success, (-1) on failure
API_EXPORT int CALL_CONV LMS_GPIODirRead ( lms_device_t dev,
uint8_t *  buffer,
size_t  len 
)
Parameters
devDevice handle previously obtained by LMS_Open().
[out]bufferGPIO direction configuration(8 GPIO per byte, LSB first; 0 input, 1 output)
lennumber of bytes to read
Returns
0 on success, (-1) on failure
API_EXPORT int CALL_CONV LMS_GPIODirWrite ( lms_device_t dev,
const uint8_t *  buffer,
size_t  len 
)
Parameters
devDevice handle previously obtained by LMS_Open().
[in]bufferGPIO direction configuration(8 GPIO per byte, LSB first; 0 input, 1 output)
lennumber of bytes to write
Returns
0 on success, (-1) on failure
API_EXPORT int CALL_CONV LMS_GPIORead ( lms_device_t dev,
uint8_t *  buffer,
size_t  len 
)
Parameters
devDevice handle previously obtained by LMS_Open().
[in]bufferread values (8 GPIO values per byte, LSB first)
lennumber of bytes to read
Returns
0 on success, (-1) on failure
API_EXPORT int CALL_CONV LMS_GPIOWrite ( lms_device_t dev,
const uint8_t *  buffer,
size_t  len 
)
Parameters
devDevice handle previously obtained by LMS_Open().
[out]buffervalues to write (8 GPIO values per byte, LSB first)
lennumber of bytes to write
Returns
0 on success, (-1) on failure
API_EXPORT int CALL_CONV LMS_ReadCustomBoardParam ( lms_device_t device,
uint8_t  id,
float_type val,
lms_name_t  units 
)

Read custom parameter from board

Parameters
deviceDevice handle previously obtained by LMS_Open().
idParameter identifier
valCurrent register value
units[optional] measurement units of parameter if available
Returns
0 on success, (-1) on failure
API_EXPORT int CALL_CONV LMS_ReadFPGAReg ( lms_device_t device,
uint32_t  address,
uint16_t *  val 
)

Read device FPGA register

Parameters
deviceDevice handle previously obtained by LMS_Open().
addressRegister address
valCurrent register value
Returns
0 on success, (-1) on failure
API_EXPORT int CALL_CONV LMS_ReadLMSReg ( lms_device_t device,
uint32_t  address,
uint16_t *  val 
)

Read device LMS chip register

Parameters
deviceDevice handle previously obtained by LMS_Open().
addressRegister address
valCurrent register value
Returns
0 on success, (-1) on failure
API_EXPORT int CALL_CONV LMS_ReadParam ( lms_device_t device,
struct LMS7Parameter  param,
uint16_t *  val 
)

Read device parameter. Parameter defines specific bits in device register.

Parameters
deviceDevice handle previously obtained by LMS_Open().
paramParameter.
valCurrent parameter value.
Returns
0 on success, (-1) on failure
API_EXPORT int CALL_CONV LMS_Reset ( lms_device_t device)

Send Reset signal to LMS chip. This initializes LMS chip with default configuration as described in LMS chip datasheet.

Parameters
deviceDevice handle previously obtained by LMS_Open().
Returns
0 on success, (-1) on failure
API_EXPORT int CALL_CONV LMS_SetClockFreq ( lms_device_t dev,
size_t  clk_id,
float_type  freq 
)

Set frequency of the specified clock

Note
setting LMS_CLOCK_EXTREF changes clock source to external, use LMS_VCTCXOWrite() to change back to VCTCXO
Parameters
devDevice handle previously obtained by LMS_Open().
clk_idClock identifier (Clock definitions)
freqClock frequency in Hz. Pass zero or negative value to only perform tune (if supported) without recalculating values
Returns
0 on success, (-1) on failure
API_EXPORT int CALL_CONV LMS_Synchronize ( lms_device_t dev,
bool  toChip 
)

Synchronizes register values between API cache and chip

Parameters
devDevice handle previously obtained by LMS_Open().
toChipif true copies values from API cache to chip.
Returns
0 on success, (-1) on failure
API_EXPORT int CALL_CONV LMS_VCTCXORead ( lms_device_t dev,
uint16_t *  val 
)

Read value from VCTCXO trim DAC.

Parameters
[in]devDevice handle previously obtained by LMS_Open().
[out]valValue to read from VCTCXO trim DAC
Returns
0 on success, (-1) on failure
API_EXPORT int CALL_CONV LMS_VCTCXOWrite ( lms_device_t dev,
uint16_t  val 
)

Write value to VCTCXO trim DAC. Used to adjust/calibrate reference clock generated by voltage controlled oscillator.

Note
calling this functions switches clock source to VCTCXO
Parameters
devDevice handle previously obtained by LMS_Open().
valValue to write to VCTCXO trim DAC, range 0-255
Returns
0 on success, (-1) on failure
API_EXPORT int CALL_CONV LMS_WriteCustomBoardParam ( lms_device_t device,
uint8_t  id,
float_type  val,
const lms_name_t  units 
)

Write custom parameter from board

Parameters
deviceDevice handle previously obtained by LMS_Open().
idParameter identifier
valValue to write
units[optional] measurement units of parameter if available
Returns
0 on success, (-1) on failure
API_EXPORT int CALL_CONV LMS_WriteFPGAReg ( lms_device_t device,
uint32_t  address,
uint16_t  val 
)

Write device FPGA register

Parameters
deviceDevice handle previously obtained by LMS_Open().
addressRegister address
valValue to write
Returns
0 on success, (-1) on failure
API_EXPORT int CALL_CONV LMS_WriteLMSReg ( lms_device_t device,
uint32_t  address,
uint16_t  val 
)

Write device LMS chip register

Parameters
deviceDevice handle previously obtained by LMS_Open().
addressRegister address
valValue to write
Returns
0 on success, (-1) on failure
API_EXPORT int CALL_CONV LMS_WriteParam ( lms_device_t device,
struct LMS7Parameter  param,
uint16_t  val 
)

Write device parameter. Parameter defines specific bits in device register.

Parameters
deviceDevice handle previously obtained by LMS_Open().
paramParameter.
valParameter value to write
Returns
0 on success, (-1) on failure