Installing the USRP USB driver: libusb-win32

The USRP hardware is controlled through the libusb-win32 user-space USB driver. If you have not already installed this driver you will have to download and install it. It is suggested to use the pre-packaged version, including an INF-File for the USRP, which can be found at the download site of the Institute für Nachrichtentechnik (INT). Alternatively, you can download the driver from the libusb-win32's homepage at SourceForge - in this case you need to create the INF-File by yourself. See the weblinks page for download adresses.

After plugging in and powering up your USRP, point Windows to the folder into which you downloaded and extracted the pre-packaged driver. When you start Simulink-USRP for the first time, you might have to repeat this step once. This happens when the USRP's firmware has been loaded into the microcontroller. If everything works, you should see the USRP in the device manager:

If Windows does not ask you for the driver, go to the device manager and delete any previous installations of a USRP driver you might find. If you want to keep an existing driver, this should work fine. However, if you should encounter any segmentation faults, it is recommended to install the pre-packaged driver.

Choosing the Microsoft Visual C++ Compiler under MATLAB

Due to licensing issues, there are no precompiled versions of the Simulink-USRP project. However, compiling the project is as easy as calling one command from the MATLAB command promt. Before doing this, you need to choose the correct compiler, which will be done in this step.

Make sure you have Microsoft Visual C++ installed on your computer, as written in Getting Started. On the MATLAB command promt, type mex -setup and choose the Microsoft Compiler. The output should look similiar to this:

>> mex -setup
Please choose your compiler for building external interface (MEX) files:
Would you like mex to locate installed compilers [y]/n? y
Select a compiler:
[1] Lcc-win32 C 2.4.1 in D:\PROGRA~1\MATLAB\R2008a\sys\lcc\bin
[2] Microsoft Visual C++ 2005 in D:\Programme\Microsoft Visual Studio 8
[0] None
Compiler: 2
Please verify your choices:
Compiler: Microsoft Visual C++ 2005
Location: D:\Programme\Microsoft Visual Studio 8
Are these correct [y]/n? y
Trying to update options file: [...] mexopts.bat
From template: [...]
Done . . .
[...]
>>

If you are using an older version of MATLAB and the Express-Edition of the Microsoft Visual C++ compiler, please take a look at Microsoft 32/64-bit Visual C++ 2008 Express support files at "MATLAB Central", download the package and follow the readme.txt. Sometimes you have to adapt the path for the MSSdk to the directory where you installed it.

Installing Simulink-USRP into MATLAB

You can place the downloaded Simulink-USRP package whereever you like on your hard drive, it does not need to be underneath your MATLAB root. Installing it into MATLAB means nothing more than adding two folders to your MATLAB path.

To do this, select File > Set Path in the MATLAB desktop. Click Add Folder... and select the folder X:\simulink-usrp\bin\ in a first round, and X:\simulink-usrp\blockset\ in a second round, with X:\ being the location where you unpacked the Simulink-USRP package. After clicking Save and Close, this step is done.

If it ever happens to you that you want to uninstall this package, simple delete the folders from the file system. MATLAB will detect that they are missing the next time it is started, and remove the added paths.

Compiling Simulink-USRP

The final step in setting up this package is to call usrpBuildBinaries on the MATLAB command promt. The output should look like this:

>> usrpBuildBinaries
Running: mex -outdir 'X:\simulink-usrp\bin' -output libusrp LINKER=lib.exe[...]
D:\DOKUME~1\[...]\LOKALE~1\Temp\mex_R45T3d\templib.x konnte nicht gefunden werden
Running: mex -outdir 'X:\simulink-usrp\bin' -output 'simulink-usrp' LINKER=lib.exe [...]
D:\DOKUME~1\[...]\LOKALE~1\Temp\mex_e5ubei\templib.x konnte nicht gefunden werden
Running: mex -outdir 'X:\simulink-usrp\bin' [...]usrp_helper.cpp[...]
Running: mex -outdir 'X:\simulink-usrp\bin' [...]usrp_sink.cpp[...]
Running: mex -outdir 'X:\simulink-usrp\bin' [...]usrp_source.cpp[...]
Running: mex -outdir 'X:\simulink-usrp\bin' [...]stdout2matlab.cpp[...]
>>

That's all, now you can start using the Simulink-USRP interface by placing blocks from the USRP library in the Simulink library browser into your models.