Hi there,
I'm enabling one of the analog input channels on my Adalm2000 using the following Matlab code:
[edited by: kellybritney at 9:02 PM (GMT -4) on 6 Sep 2022]
Hi there,
I'm enabling one of the analog input channels on my Adalm2000 using the following Matlab code:
Hi,
Can you provide some more details about the version of Matlab and libm2k (base and bindings) that you are using?
I see that you use: "data = ain.getSamplesInterleaved(80000);" and I assume you are using an older libm2k-matlab release, could you confirm?
This method changed in the latest release and is now called: " data = ain.getSamplesInterleaved_matlab(80000); "
Do you have the possibility to update to the latest libm2k-matlab release?
Using an old version of libm2k could cause the issue you are describing. The calibration process was improved in the new versions. This might explain why using Scopy in the background makes it work fine (if Scopy has some newer version).
Thank you!
-Alexandra
Hi Alexandra, thanks for the reply. My Matlab is R2022a (installed on Windows) and the toolbox installed is v20.1.1 (which is the latest version available from Matlab, installed by using Matlab add-ons). The analog script is still using getSamplesInterleaved(80000). I've noticed that there is a v20.1.2 from Github which as you said uses getSamplesInterleaved_matlab(80000) (also is said to be compatible with at least R2021a), but the toolbox causes crashes of the Matlab when running the script. Should I downgrade my Matlab to R2020a?
-Kelly
Hi,
We just tested the 20.1.2 installer from Github with Matlab R2022a and it worked fine.
Could you check the following path : "C:\Users\<your username>\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes" and let us know if you have any libm2k related directories?
Did you uninstall the previous 20.1.1 from the Add-On Manager before installing this one? If not, could you uninstall the libm2k Toolbox first and then install the desired version?
After uninstalling you should not have any directory related to libm2k in the location mentioned above. If you installed 2 separate versions, there might have been 2 directories created there, and the scripts were not using the correct one.
Thank you!
-Alexandra
Yes there are multiple copies of the libm2k binding files and I've tried to delete them and reinstall v20.1.2. The rest code is fine, but data = ain.getSamplesInterleaved_matlab(1000) will cause crash of my Matlab.
-Kelly
"ain.getSamplesInterleaved_matlab " should be used for v20.1.0 while " ain.getSamplesInterleaved" would work for all the older versions.
Can you run " disp(clib.libm2k.libm2k.context.getVersion() " and let us know what version is displayed?
-Alexandra
v0.4.0-g936e2c8
-Kelly
Did you install libm2k separately from the Matlab libm2k installer?
You can check in the System32 directory for libm2k.dll . If you find one, then you probably installed the libm2k library in your system at some point.
The libm2k Matlab installer takes care of the libm2k.dll and installs it in the Toolboxes directory (with all the necessary dependencies). But if you have libm2k.dll in the system, then maybe Matlab will load that one instead of the one in Toolboxes.
If that's the case, you can uninstall libm2k from your system.
Or if you need libm2k in the system, then you should use this installer: https://github.com/analogdevicesinc/libm2k/releases/download/v0.5.0/libm2k-0.5.0-Windows-setup.exe to install the correct version required by the Matlab bindings.
-Alexandra
v20.1.2 requires libm2k v0.5 (while mine was v0.4), so after updating my libm2k the analog example works and the waveform is correct. What did you change to the digital example? I also need to use the digital functions but this time the digital script (my script was working with the older toolbox) causes crash of my Matlab.
-Kelly
The digital example did not have any changes for this release.
Do you have some more details about what's making it crash? The sample acquisition? The ADALM2000 connection?
-Alexandra
My system also has a FMCOMMS5 and I need to control it as well. I've written an initialization function to first initialize all the SDRs (so later I just need to send and receive buffers to/from SDRs which make the data acquisition much faster).