MatLab or LabVIEW drivers?

Discussions related to embedded firmware, driver, and user mode application software development
Post Reply
Montezuma
Posts: 39
Joined: Fri Mar 01, 2013 6:42 am

MatLab or LabVIEW drivers?

Post by Montezuma »

Are there any experimental or "alpha"/"beta" drivers for either MatLab, or LabVIEW?
mobius
Posts: 1
Joined: Wed Feb 26, 2014 1:03 pm

Re: MatLab or LabVIEW drivers?

Post by mobius »

have a pre-release. not supported by all the functionality. http://nuand.com/downloads/matlab.tar.gz
it has errors in piping mex functions. I've tried it, after correcting errors I made ​​it. I managed to gain, bandwidth, frequency, and received I / Q data.
yvesined
Posts: 5
Joined: Tue Mar 25, 2014 6:51 am
Location: Germany
Contact:

Re: MatLab or LabVIEW drivers?

Post by yvesined »

Hello,

I downloaded the matlab toolbox you referenced above and tried to compile it with Matlab 2011a executing compile.m and it didn't work:

lcc preprocessor error: bladerf_calibrate_dc.c:4 Could not find include file "libbladeRF.h"

Well I searched for that header and found it in the repository and added it to the building path and compiled again:

lcc preprocessor error: .\libbladeRF.h:25 bladerf_calibrate_dc.c:4 Could not find include file <stdint.h>
lcc preprocessor error: .\stdbool.h:5 .\libbladeRF.h:26 bladerf_calibrate_dc.c:4 Macro redefinition of true
lcc preprocessor error: .\stdbool.h:6 .\libbladeRF.h:26 bladerf_calibrate_dc.c:4 Macro redefinition of false

I would really like to use this toolbox, so could you provide a manual and all necessary libraries/headers to compile and use this toolbox with Matlab/Simulink.

Thanks,

Denis.
robert.ghilduta
Posts: 156
Joined: Thu Feb 28, 2013 11:14 pm

Re: MatLab or LabVIEW drivers?

Post by robert.ghilduta »

The Matlab files still need to get cleaned up. yvesined, you are on the right track with copying the appropriate libbladeRF.h file to the direction if the compiler can't find it. Is there anyway you can use MSVC as the compiler? If not let me know and I'll try to see I can do with lcc.
yvesined
Posts: 5
Joined: Tue Mar 25, 2014 6:51 am
Location: Germany
Contact:

Re: MatLab or LabVIEW drivers?

Post by yvesined »

By now this is no problem anymore as Rob has created a new revised repo for Matlab support: https://github.com/Nuand/bladeRF-matlab
Thank you! :P
Antti
Posts: 8
Joined: Fri Mar 01, 2013 4:16 am

Re: MatLab or LabVIEW drivers?

Post by Antti »

Is Matlab driver for osx compatible?
robert.ghilduta
Posts: 156
Joined: Thu Feb 28, 2013 11:14 pm

Re: MatLab or LabVIEW drivers?

Post by robert.ghilduta »

Antti,
I think compile.m should work on Mac as well. Maybe some of the paths are different?
What sort of error messages are you seeing?
yoshimifuj
Posts: 15
Joined: Wed May 07, 2014 8:59 pm

Re: MatLab or LabVIEW drivers?

Post by yoshimifuj »

Do I need MatLab compiler to use the MatLab driver?
Because the driver is uploaded as source code.
I don't have any MatLab compiler licence.
Is the pre-compiled version of the driver available?
yoshimifuj
Posts: 15
Joined: Wed May 07, 2014 8:59 pm

Re: MatLab or LabVIEW drivers?

Post by yoshimifuj »

Just to build MatLab interface, I'm not required to have MatLab compiler.
I just installed VisualStudio 2013 Professional.
However, the compiler detect an error says:

C:\Projects\RRP\bladeRF-matlab\bladerf_fw_version.c(19) : error C2120: void 型が他の型と同時に使われました。

The error message in Japanese means "the function return value seems to be void."
Do you have any suggestion to avoid this error?
yoshimifuj
Posts: 15
Joined: Wed May 07, 2014 8:59 pm

Re: MatLab or LabVIEW drivers?

Post by yoshimifuj »

Hello,
I downloaded, extracted matlab.tar.gz into a folder and copyed libbladeRF.h and bladeRF.lib to the folder.
Compilation finished successfully!

