bladeRF-cli can't connect first time

Having issues with the site, hardware, source code, or any other issues?
Post Reply
nipunamr
Posts: 21
Joined: Sat Sep 08, 2018 2:05 pm

bladeRF-cli can't connect first time

Post by nipunamr »

When I run the BladeRF-cli program, it fails to connect the first time, the second time it works. Why is this happening.

To troubleshoot, I opened a "cmd" window and typed "bladeRF-cli -I" and I get the following output -

"Failed to open device (first available): Operation not supported

Then if I type it again, it works fine- I get the bladeRF prompt;

bladeRF>

Any idea why it's happening?

Thanks
User avatar
rtucker
Posts: 77
Joined: Sun Jan 25, 2015 10:38 am

Re: bladeRF-cli can't connect first time

Post by rtucker »

Greetings!

Could you try this again, with the "-v verbose" option on the command line? Also, if you could include the output of the "version" command when bladeRF-cli does successfully open, that would be helpful as well :)

Thanks! -rt
Rey Tucker (she/her)
Systems Engineer, Nuand LLC
Rochester, NY, USA

#WontBeErased
nipunamr
Posts: 21
Joined: Sat Sep 08, 2018 2:05 pm

Re: bladeRF-cli can't connect first time

Post by nipunamr »

When I run bladeRF from command life using the following command I get the following

C:\>bladeRF-cli -v verbose
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/libusb.c:600] Using libusbversion: 1.0.21.11156
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/libusb.c:477] Found a bladeRF (idx=3)
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/libusb.c:367] Mutex name: Global\bladeRF-e4a109238e74dfe563300936c6017bb5
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/usb.c:106] Changing to USBalt setting 0
[VERBOSE @ host/libraries/libbladeRF/src/board/bladerf1/bladerf1.c:779] Read Firmware version: 2.0.0
[VERBOSE @ host/libraries/libbladeRF/src/board/bladerf1/bladerf1.c:787] Capability mask before FPGA load: 0x0000000700000000
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/usb.c:106] Changing to USBalt setting 2
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/usb.c:106] Changing to USBalt setting 1
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/usb.c:106] Changing to USBalt setting 2
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/usb.c:106] Changing to USBalt setting 1
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/usb.c:106] Changing to USBalt setting 1
[VERBOSE @ host/libraries/libbladeRF/src/board/bladerf1/bladerf1.c:505] Read FPGA version: 0.7.3
[VERBOSE @ host/libraries/libbladeRF/src/board/bladerf1/bladerf1.c:510] Capability mask after FPGA load: 0x00000007000007ff
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/nios_access.c:392] nios_config_read: Read 0x00180057
[DEBUG @ host/libraries/libbladeRF/src/board/bladerf1/bladerf1.c:369] Default tuning mode: FPGA
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/nios_access.c:982] Clearing RX1 retune queue.
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/nios_access.c:1005] RX1 operation duration: 0
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/nios_access.c:982] Clearing TX1 retune queue.
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/nios_access.c:1005] TX1 operation duration: 0
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/nios_access.c:1054] RX1 trigger read value 0x08
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/nios_access.c:1054] RX1 trigger read value 0x08
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/nios_access.c:1092] RX1 trigger write value 0x00
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/nios_access.c:1054] TX1 trigger read value 0x08
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/nios_access.c:1054] TX1 trigger read value 0x08
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/nios_access.c:1092] TX1 trigger write value 0x00
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/nios_access.c:982] Clearing RX1 retune queue.
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/nios_access.c:1005] RX1 operation duration: 0
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/nios_access.c:982] Clearing TX1 retune queue.
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/nios_access.c:1005] TX1 operation duration: 0


Then when I run two time and get it to work, I get the following versions

bladeRF> version

bladeRF-cli version: 1.6.0
libbladeRF version: 2.0.0

Firmware version: 2.0.0
FPGA version: 0.7.3

bladeRF>

Then I disconnected the bladedRF and reconnected and ran the following command twice to get baldeRF working,

C:\Users\Administrator>bladeRF-cli -i
Failed to open device (first available): Operation not supported

