MatLab or LabVIEW drivers?

Discussions related to embedded firmware, driver, and user mode application software development
Post Reply
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