SDRplay RSP2 Matlab Toolbox

Simple interface to communicate with your RSP2 device through Matlab
329 Downloads
Updated 23 Jun 2018

View License

!!! READ ME – START !!!
Matlab does not allow .dll or MEX files, so you need to do the following steps or if you trust me, get a ready x64 compiled version from git -> https://github.com/VasAthanasios/SDRplay_RSP2_Matlab_Toolbox/
1) Download the API from https://www.sdrplay.com/downloads/
a. Copy paste the .dll and .lib depending on your windows version (x86 or x64) in the same folder.
b. Rename it as “mir_sdr_api.dll”. The .dll needs to be in the same folder with the correct name.
2) Compile the C/MEX file with the following command,
a. "mex sdrplay_mex.c mir_sdr_api.lib"

!!! READ ME – END !!!
The SDRplay MEX/class is a simple wrapper for the SDRplay library to receive directly from Matlab. It allows uninterrupted transfers without storing signals on disk intermediately.

You can access parameters like Frequency, Sample rate, Bandwidth, and Gain reduction settings. For the appropriate settings please look at the specifications. To enable the stream, run the command Stream. To receive a packet of data when you want to use callback function: GetPacket. The timer is set to dump complex data every 0.25s. The internal buffer of the MEX file is set to 2000000, so depending on your sample rate you can access data periodically. The output data can be an integer vector in the range [-127, 127], or a single or double vector in the range [-1, 1]. By default, the data type is double and values are in the range [-1, 1]. Alternatively, you can set rxNumericType to 'int16'.

The class "SDRplay.m" is used with the compiled MEX "SDRplay_mex" to communicate with a single RSP.

The file "SDRplay_mex.c" contains C/MEX code that enables the communication between Matlab and the RSPii. This version of C/MEX contains an overlapping buffer. When the buffer is full, it starts writing samples at the start, overwriting the previous samples. A circular buffer will be implemented in the future!
I have also included two spectral analysis examples, using the Communication System Toolbox.

"SDRplay_ex_SpectGUI" is a simple GUIDE which can be used interactively to look at the spectrum.

"SDRplay_ex_SpectrumAnalyzer.m" is a simple .m file which shows how the Class/MEX can be used from Matlab's editor.

Features to be implemented in the future if requested!
-- Control of Gain Mode
-- Control of Lo Mode
-- Control of Ppm
-- Control of DC offset IQ imbalance
-- AGC Selection
-- BiasT Selection
-- AM port Selection
-- RF notch Selection

HUGE thanks to the SDRplay team for their assistance on the API usage!

Big thanks to Tillmann Stübler for his work on the HackRF toolbox.

For any questions or assistance, you can find me at,

avasileiadis1@sheffield.ac.uk

Cite As

Athanasios Vasileiadis (2024). SDRplay RSP2 Matlab Toolbox (https://www.mathworks.com/matlabcentral/fileexchange/67816-sdrplay-rsp2-matlab-toolbox), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2015a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Data Acquisition Toolbox Supported Hardware in Help Center and MATLAB Answers
Acknowledgements

Inspired by: hackRF toolbox with spectrum analyzer

Communities

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.1

Fixed text, updated git hub link.

1.0.0.0