Thursday, August 22, 2013

Install remaining software for BladeRF

Another evening stumbling upon/through/over linux.

Warning: I copied/pasted a lot of info from my diary. Not at all to impress you, but to show what I did and had to do to get my BladeRF-board working. I can tell you, I did not succeed this evening. I am afraid many more evenings will come...

I took the marvelous installation guide from the bladeRF - forum,
kb3gtn's bladeRF setup guide at
 http://forums.nuand.com/forums/viewtopic.php?f=9&t=2804

Painfully I followed the instructions.

The problem is, however, that I am regaining old linux knowledge that was almost gone. Old forgotten braincells suddenly awaken and try to help me.

I had to experiment with well known linux commands. Ok, dir, sudo, cp, mkdir, rmdir, rmd, whatever, a lot of commands I understand. I managed to switch between my terminal-session, my diary in Word in windows and Chrome, or Fox for internet-access. All in different windows. And, Ubuntu is running in VMWare.

I re-learned ~ is your home-directory. Trivial perhaps for experienced linux-users.


About libusb, there seem to be two flavors: libusb-dev, the developers lib and libusb, the underlying lib.

I read something about aptitude. DO I have that installed in Ubuntu? Just ask the system and you get:

The program 'aptitude' is currently not installed.  You can install it by typing:
sudo apt-get install aptitude

So I did

OK, so now I can use aptitude or apt-get to semi-automagically install packages...

ecokees@ubuntu:/mnt/hgfs/bladeRF/linux/lib$ sudo apt-get update
ecokees@ubuntu:/mnt/hgfs/bladeRF/linux/lib$ sudo apt-get install libusb
ecokees@ubuntu:/mnt/hgfs/bladeRF/linux/lib$ sudo apt-get install libusb-1.0.0
ecokees@ubuntu:/mnt/hgfs/bladeRF/linux/apps$ make

Do I use the wrong libusb?? I use 1.0.0 but there is also a quite different 0.1.0
Which one do I need?

In directory C:\Users\lonneke\Documents\GitHub\bladeRF-1\linux\lib
is a makefile that reads
# Enable libusb (>= 1.0) support by defining ENABLE_BACKEND_LIBUSB


ecokees@ubuntu:/mnt/hgfs/bladeRF/linux/lib$ sudo apt-get install libtecla1 libtecla1-dev
ecokees@ubuntu:/mnt/hgfs/bladeRF/linux/apps$ make
I get a lot of undefined reference to


NOPE…

Now I am gonna try the exact procedure at http://forums.nuand.com/forums/viewtopic.php?f=9&t=2804

ecokees@ubuntu:~$ sudo apt-get install git
 ecokees@ubuntu:~$ sudo apt-get install git-core


The program 'gitk' is currently not installed.  You can install it by typing:

sudo apt-get install gitk
ecokees@ubuntu:~/myProject$ sudo apt-get install git-gui


How to see hidden files in the file-browser?  Ctrl-H or edit preferences
Now I can see all hidden files that start with a . (dot)

ecokees@ubuntu:~/bladeRF$ git clone https://github.com/Nuand/bladeRF.git

this is the URL for help about git:  http://git-scm.com/book/en/Git-Basics

ecokees@ubuntu:~/bladeRF/bladeRF/linux/kernel$ make
ecokees@ubuntu:~/bladeRF/bladeRF/linux/kernel$ sudo insmod bladeRF.ko
ecokees@ubuntu:~/bladeRF/bladeRF/linux/lib$ make all
ecokees@ubuntu:~/bladeRF/bladeRF/linux/apps$ make

ecokees@ubuntu:~/bladeRF/bladeRF/linux/apps$ dir bin
bladeRF-cli
ecokees@ubuntu:~/bladeRF/bladeRF/linux/apps$

OK: now I have my bladeRF-cli  !!!!!!!!!!!!!!!!

The setup guide starts with a remark:

This procedure builds the nuand code / FX3 firmware / builds gnuradio-3.7 (from git) / and gr-osmosdr (from git)
It is assumed you have installed build-essential / linux-headers-`uname -r` and have a general idea of figuring out other missing (apt-getable) depends.
In this example install procedure we will be installing everything into a /opt/[bladeRF]|[cypress]|[gnuradio-3.7.1git]
Because of the custom location, it does require us to update libarary search paths / and pythonpath enviroments / and optionally exec path. (covered here)
This procedure is tailored to ubuntu systems, but could be adapted to other distros like Centos / Gentoo etc...

