Loading configuration files using MATLAB

How can I load configuration and waveform files (.ini and .wfm) using Matlab? I can see in Octave example that following commands are used to load the files:

Are there similar commands defined in Matlab?

Also, how can I enable loopback mode using matlab?

you can see https://www.mathworks.com/help/matlab/ref/calllib.html
and LimeAPI https://github.com/myriadrf/LimeSuite/blob/master/src/lime/LimeSuite.h

using matlab calllib function

path = libpointer(‘cstring’, ‘rxTest.ini’);
calllib(‘libLimeSuite’, ‘LMS_LoadConfig’, dptr,path);

@jocover ,
thank you for reply.
I am still struggling to load the configuration file. sorry if the questions are primitive but what is dptr? I guess it should be a pointer but how can I define it?

Dear @jocover
I tried to figure out the dptr from calllib examples in limeSDR.m file. I also had a look to shared library using following Matlab command:
libfunctionsview libLimeSuite

I can see the LMS_LoadConfig takes to inputs ‘voidPtr’ and ‘cstring’.

I tried to to load the configuration by typing following commands:
dptr = libpointer(‘voidPtr’);
path = libpointer(‘cstring’, ‘rxTest.ini’);
[a, b, c] = calllib(‘libLimeSuite’, ‘LMS_LoadConfig’, dptr,path);

however, I get -1 for parameter a. I assume this means failure. Do you know what is the problem?

first using LMS_Open to open device
pdevlist = libpointer(‘int8Ptr’);
dptr = libpointer(‘voidPtrPtr’);
calllib(‘libLimeSuite’, ‘LMS_Open’, dptr,pdevlist,0)

path = libpointer(‘cstring’, ‘rxTest.ini’);
calllib(‘libLimeSuite’, ‘LMS_LoadConfig’, dptr,path);

@jocover, @mehdimolu
I have tested the loading configuration file using Matlab 2016b / W10.
All the loading runs well but the running with the board still returns a bandwidth set to “0” ?? as below using the example.ini supplied with the LimeSDR board quick test.
All the file I have tested returns the same issue : bandwidth set to “0” as below :
limeSDR_XCVR with properties:

  • samplerate: 10000000
  • frequency: 8.0000e+08
  • bandwidth: 6.9526e-310
  • antenna: 2
  • gain: 0.7143
  • running: 1
  • timestamp: []

Of course, I can set a bandwidth using the command “dev.rx0.bandwidth = 10e6”. The running is OK but the Bw parameter is then not linked to the config file.
Do you get the same result/issue ? any advice ?
Thank you and regards.

I have not tried running LimeSDR with Matlab, but in this case ‘bandwidth’ probably refers to LPF bandwidth.
The .ini file contains complete configuration for LMS7 chip and that includes LPF configuration, However, LPF bandwidth is determined by multiple parameters and there is no such single parameter as ‘bandwidth’. When you tune filter in LmsSuiteGUI it takes ‘RF bandwidth’ as parameter and runs calibration to find optimal filter configuration (saved in .ini file) for that bandwidth, but the ‘RF bandwidth’ used for filter calibration is not saved anywhere.

So when you load .ini file, LPF configuration (bandwidth) will be set as in .ini file even if Matlab is unable to obtain that value and displays it as 0.

Hi @IgnasJ,
Thank you for information.
May be I can add extra explanations.
I did the “.ini” file by using the LimeSuiteGui and saving the file with it.
Then I use Matlab to load the .ini file using the library LimeSuite.h as alias and the ‘LMS_LoadConfig’ command. The returns is “0” and then the loading is correct.
But if I verify the loaded data thru the library commands, “LMS_GetLPFBW” returns a null Bandwidth… the other parameters Gain, Frequency, Antenna, State… are correct.
Moreover the running of the board is not correct (SW comes very slow during the datastreaming (seaming good at the beginning)). I have to set the bandwidth by using the “LMS_SetLPFBW” command to get a correct running. But I loss the interest of the “.ini” setting/configuration. Of course, this ini file runs well into the LimeSuiteGui and FFT viewer.
These LMS commands are sent thru the LimeSDR and LimeXCVR matlab files delivered by Jocover (@jocover for information and comments).
I don’t find where is the issue…
Thank you for your help.

LMS_GetLPFBW() is not able to readback bandwidth value from board, so this is expected. It only returns last value cached by software (set using LMS_SetLPFBW()). I will see if it could be improved to report some approximate bandwidth value based on LPF configuration in cases when where is no cached value available.

This is strange. The streaming not working correctly after just loading .ini file is most likely because FPGA is not properly configured (LMS_LoadConfig() only loads LMS7 configuration). But running LMS_SetLPFBW() should not solve this problem. LMS_SetSampleRate() should be used after loading ‘.ini’ to properly configure clocks for ‘LMS7->FPGA->FX3(USB3)’ data transfer at specific sample rate (I guess we could configure it automatically in API after loading ‘.ini’).

Hi @IgnasJ
Thank you for your help.
Yes, I confirm that adding the SampleRate setting via LMS_SetSampleRate() after loading ‘.ini’ properly configures the board and then the data transfer/streaming runs correctly (else data have a null value after a short correct stream). That will be nice if you may add this feature to configure it automatically in API after loading ‘.ini’.
Regarding the other commands like LMS_GetLPFBW() for gain, frequency, sample rate, antenna… they have all the same running ? ie, return the last value cached by SW and not the state of the board ?
I wish you a good Easter WE.

