rsrRAN是支持"UHD", "bladeRF", "soapy", "zmq" ,"Sidekiq"的,如果使用的USRP设备,则会用UHD,HackRF的话,则需要先安装soapy,之后srsRAN才能够调用。因此本博客主要分为了四个内容1.安装SoapySDR;2.安装Soapy HackRF;3. 安装srsRAN;4.测试示例。
可以参考其官方的wiki:https://github.com/pothosware/SoapySDR/wiki/BuildGuide#ubuntu,安装步骤如下:
1、获取依赖项
sudo apt-get install cmake g++ libpython3-dev python3-numpy swig
2、获取源码
git clone https://github.com/pothosware/SoapySDR.git
3、编译并安装
mkdir build
cd build
cmake ..
make -j4
sudo make install
4、查看SoapySDRUtil信息
cd apps
./SoapySDRUtil --info
######################################################
## Soapy SDR -- the SDR abstraction library ##
######################################################
Lib Version: v0.8.1-g9cbaa3cf
API Version: v0.8.0
ABI Version: v0.8
Install root: /usr/local
Search path: /usr/local/lib/SoapySDR/modules0.8 (missing)
No modules found!
Available factories... No factories found!
Available converters...
- CF32 -> [CF32, CS16, CS8, CU16, CU8]
- CS16 -> [CF32, CS16, CS8, CU16, CU8]
- CS32 -> [CS32]
- CS8 -> [CF32, CS16, CS8, CU16, CU8]
- CU16 -> [CF32, CS16, CS8]
- CU8 -> [CF32, CS16, CS8]
- F32 -> [F32, S16, S8, U16, U8]
- S16 -> [F32, S16, S8, U16, U8]
- S32 -> [S32]
- S8 -> [F32, S16, S8, U16, U8]
- U16 -> [F32, S16, S8]
- U8 -> [F32, S16, S8]
安装Soapy HackRF,并查看HackRF信息。
1、获取源码
git clone https://github.com/pothosware/SoapySDR.git
2、编译安装
cd SoapyHackRF
mkdir build
cd build
cmake ..
make
sudo make install
3、构建完成后,回到~/SoapySDR/build/apps目录下,查看硬件信息,看是否能找到HackRF。
./SoapySDRUtil --probe="driver=hackrf"
######################################################
## Soapy SDR -- the SDR abstraction library ##
######################################################
Probe device driver=hackrf
[INFO] Opening HackRF One #0 681861dc33747a57...
----------------------------------------------------
-- Device identification
----------------------------------------------------
driver=HackRF
hardware=HackRF One
clock source=external
part id=a000cb3c006f4755
serial=0000000000000000681861dc33747a57
version=local-79baef7
----------------------------------------------------
-- Peripheral summary
----------------------------------------------------
Channels: 1 Rx, 1 Tx
Timestamps: NO
Other Settings:
* Antenna Bias - Antenna port power control.
[key=bias_tx, default=false, type=bool]
----------------------------------------------------
-- RX Channel 0
----------------------------------------------------
Full-duplex: NO
Supports AGC: NO
Stream formats: CS8, CS16, CF32, CF64
Native format: CS8 [full-scale=128]
Stream args:
* Buffer Count - Number of buffers per read.
[key=buffers, units=buffers, default=15, type=int]
Antennas: TX/RX
Full gain range: [0, 116] dB
LNA gain range: [0, 40, 8] dB
AMP gain range: [0, 14, 14] dB
VGA gain range: [0, 62, 2] dB
Full freq range: [0, 7250] MHz
RF freq range: [0, 7250] MHz
Sample rates: 1, 2, 3, 4, 5, ..., 16, 17, 18, 19, 20 MSps
Filter bandwidths: 1.75, 2.5, 3.5, 5, 5.5, ..., 14, 15, 20, 24, 28 MHz
----------------------------------------------------
-- TX Channel 0
----------------------------------------------------
Full-duplex: NO
Supports AGC: NO
Stream formats: CS8, CS16, CF32, CF64
Native format: CS8 [full-scale=128]
Stream args:
* Buffer Count - Number of buffers per read.
[key=buffers, units=buffers, default=15, type=int]
Antennas: TX/RX
Full gain range: [0, 61] dB
VGA gain range: [0, 47, 1] dB
AMP gain range: [0, 14, 14] dB
Full freq range: [0, 7250] MHz
RF freq range: [0, 7250] MHz
Sample rates: 1, 2, 3, 4, 5, ..., 16, 17, 18, 19, 20 MSps
Filter bandwidths: 1.75, 2.5, 3.5, 5, 5.5, ..., 14, 15, 20, 24, 28 MHz
如果要使用HackRF One的话,必须要安装完前两步,如果不幸先编译安装了srsRAN,会提示找不到设备,就算调成了soapy。需要重新编译安装。而如果你想要使用srsGUI看到图像化界面的话,也需要先安装srsGUI,再安装srsRAN,具体方法如下。
如果不先安装srsGUI,直接安装srsRAN,是无法显示界面的,必须先安装srsGUI,在安装srsRAN才能正确显示界面。
1、安装依赖项
sudo apt-get install libboost-system-dev libboost-test-dev libboost-thread-dev libqwt-qt5-dev qtbase5-dev
2、获取源码
git clone https://github.com/srsLTE/srsGUI.git
3、编译安装
cd srsgui
mkdir build
cd build
cmake ../
make
sudo make install
sudo ldconfig
1、安装依赖项
sudo apt-get install cmake libfftw3-dev libmbedtls-dev libboost-program-options-dev libboost-thread-dev libconfig++-dev libsctp-dev
2、获取源码
git clone https://github.com/srsran/srsRAN.git
3、编译安装
mkdir build
cd build
cmake ../
make
make test
sudo make install
sudo ldconfig
4、若报错出现无mbedtls包,No package 'mbedtls' found,则安装即可
mbedtls安装与入门【转】 - sky-heaven - 博客园
git clone https://github.com/ARMmbed/mbedtls.git
# 更新软件源
sudo apt-get update
# 通过软件源安装cmake
sudo apt-get install cmake
# 生成makefile文件,启用生成动态链接库选项
cmake -DUSE_SHARED_MBEDTLS_LIBRARY=On
# 以下步骤和make方式相同
make SHARED=1
sudo make install
5、若报错ModuleNotFoundError: No module named 'jinja2',则安装python-jinja2:
pip3 install jinja2
不再出现错误,成功安装就可以开始使用了。
对srsRAN进行简单的测试,具体使用文档大家可以看官方提供的PDF文档。https://docs.srsran.com/_/downloads/en/next/pdf/
完全安装好了srsRAN,我们先测试一下使用srsepc,srsenb,srsue看能不能实现,其中srsepc和srsenb可以运行在一台电脑和RF设备上,srsue需要运行在另一台电脑并使用另一个RF设备。因为我只有一个HackRF One,所以仅进行了运行测试,发现没问题。
(1)调用srsepc
cd srsepc/
sudo srsepc epc.conf.example
Built in Release mode using 21.10.0.
--- Software Radio Systems EPC ---
Reading configuration file epc.conf.example...
Couldn't open user_db.csv, trying /root/.config/srsran/user_db.csv
HSS Initialized.
MME S11 Initialized
MME GTP-C Initialized
MME Initialized. MCC: 0xf001, MNC: 0xff01
SPGW GTP-U Initialized.
SPGW S11 Initialized.
SP-GW Initialized.
在打开另一个命令行,运行srsenb之后,该命令行会出现新的信息。
Received S1 Setup Request.
S1 Setup Request - eNB Name: srsenb01, eNB id: 0x19b
S1 Setup Request - MCC:001, MNC:01
S1 Setup Request - TAC 7, B-PLMN 0xf110
S1 Setup Request - Paging DRX v128
Sending S1 Setup Response
(2)调用srsenb
cd srsenb/
sudo srsenb enb.conf.example
--- Software Radio Systems LTE eNodeB ---
Reading configuration file enb.conf.example...
Couldn't open sib.conf, trying /root/.config/srsran/sib.conf
Couldn't open rr.conf, trying /root/.config/srsran/rr.conf
Couldn't open rb.conf, trying /root/.config/srsran/rb.conf
WARNING: cpu0 scaling governor is not set to performance mode. Realtime processing could be compromised. Consider setting it to performance mode before running the application.
Built in Release mode using 21.10.0.
Opening 1 channels in RF device=soapy with args=default
Available RF device list: soapy
Soapy has found device #0: device=HackRF One, driver=hackrf, label=HackRF One #0 681861dc33747a57, part_id=a000cb3c006f4755, serial=0000000000000000681861dc33747a57, version=local-79baef7,
Selecting Soapy device: 0
[INFO] Opening HackRF One #0 681861dc33747a57...
Setting up Rx stream with 1 channel(s)
Setting up Tx stream with 1 channel(s)
Available device sensors:
Available sensors for Rx channel 0:
State of gain elements for Rx channel 0 (AGC not supported):
- LNA: 16.00 dB
- AMP: 0.00 dB
- VGA: 16.00 dB
State of gain elements for Tx channel 0 (AGC not supported):
- VGA: 0.00 dB
- AMP: 0.00 dB
Rx antenna set to TX/RX
Tx antenna set to TX/RX
==== eNodeB started ===
Type to view trace
Setting frequency: DL=2680.0 Mhz, UL=2560.0 MHz for cc_idx=0 nof_prb=50
(3)调用srsue
cd srsue/
sudo srsue ue.conf.example
Reading configuration file ue.conf.example...
WARNING: cpu0 scaling governor is not set to performance mode. Realtime processing could be compromised. Consider setting it to performance mode before running the application.
Built in Release mode using 21.10.0.
Opening 1 channels in RF device=default with args=default
Available RF device list: soapy
Trying to open RF device 'soapy'
Soapy has found device #0: device=HackRF One, driver=hackrf, label=HackRF One #0 681861dc33747a57, part_id=a000cb3c006f4755, serial=0000000000000000681861dc33747a57, version=local-79baef7,
Selecting Soapy device: 0
[INFO] Opening HackRF One #0 681861dc33747a57...
Setting up Rx stream with 1 channel(s)
Setting up Tx stream with 1 channel(s)
Available device sensors:
Available sensors for Rx channel 0:
State of gain elements for Rx channel 0 (AGC not supported):
- LNA: 16.00 dB
- AMP: 0.00 dB
- VGA: 16.00 dB
State of gain elements for Tx channel 0 (AGC not supported):
- VGA: 0.00 dB
- AMP: 0.00 dB
Rx antenna set to TX/RX
Tx antenna set to TX/RX
RF device 'soapy' successfully opened
Waiting PHY to initialize ... done!
Attaching UE...
我们使用./srsRAN/build/lib/examples提供的示例来基站扫描和解码。
1、扫描,国内的NB-IoT主要运行在B5和B8频段,所以我们扫描b 8或b 5,当然我们也可以使用自己的手机调到3G/2G网络,来看基站频率。
sudo ./cell_search_nbiot -b 8
Found XX cells
Found CELL XXX MHz, EARFCN=XXX, PHYID=XXX, NPSS power=17.1 dBm
Found CELL XXX MHz, EARFCN=XXX, PHYID=XXX, NPSS power=-11.5 dBm
Found CELL XXX MHz, EARFCN=XXX, PHYID=XXX, NPSS power=-11.5 dBm
Bye
2、选取一个小区,进行解码,如果信号较弱,可以添加-g 40 参数来提高增益。
sudo ./npdsch_ue -f 949.2e6
LTE和NB-IoT类似,在example文件中,存在cell_search和pdsch_ue,使用方法也是类似的,这里不再赘述。示例如图。 LTE运行在B3,B40,B41频段等,可以自行查新
sudo ./cell_search -b 40
sudo ./npdsch_ue -f 1835.6e6 -g 40
https://github.com/pothosware/SoapySDR/wiki/BuildGuide#ubuntu
走进“开源SDR实验室” 一起玩转4G/5G开源项目srsRAN(srsLTE升级版):安装方法+NB-IoT测试_开源SDR实验室的博客-CSDN博客_开源sdr实验室
srsRAN搭建流程_牛奶可乐配不配的博客-CSDN博客
5G NR/LTE ARFCN-Frequency Caculator (3GPP Specs) – iTecTec ARFCN计算Freq