[WIP] kb3gtn's bladeRF libusb setup guide (ubuntu 13.04)

Follow our development of DSP and SDR tutorials
Post Reply
kb3gtn
Posts: 10
Joined: Sat Aug 03, 2013 10:46 pm

[WIP] kb3gtn's bladeRF libusb setup guide (ubuntu 13.04)

Post by kb3gtn »

Building Instructions for Ubuntu 13.04

newer up-to-date install documentation:
https://github.com/Nuand/bladeRF/wiki

modify for your needs as needed for your distro..

-- build libusb tools and libraries from Nuand --
* Clone the libusb support branch to your system

Code: Select all

git clone https://github.com/Nuand/bladeRF.git bladeRF -b dev-libusb_support
* Install dependent packages for the build:

Code: Select all

sudo apt-get install libusb-1.0-0-dev libusb-1.0-0 build-essential cmake libncurses5-dev
* building the libusb stuff

Code: Select all

cd <git_base_dir>/hosts/
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=debug -DINSTALL_UDEV_RULES=ON -DCMAKE_INSTALL_PREFIX=/opt/bladeRF/ ../
make
sudo make install
* Update library paths
sudo vi /etc/ld.so.conf.d/bladeRF.conf

Code: Select all

/opt/bladeRF/lib/
now run "sudo ldconfig" to update library paths

* Initial firmware loading & fpga loading procedure
Assuming you added /opt/bladeRF/bin to your path or system path. (not covered here, just google it.. )
See if you can detect your bladeRF:

Code: Select all

bladerf-cli -p
Should return something that looks like:

Code: Select all

    Backend: libusb
    Serial: <Not yet supported> | a serial number  depending on FPGA version
    USB Bus: 6
    USB Address: 4
Then load the FX3 firmware. Note: you only need to do this once.. It's stored in flash, and survives power cycling. The FPGA image, needs to be loaded every time.

Code: Select all

bladerf-cli -f <firmware.img>
Load FPGA

Code: Select all

bladerf-cli -l <fpga.rbf>
Recommended firmware and FPGA images to use:
FX3 Image: http://nuand.com/fx3/latest.img
FPGA: http://nuand.com/fpga

The BladeRF at this point should be ready to go.. Now you just need something to talk to it.. Gnu Radio is a good candidate..

*** Building GNURADIO from GIT ***
* Use gnuradio-build to pull and check dependencies

Code: Select all

$ cd ~/sandbox
$ mkdir gnuradio-builds
$ cd gnuradio-builds
$ wget http://www.sbrac.org/files/build-gnuradio
$ chmod +x ./build-gnuradio.sh
$ ./build-gnuradio.sh -m prereqs gitfetch
This takes a while... check top, seems like it sits a long time on checking prerequisits with no output.

* now compile up GNU Radio

Code: Select all

$ cd ~/sandobx/gnuradio-builds/gnuradio/
$ mkdir build
$ cd build
$ cmake -DCMAKE_INSTALL_PREFIX=/opt/gnuradio-3.7.1git  ../ (based on git release, change as needed)
$ make
( This is a large build and will take some time.. good time to take a break..)

Code: Select all

$ sudo make install
Now for some voodoo to get the new program installed into system libraries and python paths and executable path.
With your favorite text editor.. ( vim :-P ) create a new file call /etc/profile.d/gnuradio.sh
you will need sudo for this...

Code: Select all

sudo vi /etc/profile.d/gnuradio.sh
Put the following into it:

Code: Select all

#!/bin/bash
# add gnuradio and bladerf stuff to path
export PATH=$PATH:/opt/gnuradio-3.7.1git/bin:/opt/bladeRF/
# add gnuradio python libraries to python search path
if [ $PYTHONPATH ]; then
        export PYTHONPATH=$PYTHONPATH:/opt/gnuradio-3.7.1git/lib/python2.7/dist-packages
else
        export PYTHONPATH=/opt/gnuradio-3.7.1git/lib/python2.7/dist-packages
fi
update path above if you deviated from gnuradio-3.7.1git
note: If your on some non-debian based distro, you might need to replace "dist-packages" with "site-packages".

Again, with your favorite text editor, create a new file call /etc/ld.so.conf.d/gnuradio.conf
you will need sudo for this again.. (one line file)

Code: Select all

$ sudo vi /etc/ld.so.conf.d/gnuradio.conf
Put this in the new file:

Code: Select all

/opt/gnuradio-3.7.1git/lib
(note:) on some 64 bit systems, you might need a lib64 directory in this file as well?

* now update your library cache