C:\Users\Administrator>bladeRf-cli -i
bladeRF> info

Board: bladerf1
Serial #: e4a109238e74dfe563300936c6017bb5
VCTCXO DAC calibration: 0x91b1
FPGA size: 115 KLE
FPGA loaded: yes
USB bus: 1
USB address: 11
USB speed: SuperSpeed
Backend: libusb
Instance: 0




-------------------------------------------------------------------
I am also trying to get it to work with Matlab and when I run the GUI I get the following error

>> bladeRF rx.gui
Error using bladeRF.check_status (line 116)
libbladeRF error (-3) in bladeRF_open(): Invalid operation or parameter

Error in bladeRF (line 398)
bladeRF.check_status('bladeRF_open', status);

Then I ran the "bladeRF.m" file and I get the following

>> bladeRF
Cannot enable AGC. AGC DC LUT file is missing, run `cal table agc rx' in bladeRF-cli.

ans =

bladeRF with properties:

rx: [1×1 bladeRF_XCVR]
tx: [1×1 bladeRF_XCVR]
vctcxo: [1×1 bladeRF_VCTCXO]
misc: [1×1 bladeRF_Misc]
loopback: 'NONE'
info: [1×1 struct]
versions: [1×1 struct]
xb: 'None'

I haven't run the "cal" yet. Any help is much appreciated.

Thanks
User avatar
rtucker
Posts: 77
Joined: Sun Jan 25, 2015 10:38 am

Re: bladeRF-cli can't connect first time

Post by rtucker »

G'day,

It looks like you're running an early release candidate version of 2018.08, and there are a number of bugs that are fixed (including the erroneous AGC DC LUT file error). Please install the 2018.08 package from https://www.nuand.com/win_installers/ and see if it works better for you overall.

If it doesn't help with the original problem, try disconnecting and reconnecting the device again and running: "bladeRF-cli -v verbose -i" ... I'm hoping to catch the verbose log output from when it is failing on the first open attempt.

Thanks! -rt
Rey Tucker (she/her)
Systems Engineer, Nuand LLC
Rochester, NY, USA

#WontBeErased
nipunamr
Posts: 21
Joined: Sat Sep 08, 2018 2:05 pm

Re: bladeRF-cli can't connect first time

Post by nipunamr »

I installed the new BladeRF executable and I installed the new Firmware version (2.2.0). It now works the first time but I still get the AGC error when I run from Matlab.

Here's what I get when I run the version command from bladeRF-cli -i

C:\>bladeRF-cli -i
bladeRF> version

bladeRF-cli version: 1.6.1
libbladeRF version: 2.0.2

Firmware version: 2.2.0-git-3d38fac2
FPGA version: 0.7.3

bladeRF> info

Board: bladerf1
Serial #: e4a109238e74dfe563300936c6017bb5
VCTCXO DAC calibration: 0x91b1
FPGA size: 115 KLE
FPGA loaded: yes
USB bus: 1
USB address: 11
USB speed: SuperSpeed
Backend: libusb
Instance: 0

bladeRF>

If I open another terminal and run the "verbose" command I get the following.

C:\>bladeRF-cli -v verbose
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/libusb.c:604] Using libusbversion: 1.0.21.11156
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/libusb.c:481] Found a bladeRF (idx=3)
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/libusb.c:371] Mutex name: Global\bladeRF-e4a109238e74dfe563300936c6017bb5
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/usb.c:106] Changing to USBalt setting 0
[VERBOSE @ host/libraries/libbladeRF/src/board/bladerf1/bladerf1.c:778] Read Firmware version: 2.2.0-git-3d38fac2
[VERBOSE @ host/libraries/libbladeRF/src/board/bladerf1/bladerf1.c:787] Capability mask before FPGA load: 0x0000000700000000
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/usb.c:106] Changing to USBalt setting 2
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/usb.c:106] Changing to USBalt setting 1
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/usb.c:106] Changing to USBalt setting 2
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/usb.c:106] Changing to USBalt setting 1
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/usb.c:106] Changing to USBalt setting 1
[VERBOSE @ host/libraries/libbladeRF/src/board/bladerf1/bladerf1.c:505] Read FPGA version: 0.7.3
[VERBOSE @ host/libraries/libbladeRF/src/board/bladerf1/bladerf1.c:510] Capability mask after FPGA load: 0x00000007000007ff
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/nios_access.c:392] nios_config_read: Read 0x00190057
[DEBUG @ host/libraries/libbladeRF/src/board/bladerf1/bladerf1.c:369] Default tuning mode: FPGA
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/nios_access.c:982] Clearing RX1 retune queue.
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/nios_access.c:1005] RX1 operation duration: 150
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/nios_access.c:982] Clearing TX1 retune queue.
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/nios_access.c:1005] TX1 operation duration: 151
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/nios_access.c:1054] RX1 trigger read value 0x08
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/nios_access.c:1054] RX1 trigger read value 0x08
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/nios_access.c:1092] RX1 trigger write value 0x00
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/nios_access.c:1054] TX1 trigger read value 0x08
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/nios_access.c:1054] TX1 trigger read value 0x08
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/nios_access.c:1092] TX1 trigger write value 0x00
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/nios_access.c:982] Clearing RX1 retune queue.
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/nios_access.c:1005] RX1 operation duration: 150
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/nios_access.c:982] Clearing TX1 retune queue.
[VERBOSE @ host/libraries/libbladeRF/src/backend/usb/nios_access.c:1005] TX1 operation duration: 150

C:\>

So far it works in the "bladeRF-cli -i" program
-----------------------------------------------------------------------------------------

Then I ran the Matlab gui for BladeRF; The GUI opens, however, I get a warning (the same as before)

>> bladeRF_rx_gui
Cannot enable AGC. AGC DC LUT file is missing, run `cal table agc rx' in bladeRF-cli.

