Setting up OpenBTS on National Instruments USRP 2922

What you need

  1. An NI USRP-2922 Board
  2. A Gigabit Ethernet Adapter on Host PC (10/100MB won’t work)
  3. A Gigabit Ethernet cable (10/100MB won’t work)
  4. Dual Boot Windows/Ubuntu 16.04 32-bit on host PC
  5. The NI USRP Configuration Utility (for updating USRP software)

Background Information

The NI USRP-292x devices are similar to the Ettus N210.

Regarding the clock, note the difference between RF frequency range and frequency accuracy.

The 400 MHz to 4.4 GHz (clock range of USRP-2922) refers to the supported RF frequency range. The often specified external clock for OpenBTS refers to a 10 MHz reference used to improve frequency accuracy as cellular base stations have very precise frequency requirements.
The USRP-2922 will support all commonly used cellular RF frequencies. GPSDO or alternative 10 MHz reference is recommended. OpenBTS will still run on non-referenced devices, however, mobile performance and stability may be inconsistent and/or unpredictable.
— Courtesy Tom Tsou on the Openbts-discuss mailing list

Step 0: Update firmware on USRP

Download the USRP driver on Windows. At time of writing this guide, version 16 was the latest version.

Using the USRP Configuration Utility, update the firmware on your device. Also note the IP address of this device, or change it to your preference.

Note: You will later need this IP Address. On Ubuntu, you will provide your LAN interface an IP address and a subnet mask. Both the USRP and the LAN interface on your computer must be on the same subnet in order to be able to be recognized. In my case, my USRP device is on IP 192.168.20.11. I configure my Ubuntu machine’s LAN interface to IP address 192.168.20.10 and provide a subnet of 255.255.255.0.

Step 1: Install Ubuntu 16.04 LTS Server (32 bit or 64 bit)

I will not go into the details of Ubuntu installation. However, keep a few things in mind:

  • Use the above mentioned version
  • The username of the default user should be openbts
  • Keep around 40GB of root partition. Don’t make separate partitions for /home or any other folders.

After Ubuntu is installed, it would be a good idea to install the desktop environment. This gives you the following:

  • Graphical environment to easily deal with four terminal sessions
  • An Upstart boot mode is added to the GRUB menu (more on this later)

Install Ubuntu Desktop using:

sudo apt-get update
sudo apt-get install ubuntu-desktop

Also install Git:

sudo apt-get install software-properties-common python-software-properties
sudo add-apt-repository ppa:git-core/ppa
    (don't forget to press enter to continue)
sudo apt-get update
sudo apt-get install git

Step 2: Obtain OpenBTS, SMQueue, SIPAuthServe, Asterisk, UHD drivers

Clone dev repository from RangeNetworks

cd ~
git clone https://github.com/RangeNetworks/dev.git

Switch to master branch (4.0, 5.0 releases also work but you will have to perform surgery on the build script since most packages fail to build in these releases).

cd ~dev
./clone.sh
./switchto.sh master

Finally build the script for N210 configuration. Remember RangeNetworks does not officially support USRP-2922 but since the device is identical to Ettus N210, we use that configuration to build our script.

./build.sh N210

Install the built Debian packages.

cd BUILDS/<your_build_timestamp>
sudo dpkg -i *.deb
sudo apt-get install -f

Step 3: Obtain a separate transceiver – OsmoTRX

The dev script does not build either RAD1 or 52M. Instead of using one of these transceivers, we will use OsmoTRX instead. RAD1 is for old devices and I personally faced problems building Transceiver52M. OsmoTRX is also based on Transceiver52M. (Thanks to Neel Pandeya on Openbts-discuss mailing list for suggesting OsmoTRX)

cd ~
git clone https://github.com/osmocom/osmo-trx.git
cd osmo-trx
./autogen.sh
./configure
make
sudo make install

Note: When using one of the transceivers that come with OpenBTS, you create a symbolic link to the transceiver binary in your apps folder. Make sure there is no transceiver symbolic link when using OsmoTRX. It will get called from the external OS environment automatically when you start OpenBTS.

Step 4: Connect the device and configure IP address of interface

It’s now time to connect the USRP to your computer’s Gigabit LAN port using a Gigabit LAN cable.

In order to set the IP address of your machine, you can issue the dhclient command. It’s a very useful command and you will realize it’s worth elsewhere as well.

First of all, get to know the name of your LAN interface in Ubuntu:

ifconfig

Here’s some sample output on my machine:

enp2s0    Link encap:Ethernet  HWaddr 34:64:a9:0b:5f:2a  
          inet addr:10.103.76.120  Bcast:10.103.77.255  Mask:255.255.254.0
          inet6 addr: fe80::3664:a9ff:fe0b:5f2a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:19636 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11875 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:12164464 (12.1 MB)  TX bytes:1782197 (1.7 MB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:13 errors:0 dropped:0 overruns:0 frame:0
          TX packets:13 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:687 (687.0 B)  TX bytes:687 (687.0 B)

Here, enp2s0 is the name of my (Gigabit) LAN interface.

Set the IP address (remember to set an IP address on the same subnet, for example in my case the USRP is 192.168.20.11 so I chose 192.168.20.10):

sudo ifconfig enp2s0 192.168.20.10

By default, the ifconfig command sets the subnet mask to be 255.255.255.0 which gives you some 255 IP addresses on the same subnet as your USRP.

Note: This will alter the IP address of your interface. If later, you want to use the same LAN interface to connect to Internet, you can use the same command above to change your IP address back to it’s original value. Or just auto configure it via DHCP using dhclient (make sure your LAN is connected to the main network and not the USRP while doing this):

sudo dhclient enp2s0

Note: dhclient is basically a DHCP client!

Step 5: Check connectivity to your USRP:

Just issue the following command in a terminal:

uhd_find_devices

If everything went well, you should now see your USRP-2922 device listed here.

Step 6: Start the services

In Terminal 1 run:

sudo /usr/local/sbin/smqueue

In Terminal 2 run:

sudo /usr/local/sbin/sipauthserve

In Terminal 3 run:

sudo /usr/sbin/asterisk -vvvv

Before starting OpenBTS, we have to start the new OsmoTRX transceiver. Do this in a fourth terminal. This will open a connection to your USRP device.

For use with OpenBTS, enable the filler table option “Enable C0 filler table”, which enables OpenBTS style idle bursts and re-transmissions. Add the -f argument for this.

osmo-trx -f

Then in Terminal 5 run:

cd /OpenBTS
sudo ./OpenBTS

Note: You might not need to start OsmoTRX separately using the osmo-trx -f command. Do try with and without it to see what works for you.

Congratulations, OpenBTS is up!

Step 7: Enable Open Registration on OpenBTS and make a test call

On the OpenBTS console, enter:

OpenBTS> config Control.LUR.OpenRegistration ".*"
OpenBTS> config Control.LUR.SendTMSIs "1"
OpenBTS> rxgain 20
-- courtesy Neel Pandeya and Ralph A. Schmid on the Openbts-discuss mailing list

This will enable open registration on the network and will enable TMSI assignment. You can now connect to this network (which will show up as 00101 or something on an Android phone) and call 2600. 2600 is an echo service which enables you to check your OpenBTS setup.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s