This is an old revision of the document!
A C++ library for interfacing with the ADALM2000, splitted into more correlated components, interconnected by a context.
These m2k components represent the functionalities of ADALM-2000:
Libm2k can be used for encoding and decoding digital signals, communicating with a wide variety of chips, using some well known protocols, such as SPI, I²C or UART. Created based on no-OS communication headers, libm2k communication segment is build to interact with ADI's chips in a generic way. Regardless of protocol, there are three common steps in any communication process: initialization, writing/reading, freeing the resources. A more detailed view of communicating with a peripheral is documented here.
For an easier and faster control of m2k components, libm2k offers a command-line frontend, called m2kcli. This command line tool also includes the fuctionality of encoding and decoding digital signals. More information about m2kcli can be found on our wiki page.
In order to access some USB functions without root privileges, it's recommended to install the ADALM2000 udev rules. Simply download 53-adi-m2k-usb.rules and copy into the /etc/udev/rules.d/ folder
Instructions to install Windows drivers can be found here.
Instructions to install Mac OS X drivers can be found here.
Go to the latest release page and download the package that fits your system.
libm2k for Windows
libm2k for Linux
libm2k for OSX
ln -s /Library/Frameworks/libm2k.framework/Tools/m2kcli <path-to-accessible-location>/m2kcli
The Python bindings are enabled by default if SWIG and a correct Python version are detected on your system. They can be specifically enabled or disabled by using the following:
~/libm2k/build$ cmake -DENABLE_PYTHON=ON/OFF ..
The C# bindings are disabled by default. They can be specifically enabled(requires SWIG and a correct C# compiler) or disabled by using the following:
~/libm2k/build$ cmake -DENABLE_CSHARP=ON/OFF ..
MATLAB bindings come pre-packaged through installers for Linux and Windows. Further documentation is provided on a separate page.
LabVIEW bindings come pre-packaged through a .vip installer for Windows. Further documentation is provided on a separate page.
Building m2kcli is disabled by default. It can be enabled by running the following
~/libm2k/build$ cmake -DENABLE_TOOLS=ON ..
The logging system is disabled by default. It can be specifically enabled(requires glog library) or disabled by using the following:
~/libm2k/build$ cmake -DENABLE_LOG=ON/OFF ..
There is one more layer of controlling the logging. After building libm2k with logging support the user must enable the logging system from code, calling the method enableLogging(true). By default the logging system is disabled.
Building the examples is disabled by default. It can be enabled by running the following
~/libm2k/build$ cmake -DENABLE_EXAMPLES=ON ..
Install git, cmake, swig, python:
~$ sudo apt-get install git cmake swig g++ python3-dev python3-setuptools libgoogle-glog-devBuild and install libiio. Instructions can be found here.
Build and install libm2k:
~$ git clone https://github.com/analogdevicesinc/libm2k.git ~$ cd libm2k ~/libm2k$ mkdir build ~/libm2k$ cd build ~/libm2k/build$ cmake ../ ~/libm2k/build$ make ~/libm2k/build$ sudo make install
If the Python bindings were enabled, they will be automatically installed in the site-packages folder specific for Python, once sudo make install is called.
Python bindings can also be built and installed manually using:
~/libm2k$ cd libm2k/build ~/libm2k$ python3 setup.py build ~/libm2k$ python3 setup.py install
Install git, cmake, swig and python:
~$ brew install git cmake g++ swig python3 libusb
Download and install libiio.
Build and install libm2k:
~$ git clone https://github.com/analogdevicesinc/libm2k.git ~$ cd libm2k ~/libm2k$ mkdir build ~/libm2k$ cd build ~/libm2k/build$ cmake ../ ~/libm2k/build$ make ~/libm2k/build$ sudo make install
Make sure you installed libm2k first then run the following commands in order to install the Python bindings in your system.
~/libm2k$ cd libm2k/build ~/libm2k$ python3 setup.py install_libThis will install libm2k.py and _libm2k.so in the site-packages folder used by your python3 executable.
Get the latest installer from here.
C:\Python37
.IIO_LIBRARIES
to libiio/MS64/libiio.lib
and IIO_INCLUDE_DIRS
libiio/include
.GLOG_LIBRARIES
to glog_build_dir/Release/glog.lib
and GLOG_INCLUDE_DIRS
to your glog_build_dir
.PYTHON_EXECUTABLE
to have the python install folder (C:/Python37/python.exe
).
Build solution in visual studio
If you want to install the library in the system:
C:\Windows\System32
.C:\Windows\System32
.pip install wheel
and python setup.py bdist_wheel
in order to build and install the Python Bindings.
C# bindings
ENABLE_CSHARP=OFF
in the CMake configuration.libm2k-sharp.dll
and libm2k-sharp-cxx-wrap.dll
. These can be found in C:\Program Files\Common Files\libm2k
if you installed libm2k using the system installer. Otherwise, you can download the latest archive from appveyor: Appveyor artifacts and get the dlls from there.libm2k-sharp.dll
as a reference in your project.An automatically generated documentation of the API can be found here: https://analogdevicesinc.github.io/libm2k/annotated.html.
Libm2k offers a software solution for calibrating the board. Please visit the dedicated page for more information.
Documentation can be found here.
See the dedicated page.