LimeSDR Getting Started Quickly | LimeSDR上手指南

Author:雪碧 0xroot@360 Unicorn Team

文章首发地址:http://bobao.360.cn/learning/detail/3721.html

0x00 概览

LimeSDR部分特性: USB 3.0 ; 4 x Tx 发射天线接口 6 x Rx 接收天线接口;

可用于Wi-Fi, GSM, UMTS, LTE, LoRa, Bluetooth, Zigbee, RFID等开发测试环境中。

RTL电视棒、HackRF、BladeRF、USRP、LimeSDR参数对比表:

Snip20170410_13

HackRF One的价格,性能参数却能跟BladeRF甚至USRP媲美!

LimeSDR核心组件:

Lime_suite_comps

先上几张特写:

主板长10cm,算上USB接口11.5cm: 长

主板宽5.7cm: 宽 相对于HackRF、BladeRF、USRP这三款主流SDR硬件(USRP mini除外),体积已经很小巧了。LimeSDR其体积实测只有一个iPhone5s的体积大小!

当插上USB供电后,除了上图显示的两颗绿色LED灯,还有一颗一闪一闪的红色LED灯也在工作。

接下来将分一键快速安装和源码编译安装来使用LimeSDR硬件,推荐使用源码编译安装。

0x01 Mac OSX

1.1 搭建开发环境

Mac OSX当中强烈推荐通过Mac Port 搭建SDR环境,配合源码编译达到最佳效果。

1.通过AppStore安装Xcode https://itunes.apple.com/cn/app/xcode/id497799835?mt=12

2.下载安装 XQuartz/X11 http://xquartz.macosforge.org/landing

3.下载安装 MacPorts https://trac.macports.org/wiki/InstallingMacPorts

sudo port search sdr
Snip20170408_11.png
sudo port install rtl-sdr hackrf  bladeRF uhd gnuradio gqrx gr-osmosdr gr-fosphor

完成之后便可从GayHub上clone源码并进行编译安装。

1.2 源码编译LimeSuite

git clone https://github.com/myriadrf/LimeSuite.git
cd LimeSuite
mkdir builddir && cd builddir
cmake ../
make -j4
sudo make install

1.3 源码编译UHD驱动&&增加UHD对LimeSDR的支持

jocover基于UHD给LimeSDR开发了LimeSDR的驱动支持OpenUSRP,把LimeSDR来模拟成USRP B210来使用。

git clone https://github.com/EttusResearch/uhd.git
cd uhd/host/lib/usrp
git clone https://github.com/jocover/OpenUSRP.git
echo "INCLUDE_SUBDIRECTORY(OpenUSRP)">>CMakeLists.txt
mkdir build && cd build
cmake ..
make -j4
sudo make install

1.4 添加环境变量

echo 'export UHD_MODULE_PATH=/usr/lib/uhd/modules' >> ~/.bashrc

如果用的是iTerm2+zsh则执行:

echo 'export UHD_MODULE_PATH=/usr/lib/uhd/modules' >> ~/.zshrc

1.5 检测LimeSDR模拟USRP是否成功:

LimeSDR模拟成USRP B210之后最终的效果跟USRP是一样的:

uhd_find_devices

Snip20170408_10.png

Snip20170408_7.png

uhd_usrp_probe
Mac OS; Clang version 8.1.0 (clang-802.0.38); Boost_105900; UHD_003.010.001.001-MacPorts-Release

Using OpenUSRP
[WARNING] Gateware version mismatch!
  Expected gateware version 2, revision 8
  But found version 2, revision 6
  Follow the FW and FPGA upgrade instructions:
  http://wiki.myriadrf.org/Lime_Suite#Flashing_images
  Or run update on the command line: LimeUtil --update