So, there we go again:


ecokees@ubuntu:~/bladeRF/bladeRF/linux/apps/bin$ sudo apt-get update
ecokees@ubuntu:~/bladeRF/bladeRF/linux/apps/bin$ sudo apt-get install gcc
ecokees@ubuntu:~/bladeRF/bladeRF/linux/apps/bin$ sudo apt-get install g++
ecokees@ubuntu:~/bladeRF/bladeRF/linux/apps/bin$ sudo apt-get install libc6-dev

and finally:

ecokees@ubuntu:~/bladeRF/bladeRF/linux/apps/bin$ sudo apt-get install build-essential

What is linux-headers??

Kernel *headers* are the header files used to compile the kernel - and other
applications which depend on the symbols / structures defined in these
header files, like kernel modules. An example can be graphic card drivers;
if the driver does not have a binary matching the running kernel and needs
to be compiled.

ecokees@ubuntu:~/bladeRF/bladeRF/linux/apps/bin$ sudo apt-get install linux-headers-generic

ecokees@ubuntu:~/sandbox$ git clone https://github.com/Nuand/bladeRF.git

Yep: I have a bladeRF directory                                NOTE: it is bladeRF, not bladeRf!!

OK, again:

ecokees@ubuntu:~/sandbox/bladeRF/linux/kernel$ make

A lot of warnings, hope that is no problem later on

ecokees@ubuntu:~/sandbox/bladeRF/linux/kernel$ sudo mkdir -p /lib/modules/'uname -r'/kernel/extras/bladeRF/

-p, --parents
no error if existing, make parent directories as needed

ecokees@ubuntu:~/sandbox/bladeRF/linux/kernel$ sudo depmod

The depmod and modprobe utilities are intended to make a Linux modular kernel manageable for all users, administrators and distribution maintainers.
Depmod creates a "Makefile"-like dependency file, based on the symbols it finds in the set of modules mentioned on the command line or from the directories specified in the configuration file. This dependency file is later used by modprobe to automatically load the correct module or stack of modules.

DESCRIPTION
Linux kernel modules can provide services (called "symbols") for other modules to use (using EXPORT_SYMBOL in the code). If a second module uses this symbol, that second module clearly depends on the first module. These dependencies can get quite complex.

depmod creates a list of module dependencies, by reading each module under /lib/modules/version and determining what symbols it exports, and what symbols it needs. By default this list is written to modules.dep in the same directory. If filenames are given on the command line, only those modules are examined (which is rarely useful, unless all modules are listed).

If a version is provided, then that kernel version’s module directory is used, rather than the current kernel version (as returned by "uname -r").

depmod will also generate various map files in this directory, for use by the hotplug infrastructure.


 Do you understand this all?

ecokees@ubuntu:~/sandbox/bladeRF/linux/kernel$ sudo modprobe bladeRF
FATAL: Module bladeRF not found.
ecokees@ubuntu:~/sandbox/bladeRF/linux/kernel$

For some reason the mkdir command did not make the right directory and the cp command also did not what it had to do

This is interesting:

ecokees@ubuntu:/lib/modules$ cd $(uname -r)
ecokees@ubuntu:/lib/modules/3.2.0-51-generic-pae$ cd kernel

playing with root

ecokees@ubuntu:~/sandbox/bladeRF/linux/kernel$ sudo -s
root@ubuntu:~/sandbox/bladeRF/linux/kernel# echo "bladeRF" >> /etc/modules
root@ubuntu:~/sandbox/bladeRF/linux/kernel# exit
exit
ecokees@ubuntu:~/sandbox/bladeRF/linux/kernel$

