LimeSDR Matlab support

Anyone that managed to get this working on Linux (Ubuntu 17.10) and can provide some input on how to achieve that? Which libraries do I need to add?

I can run the LimeSDR with LimeSuiteGUI, SoapySDR and GNU radio so I should have most libraries installed properly. However, running the limeSDR.build_thunk from Matlab just gives error so I expect that I perhaps miss some library. I added Matlab paths /usr/include/lime/ where LimeSuite.h and so on are located. I also added /usr/lib/x86_64-linux-gnu/ (with libLimeSuite.so etc) and also /var/lib/dpkg/info/ which seems to contain a lot of lime stuff. Anything obvious that I have missed?

Another source of problem might be the compiler. I run GCC 7.2.0 but officially Matlab support GCC 4.9. Anyone that have tried with a newer GCC and got it working or do I have to install the old GCC?

Anything on this?
[https://github.com/jocover/sdrsharp-limesdr/issues/4]
Thanks!

hi Jocover,

I recently purchased one LimeSDR-Mini device. This device is working fine with GNUradio and LimeSuite. But when I wanted to make an interface with the Matlab. I used ur given .dll files and Matlab codes for the Matlab interface of the LimeSDR-Mini but I am getting some issues which I am attaching through a Snapshot.

do i have to modify the files uploaded by you to work with limesdr-mini. I am a beginner to this. so please do not mind if it is a silly one. waiting for ur reply.

Hello jocover,
can you give me detailed instructions as to how to interface MATLAB with LimeSDR??
Thanks a lot,
Vinayak Anant Karandikar

Hello freebil,
can you give me detailed instructions as to how to interface MATLAB with LimeSDR??
Thanks a lot,
Vinayak Anant Karandikar

Hello jocover,
I have downloaded the two files located at

https://github.com/jocover/Simulink-MATLAB-LimeSDR/releases/download/thunk/libLimeSuite_thunk_pcwin64.dll

and

https://mega.nz/#!aVlWkC6D!OttEOrOaUo0ajOscHCKj4R8_HXU8zuzzS8hISQhNMeg

Now i get the error:

dev = limeSDR();
Warning: The function ‘LMS_SetGaindB’ was not found in the library

In loadlibrary at 402
In limeSDR>limeSDR.load_library at 190
In limeSDR>limeSDR.limeSDR at 218
Warning: The function ‘LMS_GetGaindB’ was not found in the library
In loadlibrary at 402
In limeSDR>limeSDR.load_library at 190
In limeSDR>limeSDR.limeSDR at 218
Warning: The function ‘LMS_GetNCOPhase’ was not found in the library
In loadlibrary at 402
In limeSDR>limeSDR.load_library at 190
In limeSDR>limeSDR.limeSDR at 218
Warning: The thunk(int32voidPtr_Booluint64int32_BoolThunk) for function ‘LMS_SetNCOIndex’ was not
found in the library
In loadlibrary at 402
In limeSDR>limeSDR.load_library at 190
In limeSDR>limeSDR.limeSDR at 218
Warning: The function ‘LMS_GPIODirRead’ was not found in the library
In loadlibrary at 402
In limeSDR>limeSDR.load_library at 190
In limeSDR>limeSDR.limeSDR at 218
Warning: The function ‘LMS_GPIODirWrite’ was not found in the library
In loadlibrary at 402
In limeSDR>limeSDR.load_library at 190
In limeSDR>limeSDR.limeSDR at 218
Warning: The thunk(int32voidPtruint32_BoolThunk) for function ‘LMS_EnableTxWFM’ was not found in the
library
In loadlibrary at 402
In limeSDR>limeSDR.load_library at 190
In limeSDR>limeSDR.limeSDR at 218
Error using limeSDR/load_library (line 200)
Failed to find functions in libLimeSuite.

Error in limeSDR (line 218)
limeSDR.load_library();

What do i do?

Also note:
I get the same errors using both “winusb version” and also “cyusb version”

What do i do?

Thanks a lot,
Vinayak Anant Karandikar

hello,
have you solved your problems? I want to use LimeSDR mini in matlab, but I meet the same problen LimeSDR error: no connection object
And I have already upgrade my device, but it’s still not wok. Can you please share your solution, and I’ll appreciate it very much:blush:

hello, jocover,
I’m trying to use LimeSDR mini in matlab, in addtion, I’m using win10, but I meet some problems, when I run the dev = limeSDR(); command for the first time,
error1
and I did nothing, just run the dev = limeSDR(); command for another time,
error2
the device is conneted successfully in the LimeSuite, and I’ve upgrade my hardware successfully, but it doesn’t work. Do you have some suggestions? I’ll appreciate it very much:blush:

A quick history lesson:
2017-01-16 LimeSDR-USB start to ship
2017-09-05 The very last update for jocover/Simulink-MATLAB-LimeSDR github repository.
2018-02-24 was the last time that jocover was logged into this forum
2018-03-04 LimeSDR-Mini start to ship

I think expecting jocover/Simulink-MATLAB-LimeSDR, that was created before the LimeSDR-Mini shipped, to work unmodified with a LimeSDR-Mini is low, extremely low as in Zero chance. I’d even go as far as saying that the unmodified code may not even work with a LimeSDR-USB either.
And I say that just by quickly comparing jocover/Simulink-MATLAB-LimeSDR/blob/master/LimeSuite_Build_Thunk.h to the equivalent file in the current LimeSuite myriadrf/LimeSuite/blob/master/src/lime/LimeSuite.h

There is no point in pointing out a problem without at least trying to point towards a solution, what you need is someone who has:

  • A LimeSDR-Mini (and a LimeSDR-USB as well)
  • A Microsoft Windows OS (If you compile the code on say Windows 10, by default the binary output from the Microsoft compiler will not work on any older Windows OS, you need to tweak a bunch of options to generate a backward compatible binaries!).
  • Matlab (“Communications Toolbox” for Matlab)
  • Simulink
  • Microsoft Visual C++ installed
  • And that the person who has all of the above also knows how to code.

Obviously each of the above requirements reduces the number of people who could potentially help you.

Another option might be to request mathworks to add official hardware support, since they would have most of the above. https://www.mathworks.com/hardware-support/request-hardware-support.html

Hello,

     read this: https://discourse.myriadrf.org/t/missing-library/5201

    It might help.

   Read everything in that link, completely.

You can find the updated version of the Jocover library for Matlab by the following link:

This library should work with LimeSuite 19.04.
Simulink package wasn’t changed, so probably it doesn’t work.

Matlab works with LimeSDR for the following system configuration:

  1. Windows 10 Pro
  2. Matlab 2018b
  3. Visual Studio Professional 2015
  4. LimeSDR-USB

I would appreciate, if you report about how it works in your system’s setup.

P.S. Wish everyone Merry Christmas and Happy New Year!

5 Likes

Thanks for the updated version!

I was able to get the wrapper installed, but when trying to run one of the examples, I come across the following errors:

image

Running on Windows 10, MATLAB 2019B, Visual Studio 2019, with a connected LimeSDR-USB.

Thanks

Thanks a lot too, DamirRakhimov, for your updated version. I succeeded to make the limeSDR Mini work with Matlab on windows 10 thanks to you.

https://github.com/viafx24/LimeSDR_Mini_MATLAB

As you asked for feedback,

  1. first, i had to copy/past my own LimeSuite.dll in place of your unless i have the following error :
    VCRUNTIME140_1|690x278 ) .

  2. Second, I could not generate the " libLimeSuite_thunk_pcwin64.dll" with the command “limeSDR.build_thunk()” . I’m using matlab R2018B with windows 10 and LimeSDR mini. I use the minGW64 compiler of matlab: maybe the problem comes from here or maybe i don’t exaclty understand what i’m doing. Error_LimeSDR_build_thunk|690x261 .

  3. but with your own "libLimeSuite_thunk_pcwin64.dll " and my own “LimeSuite.dll” coming from C:\Program Files\PothosSDR\bin, i was able to make the command dev=limeSDR() works after commenting all réferences to RX1 and TX1 since the limeSDR mini doesn’t have RX1and TX1
    LimeSDR_Mini_Error_Lack_RX1|690x163 .

  4. After that, i had a last problem to make working basicRX.m. Indeed, the limeSDR Mini doesn’t work with LNA_L but with LNA_W. Thus I set the dev.rx0.antenna to 3 (LNA_W) and then everythings was working. I saw your beautifull wave on the basixRXTX.m example.