Code: Select all

$ sudo ldconfig -v | grep gnuradio
should see this or something simular..

Code: Select all

/opt/gnuradio-3.7.1git/lib:
        libgnuradio-atsc-3.7.1git.so.0.0.0 -> libgnuradio-atsc.so
        libgnuradio-trellis-3.7.1git.so.0.0.0 -> libgnuradio-trellis.so
        libgnuradio-analog-3.7.1git.so.0.0.0 -> libgnuradio-analog.so
        libgnuradio-pager-3.7.1git.so.0.0.0 -> libgnuradio-pager.so
        libgnuradio-vocoder-3.7.1git.so.0.0.0 -> libgnuradio-vocoder.so
        libgnuradio-video-sdl-3.7.1git.so.0.0.0 -> libgnuradio-video-sdl.so
        libgnuradio-pmt-3.7.1git.so.0.0.0 -> libgnuradio-pmt.so
        libgnuradio-noaa-3.7.1git.so.0.0.0 -> libgnuradio-noaa.so
        libgnuradio-filter-3.7.1git.so.0.0.0 -> libgnuradio-filter.so
        libgnuradio-digital-3.7.1git.so.0.0.0 -> libgnuradio-digital.so
        libgnuradio-channels-3.7.1git.so.0.0.0 -> libgnuradio-channels.so
        libgnuradio-qtgui-3.7.1git.so.0.0.0 -> libgnuradio-qtgui.so
        libgnuradio-wxgui-3.7.1git.so.0.0.0 -> libgnuradio-wxgui.so
        libgnuradio-fec-3.7.1git.so.0.0.0 -> libgnuradio-fec.so
        libgnuradio-wavelet-3.7.1git.so.0.0.0 -> libgnuradio-wavelet.so
        libgnuradio-fcd-3.7.1git.so.0.0.0 -> libgnuradio-fcd.so
        libgnuradio-blocks-3.7.1git.so.0.0.0 -> libgnuradio-blocks.so
        libgnuradio-fft-3.7.1git.so.0.0.0 -> libgnuradio-fft.so
        libgnuradio-runtime-3.7.1git.so.0.0.0 -> libgnuradio-runtime.so
        libgnuradio-audio-3.7.1git.so.0.0.0 -> libgnuradio-audio.so
If so.. All is good.

you will now need to logout and log back in for the profile.d settings to take effect.
Once you have logged back in to your desktop, you should be able to run gnuradio-companion.
If you get a pop up about PYTHONPATH or LD_LIBRARY_PATH, check env to see if the python path or ldconfig returns the correct libraries.

--- build for gr-osmosdr ---
* Pull the git version of gr-osmosdr, build, install

Code: Select all

$ cd ~/sandbox
$ git clone git://git.osmocom.org/gr-osmosdr ./gr-osmosdr
$ mkdir ~/sandbox/gr-osmosdr/build
$ cd ~/sandbox/gr-osmosdr/build
$ cmake -DLIBBLADERF_PKG_INCLUDE_DIRS=/opt/bladeRF/include/ -DLIBBLADERF_PKG_LIBRARY_DIRS=/opt/bladeRF/lib/ -DCMAKE_INSTALL_PREFIX=/opt/gnuradio-3.7.1git ../  (change as needed)
$ make
$ sudo make install

simple test applications to verify device operation
shaun_tx wrote a nice little bash script to do some sample captures with bladerf-cli check it out: https://github.com/Nuand/bladeRF/issues ... t-22814848
Last edited by kb3gtn on Sat Oct 05, 2013 6:36 pm, edited 5 times in total.
yingerj
Posts: 1
Joined: Fri Mar 01, 2013 9:08 am

Re: [WIP] kb3gtn's bladeRF libusb setup guide (ubuntu 13.04)

Post by yingerj »

I'm running plain old 13.04 and i had to also install libncurses5-dev to get make to compile bladeRF-cli. It couldn't hurt to add this to your dependencies install list.

Code: Select all

sudo apt-get install libncurses5-dev
Thanks for the guide! I'll update with any other bits I come across.
kb3gtn
Posts: 10
Joined: Sat Aug 03, 2013 10:46 pm

Re: [WIP] kb3gtn's bladeRF libusb setup guide (ubuntu 13.04)

Post by kb3gtn »

Thanks.. Missed that one.. Was already install on my box.. Thus I didn't notice it..
rowan.doherty
Posts: 12
Joined: Fri Mar 01, 2013 4:32 am

Re: [WIP] kb3gtn's bladeRF libusb setup guide (ubuntu 13.04)