[INFO] Estimated reference clock 30.7195 MHz
[INFO] Selected reference clock 30.720 MHz
[INFO] LMS7002M cache /Users/cn0xroot/.limesuite/LMS7002M_cache_values.db
MCU algorithm time: 10 ms
MCU Ref. clock: 30.72 MHz
MCU algorithm time: 163 ms
MCU algorithm time: 1 ms
MCU Ref. clock: 30.72 MHz
MCU algorithm time: 104 ms
MCU algorithm time: 1 ms
MCU Ref. clock: 30.72 MHz
MCU algorithm time: 167 ms
MCU algorithm time: 1 ms
MCU Ref. clock: 30.72 MHz
MCU algorithm time: 104 ms
  _____________________________________________________
 /
|       Device: B-Series Device
|     _____________________________________________________
|    /
|   |       Mboard: B210
|   |   revision: 4
|   |   product: 2
|   |   serial: 243381F
|   |   FW Version: 3
|   |   FPGA Version: 2.6
|   |
|   |   Time sources:  none, internal, external
|   |   Clock sources: internal, external
|   |   Sensors: ref_locked
|   |     _____________________________________________________
|   |    /
|   |   |       RX DSP: 0
|   |   |
|   |   |   Freq range: -10.000 to 10.000 MHz
|   |     _____________________________________________________
|   |    /
|   |   |       RX DSP: 1
|   |   |
|   |   |   Freq range: -10.000 to 10.000 MHz
|   |     _____________________________________________________
|   |    /
|   |   |       RX Dboard: A
|   |   |     _____________________________________________________
|   |   |    /
|   |   |   |       RX Frontend: A
|   |   |   |   Name: FE-RX1
|   |   |   |   Antennas: TX/RX, RX2
|   |   |   |   Sensors: temp, lo_locked, rssi
|   |   |   |   Freq range: 30.000 to 3800.000 MHz
|   |   |   |   Gain range PGA: 0.0 to 76.0 step 1.0 dB
|   |   |   |   Bandwidth range: 1000000.0 to 60000000.0 step 1.0 Hz
|   |   |   |   Connection Type: IQ
|   |   |   |   Uses LO offset: No
|   |   |     _____________________________________________________
|   |   |    /
|   |   |   |       RX Frontend: B
|   |   |   |   Name: FE-RX2
|   |   |   |   Antennas: TX/RX, RX2
|   |   |   |   Sensors: temp, lo_locked, rssi
|   |   |   |   Freq range: 30.000 to 3800.000 MHz
|   |   |   |   Gain range PGA: 0.0 to 76.0 step 1.0 dB
|   |   |   |   Bandwidth range: 1000000.0 to 60000000.0 step 1.0 Hz
|   |   |   |   Connection Type: IQ
|   |   |   |   Uses LO offset: No
|   |   |     _____________________________________________________
|   |   |    /
|   |   |   |       RX Codec: A
|   |   |   |   Name: B210 RX dual ADC
|   |   |   |   Gain Elements: None
|   |     _____________________________________________________
|   |    /
|   |   |       TX DSP: 0
|   |   |
|   |   |   Freq range: -10.000 to 10.000 MHz
|   |     _____________________________________________________
|   |    /
|   |   |       TX DSP: 1
|   |   |
|   |   |   Freq range: -10.000 to 10.000 MHz
|   |     _____________________________________________________
|   |    /
|   |   |       TX Dboard: A
|   |   |     _____________________________________________________
|   |   |    /
|   |   |   |       TX Frontend: A
|   |   |   |   Name: FE-TX1
|   |   |   |   Antennas: TX/RX
|   |   |   |   Sensors: temp, lo_locked
|   |   |   |   Freq range: 30.000 to 3800.000 MHz
|   |   |   |   Gain range PGA: 0.0 to 89.8 step 0.2 dB
|   |   |   |   Bandwidth range: 800000.0 to 60000000.0 step 1.0 Hz
|   |   |   |   Connection Type: IQ
|   |   |   |   Uses LO offset: No
|   |   |     _____________________________________________________
|   |   |    /
|   |   |   |       TX Frontend: B
|   |   |   |   Name: FE-TX2
|   |   |   |   Antennas: TX/RX
|   |   |   |   Sensors: temp, lo_locked
|   |   |   |   Freq range: 30.000 to 3800.000 MHz
|   |   |   |   Gain range PGA: 0.0 to 89.8 step 0.2 dB
|   |   |   |   Bandwidth range: 800000.0 to 60000000.0 step 1.0 Hz
|   |   |   |   Connection Type: IQ
|   |   |   |   Uses LO offset: No
|   |   |     _____________________________________________________
|   |   |    /
|   |   |   |       TX Codec: A
|   |   |   |   Name: B210 RX dual ADC
|   |   |   |   Gain Elements: None