Thanks again DamirRakhimov and happy new year! Viafx24.

1 Like

Hello Damir,
Your ML package runs very well under W10Pro, ML2019B and LimeSDR USB.
I am using the LimeSuite 19.04 (via Pothos install)
I have copied the limesuite.dll into the _library directory.
I did not use the “limeSDR.build_thunk” command and I have followed this remark find into the help limeSDR.build_thunk : :slightly_smiling_face:
“… For Windows users, the simplest approach is to copy the following to this directory:
- LimeSuite.dll…”

Thank you very much.
Regards.

Thank you for updating this!
I have it working (at least the basic rx example) with:

Windows 10 Pro
Matlab 2020b
LimeSDR-USB

Like papatoux, I didn’t compile anything, just copied the LimeSuite.dll from Program Files/PothosSDR/bin over to _library.

I was getting an odd blank error initially, but it was fixed by installing the LimeSDR USB driver manually per these instructions.

1 Like

Hi @jocover
So I am trying to get started with LimeSDR USB on Windows 10 and MATLAB 2021a (should I use another?)

I have 5 LimeSDRS that I want to implement in my testbed so it will be an interesting project!

Anyway I am trying to set up your files and code but I get the following firmware error despite the fact that I used LimeSuite to Open-> Modules-> Programming (automatic) but I still get the following error when I run your code :