Thanks.
robert.ghilduta
Posts: 156
Joined: Thu Feb 28, 2013 11:14 pm

Re: MatLab or LabVIEW drivers?

Post by robert.ghilduta »

Hi Yoshimi,

There's more up to date code in https://github.com/Nuand/bladeRF-matlab . The Github branch is where all of the active development is happening.
Antti
Posts: 8
Joined: Fri Mar 01, 2013 4:16 am

Re: MatLab or LabVIEW drivers?

Post by Antti »

robert.ghilduta wrote:Antti,
I think compile.m should work on Mac as well. Maybe some of the paths are different?
What sort of error messages are you seeing?
Hi, this is what i get:
>> version

ans =

8.3.0.532 (R2014a)

>> compile

BLADERF_PATH =

/opt/local/include/


ARCH =

x86

Building with 'Xcode with Clang'.
/Users/xxx/Documents/MATLAB/bladeRF-matlab/bladerf_calibrate_dc.c:21:8: warning: implicit conversion from enumeration type 'bladerf_module' to different enumeration type 'bladerf_cal_module' [-Wenum-conversion]
mod = (bladerf_module)(*m_ptr);
~ ^~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

Error using mex
ld: warning: directory not found for option '-L/opt/local/include/libx86'
ld: warning: directory not found for option '-L/opt/local/include/x86'
ld: library not found for -lbladeRF
clang: error: linker command failed with exit code 1 (use -v to see invocation)


Error in compile (line 16)
eval(sprintf('mex bladerf_%s.c -I''%s\\include'' -Iinclude -L''%s\\lib\\%s'' -L''%s\\%s'' -lbladeRF', char(src(i)),
BLADERF_PATH, BLADERF_PATH, ARCH, BLADERF_PATH, ARCH))

>>
kkao
Posts: 6
Joined: Wed Jun 25, 2014 11:42 pm

Re: MatLab or LabVIEW drivers?

Post by kkao »

Hello,
I'm trying to compile the Matlab interface using source codes from git and tar file on Ubuntu 14.04.
http://nuand.com/downloads/matlab.tar.gz
https://github.com/Nuand/bladeRF-matlab

I modified only the following.
The version of gcc installed on Ubuntu 14.04 is 4.8, but Matlab supports only gcc 4.7, so I installed gcc 4.7.
The compile.m file we can get from git seems to support only Windows OS, so I used compile.m from the tar file as well even when compiling files from git.

Both of them caused some errors in the middle of compiling.
Do these errors mean mismatch of the version between the Matlab interface and the driver of bladeRF?
Would you give me some advice?

- files extracted from the tar file

Code: Select all

>> run compile
Building with 'gcc'.
MEX completed successfully.
Building with 'gcc'.
/home/xxx/Downloads/bladeRF_matlab/bladerf_close.c: In function ‘mexFunction’:
/home/xxx/Downloads/bladeRF_matlab/bladerf_close.c:16:6: warning: assignment makes pointer from integer without a cast [enabled by default]

MEX completed successfully.
Building with 'gcc'.
MEX completed successfully.
Building with 'gcc'.
/home/xxx/Downloads/bladeRF_matlab/bladerf_fw_version.c: In function ‘mexFunction’:
/home/xxx/Downloads/bladeRF_matlab/bladerf_fw_version.c:19:6: warning: assignment makes pointer from integer without a cast [enabled by default]

MEX completed successfully.
Building with 'gcc'.
MEX completed successfully.
Building with 'gcc'.
MEX completed successfully.
Building with 'gcc'.
/home/xxx/Downloads/bladeRF_matlab/bladerf_get_lna_gain.c: In function ‘mexFunction’:
/home/xxx/Downloads/bladeRF_matlab/bladerf_get_lna_gain.c:20:5: warning: passing argument 2 of ‘bladerf_get_lna_gain’ from incompatible pointer type [enabled by default]
In file included from /home/xxx/Downloads/bladeRF_matlab/bladerf_get_lna_gain.c:4:0:
/usr/local/include/libbladeRF.h:806:15: note: expected ‘enum bladerf_lna_gain *’ but argument is of type ‘int *’