Then I tried to run the "cal" command from the "bladeRF-cli program" and I am getting an error.

C:\>bladeRF-cli -i
bladeRF> cal table agc rx
Calibrated @ 237500000 Hz: I= 160 (Error: 3.97), Q= -32 (Error: 1.75) DC-L
Calibrated @ 247500000 Hz: I= 160 (Error: 2.46), Q= -32 (Error: 1.23) DC-L
Calibrated @ 257500000 Hz: I= 160 (Error: 0.01), Q= -32 (Error: 2.10) DC-L
Calibrated @ 267500000 Hz: I= 160 (Error: 2.38), Q= -32 (Error: 1.29) DC-L
Calibrated @ 277500000 Hz: I= 160 (Error: 3.49), Q= -32 (Error: 4.69) DC-L
Calibrated @ 287500000 Hz: I= 160 (Error: 2.16), Q= -32 (Error: 1.68) DC-L
Calibrated @ 297500000 Hz: I= 160 (Error: 0.59), Q= -64 (Error: 4.38) DC-L
Calibrated @ 307500000 Hz: I= 32 (Error: 3.51), Q= 32 (Error: 1.56) DC-L
UT: Max (I= 4, Q= 1) Mid (I= 23, Q= 26) Min (I= 31, Q= 27)

Error: An unexpected error occurred

bladeRF> cal table agc rx
Calibrated @ 237500000 Hz: I= 32 (Error: 4.10), Q= 32 (Error: 0.76) DC-L
UT: Max (I= 3, Q= 1) Mid (I= 23, Q= 27) Min (I= 28, Q= 21)

Error: An unexpected error occurred

bladeRF> cal table agc rx
Calibrated @ 237500000 Hz: I= 32 (Error: 3.75), Q= 32 (Error: 1.42) DC-L
UT: Max (I= 4, Q= 2) Mid (I= 23, Q= 27) Min (I= 31, Q= 27)

Error: An unexpected error occurred

bladeRF>

Can you help troubleshoot the issue? Am I running an old bladeRF_rx_gui.m program (I am running Matlab2018a)

I have also noticed don't have access to LNA, rxvga1, rxvga2 gains as in the bladeRF matlab installation (although I have access to them from sdrSharp)