Post by rowan.doherty »

Thanks for the guide. :)
I've got my board communicating with my computer, but still haven't managed to get samples out of it (still learning how to do that).
kb3gtn
Posts: 10
Joined: Sat Aug 03, 2013 10:46 pm

Re: [WIP] kb3gtn's bladeRF libusb setup guide (ubuntu 13.04)

Post by kb3gtn »

if you build the gr-osmosdr stuff. You get a signal generator and a spectrum display test program..

Receive:
osmocom_fft -s 8000000 -f 446000000 -g 60

Transmit: Make a 25 KHz tone offset from 446e6 MHz LO
osmocom_siggen -s 8000000 -g 4 -f 446000000 --sine -x 25000

I don't think you can run them both at the same time.. Don't connect TX to RX.
schrambo
Posts: 16
Joined: Sat Mar 02, 2013 1:33 am
Location: Perth, Western Australia

Re: [WIP] kb3gtn's bladeRF libusb setup guide (ubuntu 13.04)

Post by schrambo »

Hi,

I have just received my bladeRF and in the middle of testing / configuring it out.
I have come accross two other dependencies needed to compile the bladeRF_cli that are not noted in the above guide.
- Doxygen
- libtec1al-dev

I'm currently running Linux Mint 15. but just an "apt-cache search <searchfield>" to find your particular package name for your distro.
dk5ras
Posts: 70
Joined: Fri Mar 01, 2013 3:23 am

Re: [WIP] kb3gtn's bladeRF libusb setup guide (ubuntu 13.04)

Post by dk5ras »

Git tells me that it can not interpret the "dev-libusb_support" and uses "head" instead. Did the repo change to libusb by default?

Ralph.
bpadalino
Posts: 303
Joined: Mon Mar 04, 2013 4:53 pm

Re: [WIP] kb3gtn's bladeRF libusb setup guide (ubuntu 13.04)

Post by bpadalino »

Yes - the default is now to use libusb. Also note there is a Wiki with instructions on Github which might make updating them a bit easier.
dk5ras
Posts: 70
Joined: Fri Mar 01, 2013 3:23 am

Re: [WIP] kb3gtn's bladeRF libusb setup guide (ubuntu 13.04)

Post by dk5ras »

bpadalino wrote:Yes - the default is now to use libusb. Also note there is a Wiki with instructions on Github which might make updating them a bit easier.
OK, great; this is in parts similar to what I already have managed during todays lunch break, leaving out the gnuradio stuff as I have this already installed, so I should be successful this evening in completing the installation with downloading the FPGA image and compiling gr-osmosdr :)

Ralph.
carrotface013
Posts: 2
Joined: Mon Feb 24, 2014 5:47 pm

Re: [WIP] kb3gtn's bladeRF libusb setup guide (ubuntu 13.04)

Post by carrotface013 »

What is meant by "Assuming you added /opt/bladeRF/bin to your path or system path."?
How do I know if I have done this or not?
jynik
Posts: 455
Joined: Thu Jun 06, 2013 8:15 pm

Re: [WIP] kb3gtn's bladeRF libusb setup guide (ubuntu 13.04)

Post by jynik »

carrotface013 wrote:What is meant by "Assuming you added /opt/bladeRF/bin to your path or system path."?
How do I know if I have done this or not?
Assuming you're using bash, echo $PATH. Items you've added to your binary search path in your .bashrc or via the system wide configurations (e.g., /etc/profile.d/ items) should appear in the list. Library search paths are configured via the ldconfig command and items in the /etc/ld.so.conf.d/ directory).

Note that this thread is very dated. The details here have been migrated to the "Getting Started" guides on the wiki. If you run into problems with those guides on the wiki, feel free to ask questions on IRC or start a new thread in the Troubleshooting forum.

Note that the Troubleshooting wiki page also has some common "gotchas" and issues people encounter.
andrew77
Posts: 29
Joined: Mon Mar 02, 2015 2:02 pm

Re: [WIP] kb3gtn's bladeRF libusb setup guide (ubuntu 13.04)

Post by andrew77 »

Unfortunately I couldn't build this version of gnuradio because:

sudo -u giorgio ./build-gnuradio -m prereqs gitfetch

This script will install Gnu Radio from current GIT sources
You will require Internet access from the computer on which this
script runs. You will also require SUDO access. You will require
approximately 500MB of free disk space to perform the build.

This script will, as a side-effect, remove any existing Gnu Radio
installation that was installed from your Linux distribution packages.
It must do this to prevent problems due to interference between
a linux-distribution-installed Gnu Radio/UHD and one installed from GIT source.