➜  ~

1.6 捕获遥控信号

osmocom_fft -F -f 315e6 -s 2e6

Snip20170410_14.png

0x02 Ubuntu

2.1 更新软件包

sudo add-apt-repository -y ppa:myriadrf/drivers
sudo apt-get update
apt-cache search sdr

apt-Cache.jpg

2.2 安装SDR常用软件:

sudo apt-get update
sudo apt-get install git
sudo apt-get install python-pip

pip install --upgrade pip
pip install git+https://github.com/gnuradio/pybombs.git

pybombs recipes add gr-recipes git+https://github.com/gnuradio/gr-recipes.git 
pybombs recipes add gr-etcetera git+https://github.com/gnuradio/gr-etcetera.git

pybombs prefix init /usr/local -a myprefix -R gnuradio-default
pybombs install gqrx gr-osmosdr uhd

2.3 安装Lime_Suite所需依赖包

#packages for soapysdr available at myriadrf PPA
sudo add-apt-repository -y ppa:myriadrf/drivers
sudo apt-get update

#install core library and build dependencies
sudo apt-get install git g++ cmake libsqlite3-dev

#install hardware support dependencies
sudo apt-get install libsoapysdr-dev libi2c-dev libusb-1.0-0-dev

#install graphics dependencies
sudo apt-get install libwxgtk3.0-dev freeglut3-dev

接下来的源码编译过程与在OSX下源码编译过程一样:

2.4 源码编译LimeSuite

git clone https://github.com/myriadrf/LimeSuite.git
cd LimeSuite
mkdir builddir && cd builddir
cmake ../
make -j4
sudo make install

make install

执行LimeSuiteGUI启动LimeSDR的软件图形化界面:

LimeSuiteGUI

2.5 源码编译UHD驱动&&增加UHD对LimeSDR的支持

源码编译UHD+OpenUSRP

git clone https://github.com/EttusResearch/uhd.git
cd uhd/host/lib/usrp
git clone https://github.com/jocover/OpenUSRP.git
echo "INCLUDE_SUBDIRECTORY(OpenUSRP)">>CMakeLists.txt
cd ../../
mkdir build && cd build
cmake ..
make -j4
sudo make install
sudo ldconfig

2.6 添加环境变量

echo 'export UHD_MODULE_PATH=/usr/lib/uhd/modules' >> ~/.bashrc

2.7 GNURadio使用测试

wget http://www.0xroot.cn/SDR/signal-record.grc
gnuradio-companion signal-record.grc

此幻灯片需要JavaScript支持。

0x03 Reference

http://www.cnx-software.com/2016/04/29/limesdr-open-source-hardware-software-defined-radio-goes-for-199-and-up-crowdfunding/

https://wiki.myriadrf.org/Lime_Suite

http://linuxgizmos.com/open-source-sdr-sbc-runs-snappy-ubuntu-on-cyclone-v/

Getting started with 3G | ip.access nano3G+OpenBSC+Osmocom-bb Part 1

c7ak_5_u0aan1co

English Version could be find at Osmocom.org

https://osmocom.org/projects/cellular-infrastructure/wiki/Accelerate3g5_–_unicornteam

0x01环境搭建

PC:Ubuntu16.04

HardWare:ip.access nano3G

SoftWare:Osmocom

1.1 安装交叉编译环境

