Page 1 of 1

Bug in Matlab driver - TX

Posted: Wed Dec 10, 2014 11:13 am
by Michael
Hi, all!

I found a bug in Matlab driver for bladeRF
Here: https://github.com/Nuand/Simulink-MATLA ... rf_dev.cpp , line 188 - CHECK_BUF_LENGTH (BUF_LENGTH );
BUF_LENGTH == TX_DATA (see lines 42 and 43)
So in TX mode line 188 asserts that the real value of the first IQ must be positive, otherwise you get a message:
Error using bladerf_dev
Buffer Length must be numeric and greater zero

So this example: https://github.com/Nuand/Simulink-MATLA ... lay_demo.m always crashes

Re: Bug in Matlab driver - TX

Posted: Thu Dec 11, 2014 6:35 pm
by yoshimifuj
I encountered this problem, too and changed the C source code as follows.
/* check input */
CHECK_DEVICE_INDEX(DEVICE_INDEX);
CHECK_BANDWIDTH (BANDWIDTH );
CHECK_SAMPLE_RATE (SAMPLE_RATE );
CHECK_FREQUENCY (FREQUENCY );
// The following line has moved into 'if' statement.
// CHECK_BUF_LENGTH (BUF_LENGTH );

rx = 1;
if (mxGetString(DEVICE_MODE, (char *)&mode, 3)) {
rx = 1;
CHECK_BUF_LENGTH (BUF_LENGTH );
} else {
if (!strcmp(mode, "TX"))
rx = 0;
}
Would you confirm this change?

Re: Bug in Matlab driver - TX

Posted: Mon Dec 15, 2014 1:37 am
by robert.ghilduta
Thanks for the report Michael and thanks for the patch Yoshimi!

The bug fix has been committed to Github. We'll update the windows binary installer with the fix soon.