ecokees@ubuntu:~/sandbox/bladeRF/linux/lib$ make DEBUG=y
ecokees@ubuntu:~/sandbox/bladeRF/linux/lib$ sudo apt-get install libtecla1 libtecla1-dev
ecokees@ubuntu:~/sandbox/bladeRF/linux/apps$ make
ecokees@ubuntu:~/sandbox/bladeRF/linux/lib$ sudo apt-get install libtecla1 libtecla1-dev
ecokees@ubuntu:~/sandbox/bladeRF/linux/apps$ make
ecokees@ubuntu:~/sandbox/bladeRF/linux/apps$ sudo mkdir -p /opt/bladeRF/fpga
ecokees@ubuntu:~/sandbox/bladeRF/linux/apps$ sudo mkdir /opt/bladeRF/firmware
ecokees@ubuntu:~/sandbox/bladeRF/linux/apps$ sudo mkdir /opt/bladeRF/bin
ecokees@ubuntu:~/sandbox/bladeRF/linux/apps$
ecokees@ubuntu:~/sandbox/bladeRF/linux/apps$ sudo cp bin/bladeRF-cli /opt/bladeRF/bin
ecokees@ubuntu:~/sandbox/bladeRF/linux/apps$

WAUW!!!

ecokees@ubuntu:~/sandbox/bladeRF/linux/apps/bin$ ./bladeRF-cli --help
Usage: ./bladeRF-cli [options]
bladeRF command line interface and test utility (0.2.0)

Options:
  -d, --device <device>            Use the specified bladeRF device.
  -f, --flash-firmware <file>      Flash specified firmware file.
  -l, --load-fpga <file>           Load specified FPGA bitstream.
  -p, --probe                      Probe for devices, print results, then exit.
  -s, --script <file>              Run provided script.
  -b, --batch                      Batch mode - do not enter interactive mode.
  -L, --lib-version                Print libbladeRF version and exit.
  -V, --version                    Print CLI version and exit.
  -h, --help                       Show this help text.

Notes:
  If the -d parameter is not provided, the first available device
  will be used for the provided command, or will be opened prior
  to entering interactive mode.

  Batch mode is implicit for the following options:
     -p, --probe               -h, --help
     -L, --lib-version         -V, --version

ecokees@ubuntu:~/sandbox/bladeRF/linux/apps/bin$ ./bladeRF-cli --version
0.2.0
ecokees@ubuntu:~/sandbox/bladeRF/linux/apps/bin$

So, bladeRF-cli works and I should be able to control my BladeRF-board!!!!!!!

bladeRF> print

Error: No devices are currently opened

bladeRF> open

open: No device specified

bladeRF> probe

bladeRF> version
Inside version
bladeRF> quit
ecokees@ubuntu:~/sandbox/bladeRF/linux/apps/bin$

About power supply for the BladeRF. It seems to be completely run on the USB-power.
I found a set of jumpers (J70) that are placed to have the USB-power feed the board. It is also
possible to use external power.

I can imagine that the FX3-chip on the bladeRF needs to be inited first?

So, go on with the installation from http://forums.nuand.com/forums/viewtopic.pphp?f=9&t=2804

*******************************************************************************************
**** THIS SETUP GUIDE Works with the kernel driver implementation only ****
**** LIBUSB implementation setup guide to come soon. ****

I don’t need to make the FX3 image, just download. Last command is:

$ sudo cp bladeRF.img /opt/bladeRf/firmware/

I downloaded bladeRF.img to my shared directory in Windows and then:

ecokees@ubuntu:~/sandbox/bladeRF/linux/apps/bin$ sudo cp /mnt/hgfs/bladeRF/bladeRF.img /opt/bladeRF/firmware/

ecokees@ubuntu:/etc/udev/rules.d$ sudo gedit 10-bladeRF.rules

Well, I still cannot use my BladeRF-board.

I am afraid that windows is hiding the USB-device bladeRF for me.

I don't know what to do now:

  1. just go on and install gnuradio on Ubuntu in VMWare in Windows7 and hoping that I see the bladeRF as a source in gnuradio
  2. install linux on a stick or CD, boot from it and do the whole installation again
  3. trying to figure out where it is going wrong. I pasted almost everything I did in a word-diary, inclusive of all messages I got.
  4. Ask for help on the forum
  5. Go on with libusb and java in Windows, I have done something like this before with the EZUSB-software
I don't know yet. I am afraid that VMWare is causing some problems here with USB. 
I really love to learn and find out what is happening but I also want results finally. My goal is building a GPS-receiver using the FPGA on the BladeRF and Python on the PC. I do not want to become an expert in VMWare/Windows-problem-solving...

I hope some nice guy or girl from the BladeRF community will help me in some way. I am not stuck yet, there are some things to investigate so I don't yet have clear questions to put in the forum.


Linux is daunting, but I will survive: YES I CAN!!








No comments:

Post a Comment