Any help is much appreciated.

What I eventually want to do is to record the I & Q to a file and post process or real time process it. May be I need to write my own C++/C# program. Any ideas?

Thanks
User avatar
rtucker
Posts: 77
Joined: Sun Jan 25, 2015 10:38 am

Re: bladeRF-cli can't connect first time

Post by rtucker »

Hmm. I wonder if MATLAB is still using the old DLL? If I'm reading the .m file correctly,

Code: Select all

b = bladeRF();
b.misc.versions
will get you a structure with the libbladeRF version in use, among others.

For manually controlling the RX gain, you'll need to disable the AGC (b.rx.agc = false) first, otherwise gain cannot be adjusted. You may also want to look at using b.rx.gain instead of manually adjusting the gain stages; for reference, a setting of b.rx.gain = 60 will be maximum RX gain on all bladeRF products. (See the Gain Control Improvements section in the libbladeRF 2.x release notes, and also the API documentation for bladerf_set_gain())

If your goal is simply recording to a file, though, bladeRF-cli will do it:

Code: Select all

bladeRF> set frequency rx 98M

  RX1 Frequency:   97999998 Hz

bladeRF> set samplerate rx 30.72M

  Setting RX1 sample rate - req:  30720000 0/1Hz, actual:  30720000 0/1Hz

bladeRF> rx config file=foo.csv format=csv n=30720000 channel=1
bladeRF> rx start
bladeRF> rx
This will produce a foo.csv containing one second of samples at 30.72M samples/sec, centered around 98 MHz:

Code: Select all

$ head foo.csv 
-124, -85
-28, 2
11, -98
73, -71
50, -99
-89, -224
-113, -129
-60, -109
-153, -145
-173, -249
Rey Tucker (she/her)
Systems Engineer, Nuand LLC
Rochester, NY, USA

#WontBeErased
nipunamr
Posts: 21
Joined: Sat Sep 08, 2018 2:05 pm

Re: bladeRF-cli can't connect first time

Post by nipunamr »

When I run,

b.versions.libbladeRF

I get the following, I get

'2.0.2' is that correct?

Where do I get an error when I try to caliberate?
Where is the libbladeRF dll?
nipunamr
Posts: 21
Joined: Sat Sep 08, 2018 2:05 pm

Re: bladeRF-cli can't connect first time

Post by nipunamr »

I need to save I &Q data with certain frequencies with time stamps. I need to be able to configure the bladeRF and hit "start" and let it collect I &Q and timestamp them every 1ms or until I hit "stop". I don't think "rx config file=samples.csv format=csv n=10M" will work since I don't know how long I'll need to record the data. What would be the best/easiest way to do it?

Any ideas are much appreciated
Thanks
bglod
Posts: 201
Joined: Thu Jun 18, 2015 6:10 pm

Re: bladeRF-cli can't connect first time

Post by bglod »

To my knowledge, the samples are not stored with associated timestamps. It's possible to do, but you'd have to modify the HDL and some parts of libbladeRF/bladeRF-cli to handle it. If the timestamps don't need to be exactly matched up with the samples, you could periodically read the current timestamp value, or you can use the host machine's current time.

You could write "n=0" and it will keep writing samples to that file until you run out of space on your hard drive. You could also edit the HDL to discard samples until you see a certain event, but that would require you to do all the processing on the FPGA. Another option (for Linux, not sure about Windows) is using a FIFO / named pipe. Instead of MATLAB, you could try GNU Radio, so it streams the samples in and only starts saving them once you hit your trigger condition. I don't know if you will find any of that helpful though...

https://github.com/Nuand/bladeRF/wiki/b ... of-samples
Electrical Engineer
Nuand, LLC.
nipunamr
Posts: 21
Joined: Sat Sep 08, 2018 2:05 pm

Re: bladeRF-cli can't connect first time

Post by nipunamr »

Thank you for your reply.