sudo apt-get update

sudo apt-get install libtool shtool autoconf git-core pkg-config make gcc build-essential libgmp3-dev libmpfr-dev libx11-6 libx11-dev texinfo flex bison libncurses5 libncurses5-dbg libusb-0.1-4 libpcsclite1 libccid pcscd libncurses5-dev libncursesw5 libncursesw5-dbg libncursesw5-dev zlibc zlib1g-dev libmpfr4 libmpc-dev libpcsclite-dev 
sudo ldconfig

mkdir osm
cd osm
mkdir build install src
wget http://bb.osmocom.org/trac/raw-attachment/wiki/GnuArmToolchain/gnu-arm-build.3.sh
cd src
wget http://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2
wget http://ftp.gnu.org/gnu/binutils/binutils-2.21.1a.tar.bz2
wget ftp://sources.redhat.com/pub/newlib/newlib-1.19.0.tar.gz

cd ..
chmod +x gnu-arm-build.3.sh
sudo bash gnu-arm-build.3.sh

1.2 设置交叉编译环境变量

cd install/bin
pwd

vi ~/./.bashrc
export PATH=$PATH:/home/$username(change this to your name)/osm/install/bin

#save and quit
source ~/.bashrc

0x02 源码编译CalypsoBTS

2.1 编译libosmo-dsp

git clone git://git.osmocom.org/libosmo-dsp.git
cd libosmo-dsp/
autoreconf -i
./configure
make
sudo make install
cd ..

2.2 编译osmocom-bb

git clone git://git.osmocom.org/osmocom-bb.git trx
cd trx/
git checkout jolly/testing
cd src/

# 需要 TX 功能支持
# 取消target/firmware/Makefile代码中'CFLAGS += -DCONFIG_TX_ENABLE' 前边的注释
# 并在make时启用transceiver功能支持
make HOST_layer23_CONFARGS=--enable-transceiver 

2.3 安装依赖包

sudo apt-get install sqlite3 libdbi-dev libdbd-sqlite3 libsctp-dev

2.4 编译 Ortp

wget http://download.savannah.gnu.org/releases/linphone/ortp/sources/ortp-0.22.0.tar.gz
tar -xvf ortp-0.22.0.tar.gz
cd ortp-0.22.0/
./configure
make
sudo make install
sudo ldconfig
cd ..

2.5 编译libosmo-abis

git clone git://git.osmocom.org/libosmo-abis.git
cd libosmo-abis
autoreconf -i
./configure
make
sudo make install
sudo ldconfig
cd ..

2.6 编译libosmo-netif

git clone git://git.osmocom.org/libosmo-netif.git
cd libosmo-netif/
autoreconf -i
./configure
make
sudo make install
sudo ldconfig
cd ..

2.7 编译openbsc

编译Openbsc时需用到PCAP库文件,编译前先搜索&安装依赖包:

apt-cache search PCAP
sudo pat-get install libpcap-dev libpcap0.8 libpcap0.8-dbg libpcap0.8-dev
sudo ldconfig

git clone git://git.osmocom.org/openbsc.git
cd openbsc/openbsc/
autoreconf -i
./configure
make
sudo make install
cd ../..
git clone git://git.osmocom.org/openbsc.git
cd openbsc/openbsc/
autoreconf -i
./configure
make
sudo make install
cd ../..

2.8 编译osmo-bts

git clone git://git.osmocom.org/osmo-bts.git
cd osmo-bts
autoreconf -i
./configure --enable-trx
make
sudo make install
cd ..

2.9 创建OpenBSC配置文件

#如果配置文件不存在需要先创建 Create the configuration folder if it isn't exist yet
mkdir ~/.osmocom
cd ~/.osmocom
touch ~/.osmocom/open-bsc.cfg
touch ~/.osmocom/osmo-bts.cfg

0x03 源码编译Cellular Infrastructure

3.1 克隆源码