The whole process may take up to two hours to complete, depending on the
capabilities of your system.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
NOTE: if you run into problems while running this script, you can re-run it with
the --verbose option to produce lots of diagnostic output to help debug problems.
This script has been written to anticipate some of the more common problems one might
encounter building ANY large, complex software package. But it is not pefect, and
there are certainly some situations it could encounter that it cannot deal with
gracefully. Altering the system configuration from something reasonably standard,
removing parts of the filesystem, moving system libraries around arbitrarily, etc,
it likely cannot cope with. It is just a script. It isn't intuitive or artificially
intelligent. It tries to make life a little easier for you, but at the end of the day
if it runs into trouble, a certain amount of knowledge on your part about
system configuration and idiosyncrasies will inevitably be necessary.


Proceed?y
SUDO privileges are required
Do you have SUDO privileges?y
Continuing with script
./build-gnuradio: line 1411: tmp5291: Permission denied
cat: tmp5291: No such file or directory

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

[sudo] password for giorgio:
Installing prerequisites.
====> THIS MAY TAKE QUITE SOME TIME <=====
Unsupported Debian version Kali Linux 1.0.6

Any suggestions? Thanks
andrew77
Posts: 29
Joined: Mon Mar 02, 2015 2:02 pm

Re: [WIP] kb3gtn's bladeRF libusb setup guide (ubuntu 13.04)

Post by andrew77 »

Solved!
I replaced in Debiad distro file with Kali Linux 6.0 instead of Kali Linux 1.1.0,
but I have another question:
"on some 64 bit systems, you might need a lib64 directory in this file as well"
How can I do that?
and when I type: ldconfig -v | grep gnuradio
this is the output:
ldconfig: Can't stat /lib/i486-linux-gnu: No such file or directory
ldconfig: Can't stat /usr/lib/i486-linux-gnu: No such file or directory
ldconfig: Path `/lib/x86_64-linux-gnu' given more than once
ldconfig: Path `/usr/lib/x86_64-linux-gnu' given more than once
/opt/gnuradio-3.7.6.1/lib:
libgnuradio-runtime-3.7.6.1.so.0.0.0 -> libgnuradio-runtime.so
libgnuradio-wavelet-3.7.6.1.so.0.0.0 -> libgnuradio-wavelet.so
libgnuradio-filter-3.7.6.1.so.0.0.0 -> libgnuradio-filter.so
libgnuradio-fcd-3.7.6.1.so.0.0.0 -> libgnuradio-fcd.so
libgnuradio-pager-3.7.6.1.so.0.0.0 -> libgnuradio-pager.so
libgnuradio-fec-3.7.6.1.so.0.0.0 -> libgnuradio-fec.so
libgnuradio-digital-3.7.6.1.so.0.0.0 -> libgnuradio-digital.so
libgnuradio-noaa-3.7.6.1.so.0.0.0 -> libgnuradio-noaa.so
libgnuradio-wxgui-3.7.6.1.so.0.0.0 -> libgnuradio-wxgui.so
libgnuradio-qtgui-3.7.6.1.so.0.0.0 -> libgnuradio-qtgui.so
libgnuradio-pmt-3.7.6.1.so.0.0.0 -> libgnuradio-pmt.so
libgnuradio-atsc-3.7.6.1.so.0.0.0 -> libgnuradio-atsc.so
libgnuradio-analog-3.7.6.1.so.0.0.0 -> libgnuradio-analog.so
libgnuradio-trellis-3.7.6.1.so.0.0.0 -> libgnuradio-trellis.so
libgnuradio-video-sdl-3.7.6.1.so.0.0.0 -> libgnuradio-video-sdl.so
libgnuradio-channels-3.7.6.1.so.0.0.0 -> libgnuradio-channels.so
libgnuradio-dtv-3.7.6.1.so.0.0.0 -> libgnuradio-dtv.so
libgnuradio-audio-3.7.6.1.so.0.0.0 -> libgnuradio-audio.so
libgnuradio-vocoder-3.7.6.1.so.0.0.0 -> libgnuradio-vocoder.so
libgnuradio-blocks-3.7.6.1.so.0.0.0 -> libgnuradio-blocks.so
libgnuradio-fft-3.7.6.1.so.0.0.0 -> libgnuradio-fft.so
ldconfig: Cannot stat /usr/lib/x86_64-linux-gnu/libjackserver.so: No such file or directory

how can I proceed? I'm new of linux
thanks
Post Reply