########################################################

!!! Warning: firmware version mismatch !!!

Expected firmware version 0, but found version 4

Expected gateware version 2, revision 0

But found version 2, revision 23

Then it does the connection stream such as:

ConnectionSTREAM::ConfigureFPGA_PLL(tx=3MHz, rx=3MHz)
ConnectionSTREAM::ConfigureFPGA_PLL(tx=3MHz, rx=3MHz)

And then it outputs this final error:
Unrecognized method, property, or field ‘rx’ for class ‘limeSDR’.

Error in Untitled (line 3)
dev.rx.frequency=101.7e6;

I have tried to change rx to rx0 or rx1 but it doesn`t work. Can you please advise me on this ? Thank you very much!

I suspect that taking to “jocover” is probably not going to get a reply anytime soon. If you click on the name their profile shows that they were last seen on this website Feb 2018.

I continue trying to make work the limeSDR-mini with matlab and Simulink (windows 10, matlab R2020b). I mainly used the work of Damir Rakhimov. I succeed to make RX and TX work but i had trouble to obtain a beautiful basic sinus wave (in place of a sinus, i obtained rather a square wave at the correct frequency). The solution was to set dev.tx0.enable just after dev = limeSDR() and not after having set all the other parameter (frequency, gain etc…). Same may be true for dev.rx0.enable and thus should be put before setting RX parameters. Then i obtained a beautiful sinus. I will probably upload working code on github in a while and also maybe new code to make simulink works again. Cheers.

1 Like

I continue with limeSDR mini and Matlab/simulink code. I had trouble to get a perfect sinus at low frequency ( 1hz to 100hz). Comparing with C++ code (a customized dualRXTX.cpp from LimeSuite github example folder), i found that the oversampling of the sample rate was responsive for this not desired behaviour. In the function “set.samplerate(obj, val)” of the limeSDR_XCVR.m, i changed the oversampling initialy set at 4 to 2 or 1 and the sinus at low frequency looks much better. In the C++ code, i could also set to 1 the oversampling in the call of the API function LMS_SetSampleRate(device, sample_rate, 1) and I also got a nicer sinus. I don’t exactly understand what do this oversampling parameter, i just tell what works for me. Cheers.

I propose a new matlab and simulink version for the limeSDR mini:
https://github.com/viafx24/LimeSDR_Mini_MATLAB
One can find a simple TX-RX example matlab file that generate a sinus, a sawtooth or a square wave at de desired signal frequency, carrier frequency, Tx and RX gains and at the desired sample rate.
I also did small updates of the Joe Cover simulink wrapper and I include 4 files .slx that allow to emit and receive a sinus at 440 hz with amplitude modulation (1) or frequency modulation (2) and the same with a real song in AM (3) or FM (4). More explanation are provided in the readme file of the github repository and in the comments of the code. Feel free to contact me if it doesn’t work well for you or to give feedback. Cheers.

2 Likes