git clone git://git.osmocom.org/libosmocore
git clone git://git.osmocom.org/libosmo-abis
git clone git://git.osmocom.org/openbsc
git clone git://git.osmocom.org/libosmo-netif
git clone git://git.osmocom.org/libosmo-sccp
git clone git://git.osmocom.org/libsmpp34
git clone git://git.osmocom.org/openggsn

3.2 下载&执行自动编译脚本

wget https://osmocom.org/attachments/download/2438/build_2G.sh
chmod 777  build_2G.sh
sudo bash build_2G.sh

0x04 配置OpenBSC

4.1 启动BTS

终端1:

osmo-nitb -c ~/.osmocom/open-bsc.cfg -l ~/.osmocom/hlr.sqlite3 -P -C --debug=DRLL:DCC:DMM:DRR:DRSL:DNM

终端2:

telnet localhost 4242

2017-04

4.2 配置IP

PC

IP:192.168.31.147 (通过WiFi连接)

路由器

IP:192.168.31.1

3G Access Point

IP:未知

方法1:进入路由后台,查找3G Access Point IP

network

方法2:通过abissip-find找到3G Access Point IP

cd openbsc/openbsc/src/ipaccess
#or
cd openbsc/openbsc/build-2G/src/ipaccess

sudo ./abisip-find

ipfind

4.3 Telnet连入3G Access Point

telnet 3G Access Point's IP 8090

telnet

4.4 SSH连入

ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 root@192.168.31.136
password:newsys

snip20170411_21

ipaccess-config

init3@0xroot:~/osm/openbsc/openbsc/src/ipaccess$ ./ipaccess-config --help
ipaccess-config (C) 2009-2010 by Harald Welte and others
This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY

Usage: ipaccess-config IP_OF_BTS
Commands for writing to the BTS:
  -u --unit-id UNIT_ID        Set the Unit ID of the BTS
  -o --oml-ip IP        Set primary OML IP (IP of your BSC)
  -i --ip-address IP/MASK    Set static IP address + netmask of BTS
  -g --ip-gateway IP        Set static IP gateway of BTS
  -r --restart            Restart the BTS (after other operations)
  -n --nvram-flags FLAGS/MASK    Set NVRAM attributes
  -S --nvattr-set FLAG    Set one additional NVRAM attribute
  -U --nvattr-unset FLAG    Set one additional NVRAM attribute
  -l --listen TESTNR        Perform specified test number
  -L --Listen TEST_NAME        Perform specified test
  -s --stream-id ID        Set the IPA Stream Identifier for OML
  -d --software FIRMWARE    Download firmware into BTS

Miscellaneous commands:
  -h --help            this text
  -H --HELP            Print parameter details.
  -f --firmware FIRMWARE    Provide firmware information
  -w --write-firmware        This will dump the firmware parts to the filesystem. Use with -f.
  -p --loop            Loop the tests executed with the --listen command.

ipaccess-proxy

init3@0xroot:~/osm/openbsc/openbsc/src/ipaccess$ ./ipaccess-proxy --help
Usage: ipaccess-proxy [options]
 ipaccess-proxy is a proxy BTS.
 -h --help. This help text.
 -l --listen IP. The ip to listen to.
 -b --bsc IP. The BSC IP address.
 -g --gprs IP. Take GPRS NS from that IP.

 -s --disable-color. Disable the color inside the logging message.
 -e --log-level number. Set the global loglevel.
 -T --timestamp. Prefix every log message with a timestamp.
 -V --version. Print the version of OpenBSC.

0x05 Reference

https://osmocom.org/projects/cellular-infrastructure/wiki/Build_from_Source

http://osmocom.org/projects/baseband/wiki/CalypsoBTS

https://osmocom.org/projects/cellular-infrastructure/wiki/Getting_Started_with_3G

https://osmocom.org/projects/osmocscn/wiki/Osmocom_3G_-_Getting_Started/3

https://osmocom.org/projects/cellular-infrastructure/wiki/Configuring_the_ipaccess_nano3G