Its only bandwidth value. Gain, frequency, sample rate, antenna are obtained from LMS7 chip registers. There might be some other parameters that are not obtained from LMS7 chip but I can’t think of any right now.

Hi @IgnasJ
Still loading the ini file via Matlab, it seems the “DC corrector” function (RxTSP) is disabled.
Using the LimeSuite GUI, the DC offset on FFT viewer is low (Low “0” line).
The ini file with using Matlab delivers the same Spectrum but with a huge “0” line (or DC offset).
Moreover, I didn’t find any similar function into the LimeSuite.h ! So I don’t know how to correct the IQ DC offset.
The fixed DC offset (enabled via the Calibration tab) is loaded but the DC offset change from start to start of the board.
Do you have any fix / solution to this issue ?

Like most parameters in LimeSuiteGUI, “DC Corrector” value is just a bit in LMS chip register (exact register and bit should be displayed in tooltip in LimeSuiteGUI). So it is definitely saved and loaded from ‘.ini’ file.

Also, LimeSuiteGUI uses ‘LimeSuite.h’ for almost everything, so if LimeSuiteGUI is able to load value from ‘.ini’, other software should also be able to do that using LMS_LoadConfig().
LimeSuiteGUI changes “DC corrector” value using:

This may be related: DC offset and IQ imbalance calibrations in LimeSuiteGUI are done in ‘Calibrations’ tab by clicking “Calibrate RX”/“Calibrate TX” buttons (executes LMS_Calibrate() function in ‘LimeSuite.h’).

Hi @IgnasJ,
Thank you.
Yes, I agree with you but there are a few important différences of running between GW rev 2.6 and rev 2.8.

In the 2.6, it was possible to tune manually the DC offset on I and Q channels (like the gain or phase). The values was memorized and a LoadConfig allowed to keep this tune. Seems not possible with the rev 2.8.

Now, the IQ DC offset is tunable into the calibration tab, also into the RFE tab ?. But the manually tuning seems not active ??? only via the calibrate function !.
For me, the “DC corrector” (RXTSP tab) is a dynamic correction. See the LMS data sheet “RX DC Correction”.
The previous DC offset (calibration tab) rans well with my application.
Now, the new DC offset and DC corrector run differently…

The manually setting of the IQ gain is still active. You can tune manually the gain. But the DC offset runs differently.
These are my remarks about the changes between both revisions.
Is it possible to know what are the differences in these calibrate and offset functions between both revisions.
Please, could you give more details or information about these changes / updates ?

I will try ASAP the LMS_WriteParam (I have to add this function into the Matlab class, not present).

Best regards.


I think that it is related to change in calibration algorithms that was made in March and has nothing to do with GW version.

I talked to HW people about RX DC corrrections. There are two DC RX correctors in LMS7, one is digital and other is analog. “DC corrector” is RXTSP is digital and when enabled it automatically tracks and corrects DC offset. Manual offset in RFE (or ‘Calibrations’) is analog. Now, it turns out analog corrector also has automatic mode. The control for this mode is ‘Automatic DC calibration mode’ that is currently located in “R3 Controls” tab. When it is enabled, manual DC offset will not work. Running ‘Calibrate’ function enables it (so manual DC offset stops working).
Also, there seems to be a bug in software that makes ‘Automatic DC calibration mode’ value to be saved into ‘.ini’ file incorrectly (clicking “Chip->GUI” before saving seems to solve this). I will fix saving issue and move this control to “Calibrations” tab in LimeSuiteGUI.

Hi Ignas,
Your quick answer is really appreciated.

Sorry, but I am not a programmer. Could you explain me where is stored this algorithm ? because I only changed the GW (2.8) and the LimeSuiteGUI ( 20170410). Maybe the issue is in the GUI coming from a bad saving of the “ini” file ?
Could you confirm, the DC corrector (digital) is saved into the ini file and the loadConfig will keep this state ?
Best regards.

It is stored in LimeSuite code. So with older version of LimeSuiteGUI it should work same as before regardless of GW version.

I think its part of the problem. My guess is: The recent LimeSuiteGUI turns on automatic calibration in RFE, but fails to save this setting to ‘.ini’ file. When ‘.ini’ is loaded automatic calibration in RFE is not enabled and manual values are used instead, which are incorrect. [quote=“papatoux, post:16, topic:632”]
Could you confirm, the DC corrector (digital) is saved into the ini file and the loadConfig will keep this state ?
‘DC corrector’ value is saved and loaded correctly. You can simply check it by saving and loading ‘.ini’ with LimeSuiteGUI.

Hi Ignas,
Thank you. All is clear.
What I have to do to be inform about the delivery of the next LimeSuite GUI revision ? do I have to make a registration anywhere ?
Best regards.

We’ve just added a sign-up form to the bottom of each Myriad-RF project page, where you can enter your e-mail address to be notified of updates. In the case of Lime Suite this would be a new release. See:


If you were interested in running bleeding edge code / trying out the latest features and fixes, then you should watch the master branch on GitHub and build from this.

Thank you Andrew…