MEX completed successfully.
Building with 'gcc'.
MEX completed successfully.
Building with 'gcc'.
MEX completed successfully.
Building with 'gcc'.
MEX completed successfully.
Building with 'gcc'.
MEX completed successfully.
Building with 'gcc'.
MEX completed successfully.
Building with 'gcc'.
MEX completed successfully.
Building with 'gcc'.
MEX completed successfully.
Building with 'gcc'.
/home/xxx/Downloads/bladeRF_matlab/bladerf_open.c: In function ‘mexFunction’:
/home/xxx/Downloads/bladeRF_matlab/bladerf_open.c:18:7: warning: assignment makes integer from pointer without a cast [enabled by default]

MEX completed successfully.
Building with 'gcc'.
Error using mex
/tmp/mex_25669251627649_7795/bladerf_rx.o: In function `mexFunction':
bladerf_rx.c:(.text+0x96): undefined reference to `bladerf_rx'
collect2: error: ld returned 1 exit status


Error in compile (line 16)
mex bladerf_rx.c -L. -lbladeRF

Error in run (line 63)
evalin('caller', [script ';']);
- files from git

Code: Select all

>> run compile
Building with 'gcc'.
MEX completed successfully.
Building with 'gcc'.
/home/xxx/Downloads/bladeRF_matlab_git/bladerf_close.c: In function ‘mexFunction’:
/home/xxx/Downloads/bladeRF_matlab_git/bladerf_close.c:16:6: warning: assignment makes pointer from integer without a cast [enabled by default]

MEX completed successfully.
Building with 'gcc'.
MEX completed successfully.
Building with 'gcc'.
Error using mex
/home/xxx/Downloads/bladeRF_matlab_git/bladerf_fw_version.c: In function ‘mexFunction’:
/home/xxx/Downloads/bladeRF_matlab_git/bladerf_fw_version.c:18:6: warning: assignment makes pointer from integer
without a cast [enabled by default]
/home/xxx/Downloads/bladeRF_matlab_git/bladerf_fw_version.c:19:2: warning: passing argument 1 of ‘bladerf_version’
from incompatible pointer type [enabled by default]
In file included from /home/xxx/Downloads/bladeRF_matlab_git/bladerf_fw_version.c:4:0:
/usr/local/include/libbladeRF.h:1944:16: note: expected ‘struct bladerf_version *’ but argument is of type ‘struct
bladerf *’
/home/xxx/Downloads/bladeRF_matlab_git/bladerf_fw_version.c:19:2: error: too many arguments to function
‘bladerf_version’
In file included from /home/xxx/Downloads/bladeRF_matlab_git/bladerf_fw_version.c:4:0:
/usr/local/include/libbladeRF.h:1944:16: note: declared here
/home/xxx/Downloads/bladeRF_matlab_git/bladerf_fw_version.c:19:6: error: void value not ignored as it ought to be


Error in compile (line 4)
mex bladerf_fw_version.c -L. -lbladeRF

Error in run (line 63)
evalin('caller', [script ';']);
bpadalino
Posts: 303
Joined: Mon Mar 04, 2013 4:53 pm

Re: MatLab or LabVIEW drivers?

Post by bpadalino »

What this looks like is that the MATLAB driver has suffered a bit of rot in terms of the libbladeRF API and is trying to use functions which don't exist anymore.

I have just posted the issue to github to mark it down that we need to address this issue.

Currently we're on a push to get a stable library built up with a stable API so this won't happen again, so pull requests are welcome when it comes to modernizing the MATLAB driver for the current/more stable API. Also note that using the synchronous interface is probably the better way to get samples in/out of the device.

Sorry for the inconvenience.
kkao
Posts: 6
Joined: Wed Jun 25, 2014 11:42 pm

Re: MatLab or LabVIEW drivers?

Post by kkao »

Thank you for your reply. Sorry my reply is late.
I suppose you may be adapting the matlab Interface to the latest driver.
As far as I can see, the current matlab interface does not include any functions for transmitting.
I'd like the matlab interface by which we can transmit and receive simultaneously. Are you currently making such an interface?
If the next version of matlab interface that can transmit will be released soon, I'd like to use it.
However, I'm trying to make a matlab interface using the following sample codes which are written in C in case it will take a little more time to be released.
https://github.com/Nuand/bladeRF/tree/0 ... t_sync/src

If some threads for transmitting and receiving process can be spawned by a mex-file like the sample codes, I think I can transmit and receive at the same time without consideration on the timing of transmitting or receiving at the invoker side, i.e. m-file.
Is it possible to make such a mex-file? Would you give me any advice if you already have some experience?
Post Reply