I assume the minimum bandwidth is 1.5 MHz. Let's say I am operating around 800 MHz and sampling at 4 MSPS. I think center frequency shouldn't matter in this case. Assuming each I an Q is 4 Bytes (Is it true?). Then every seconds it creates 32 MBytes (4*8). For a minute it will create 1.92GB. I guess I need to listen for about an hour. It's a lot of data but I think I can handle it.

I guess my question is, can I ask "bladeRF-cli -i" program to send me I & Q samples every 200ms? Then I time stamp the I & Q data and write to a file and go to the next samples.

If you can't do it, can you do it using bladeRF.dll without touching the FPGA code?
UZ30
Posts: 1
Joined: Sat Sep 15, 2018 4:02 am

Re: bladeRF-cli can't connect first time

Post by UZ30 »

greetings

am trying to specify a frequency range i want to use and i am failing to do so am new to this am using bladeRF-cli.
any ideas. thank you
nipunamr
Posts: 21
Joined: Sat Sep 08, 2018 2:05 pm

Re: bladeRF-cli can't connect first time

Post by nipunamr »

You can first type in "BladeRF-cli -i" then you will get the BladeRF> prompt. Then you can follow set frequency and set bandwidth commands. "set frequency" will set the carrier/center frequency and "set bandwidth" will set your frequency range. Here's an example,

bladeRF> set frequency tx 925M

Set TX frequency: 925000000Hz

bladeRF> set samplerate tx 2M

Setting TX sample rate - req: 2000000 0/1Hz, actual: 2000000 0/1Hz

bladeRF> set bandwidth tx 1.5M

Set TX bandwidth - req: 1500000Hz actual: 1500000Hz

bladeRF> set txvga1 -10
bladeRF> set txvga2 0


bladeRF> set bandwidth tx 1.5M

Set TX bandwidth - req: 1500000Hz actual: 1500000Hz

bladeRF> set txvga1 -10
bladeRF> set txvga2 0

You can follow the tutorial below.

https://github.com/Nuand/bladeRF/wiki/G ... ng_Samples

Thanks.
bglod
Posts: 201
Joined: Thu Jun 18, 2015 6:10 pm

Re: bladeRF-cli can't connect first time

Post by bglod »

UZ30 wrote: Sat Sep 15, 2018 4:18 am greetings

am trying to specify a frequency range i want to use and i am failing to do so am new to this am using bladeRF-cli.
any ideas. thank you
While I'm glad OP was able to help you out, please create a new thread if you have an unrelated question. This helps keep topics on track and doesn't steal focus away from the OP's question. Thanks!
nipunamr wrote: I assume the minimum bandwidth is 1.5 MHz. Let's say I am operating around 800 MHz and sampling at 4 MSPS. I think center frequency shouldn't matter in this case. Assuming each I an Q is 4 Bytes (Is it true?). Then every seconds it creates 32 MBytes (4*8). For a minute it will create 1.92GB. I guess I need to listen for about an hour. It's a lot of data but I think I can handle it.
Each "sample" is composed of an I sample and a Q sample, each of which are 12-bits padded out to 16 bits. A full sample (1 I+Q pair) is 24 bits of actual data padded out to 32 bits (4 bytes). If you sample at 4 MSPS, that's 4e6 samples/s * 4 bytes = 16 Mbyte/s if stored in a binary file format.
nipunamr wrote: I guess my question is, can I ask "bladeRF-cli -i" program to send me I & Q samples every 200ms? Then I time stamp the I & Q data and write to a file and go to the next samples.
I suppose you could, but I wouldn't recommend it because you're likely to miss samples. You're perhaps better off using the libbladeRF API directly in your own program. Of course this requires that you manage your memory and perform the analysis on each buffer so you know whether to discard it or keep it, but it would result in a cleaner solution. You may find it easier to use GNU Radio, though.
Electrical Engineer
Nuand, LLC.
nipunamr
Posts: 21
Joined: Sat Sep 08, 2018 2:05 pm

Re: bladeRF-cli can't connect first time

Post by nipunamr »

Thanks for your reply. Let me try to figure out how to use libbladeRF API. I am pretty sure I will have more questions. :D
Post Reply