📣🥳🥳🥳📣
✨Hello! 如果这篇【文章】对你有帮助😄,希望可以给博主点个赞👍鼓励一下😘
📣🥳🥳🥳📣
🌏目录
1 Ubuntu20.04 LTS系统安装
第一步先安装ubuntu,且因涉及时令准确度等因素,不采用虚拟机的方案,可以采用单系统或双系统的ubuntu。自己选择的是单系统方案
1.1 ISO镜像下载
ubuntu20.04 LTE下载:Download Ubuntu Desktop
1.2 U盘格式化
- 准备一个4G以上的空U盘(即使内部有数据也将在后续被格式化清空)
- 傻瓜式下载UltalISO 软碟通,安装完成后启用软碟通,选择试用
- 进入软碟通主界面后点击文件,在光盘目录下选择下载好的ISO镜像,在本地目录选择所插入的U盘,选择启动下的写入硬盘映像,默认配置,点击写入
1.3 系统安装
【重启电脑之前,可以先在windows系统下按win+R,敲入cmd
进入命令行模式,执行ipconfig
记录好IPv4地址、掩码、默认网关,执行nslookup
记录好DNS地址,后续可能需要配置静态IP】
- 重启电脑,选择u盘启动(操作百度下即可)
- 选择安装ubuntu
- 下一页面选择正常安装,其它选项可以不勾选
- 下一页面选择清楚整个磁盘并安装ubuntu
- 下一页面涉及时区设置,根据自己所在的地域选择即可,并不重要,可以直接继续
- 后续页面傻瓜式操作即可完成安装
【若想安装双系统,可见Windows10安装ubuntu18.04双系统教程】
1.4 更新软件源
- 按win键打开搜索,找到软件和更新,修改下载服务器,可以选择阿里云、华为云等源,也可以点击选择最佳服务器进行匹配,但速度稍慢
- 完成后按Ctrl+Alt+T进入终端,执行如下命令:
sudo apt-get update && sudo apt-get upgrade
1.5 *可选操作
1.5.1 静态IP配置
在安装ubuntu系统之后,更新软件源之前,如果插入网线也没有网络,可能需要先进行静态IP的配置。进入设置选择网络,点击有线的小齿轮进行IPv4的手动配置,将步骤1.3中所记录的4个IP地址输入即可
1.5.2 安装独立显卡驱动
由于ubuntu系统安装时默认安装了N卡驱动,可能与自己的显卡不适配,安装适配的独立显卡驱动可以提高界面操作的流畅性。具体命令如下:
sudo ubuntu-drivers autoinstall #自动安装
1.5.3 系统UI美化
2 NI USRP2954连接配置
2.1 SDR介绍
2.2 NI USRP & Ettus USRP
USRP的两大厂商分别为NI和Ettus,但2010年Ettus已被NI收购(Ettus作为NI的子品牌),因此可以说现在的USRP都是NI产的,Ettus与NI的内部母板硬件一致
以我手头上的NI USRP2954型号为例,其实就只是在Ettus Research X310型号的硬件基础上(内部具备X310母板),添加了两块UBX子板和GPSDO模块,然后将外壳的名字改为NI USRP2954而已
2.3 UHD(USRP Hardware Drivers)源码编译安装
- 安装git和vim
sudo apt-get install git
sudo apt-get install vim #后续可以用来编辑c/c++代码文件
sudo apt-get install g++ #后续可以用来编译c/c++代码文件,从而生成可执行文件
- 安装依赖
sudo apt-get install libboost-all-dev libusb-1.0-0-dev doxygen python3-docutils python3-mako python3-numpy python3-requests python3-ruamel.yaml python3-setuptools cmake build-essential
【linux终端下的复制粘贴快捷键为Crtl+Shift+c、Crtl+Shift+v】
- 从github拉取uhd代码
cd /home #等价于:cd / && cd home
mkdir workarea-uhd
cd workarea-uhd
git clone https://github.com/EttusResearch/uhd
- 编译
cd uhd
git tag -l #获取发行版本的完整列表
git checkout v3.15.0.0 #切换到合适版本,这里选择3.15_LTS.
cd host
mkdir build
cd build
cmkae ../ #交叉编译上层文件夹host
make -j8 #编译源码,-j8表示8个处理器加速处理
make test
sudo make install
sudo ldconfig #更新动态链接库
- UHD FPGA镜像下载
sudo uhd_images_downloader
2.4 UHD与X310的通信
B系列与UHD通信的方式仅有USB3.0一种,而X系列与UHD通信的方式有两种:网线传输、PCIe线缆高速传输,其中网线传输方案还分1Gbps和10Gbps两种
对于PCIe高速传输方案,要求电脑主机要有PCIe接口,因此需要额外购买针对电脑主机的PCIe套件,我所用的是NI1092机箱(其实就是一台电脑主机),型号1092,PXI控制器型号8861
但需要注意的是,PXI机箱的PCIe套件(上图的NI-PXIe 8374板子)无法装在电脑主机上,电脑主机的PCIe套件需另外购买。电脑主机的PCIe套件安装可参考USRP2954硬件安装。考虑到1Gbps的速率其实已经能够满足大多数应用,因此一般来讲UHD和USRP之间的通信通过1Gbps的网口连接来实现
2.4.1 USB2.0 & 千兆以太网 & USB3.0
- USB2.0将设备之间的理论最高速率增加至480Mbps,即60MB/s
- 千兆以太网1000Mbps,即1Gbps,一般家庭用线为超五类网线和六类网线
- USB3.0理论速率可达5Gbps,毕竟是短距离传输,因此快于千兆网
【关于USB接口的更多信息可见:USB接口种类汇总】
2.4.2 PCIe通信配置
- 下载NI Linux设备驱动程序并提取至主目录中
- 进入改文件夹后将对应的deb后缀的文件复制到主目录中
- Ctrl+Alt+T打开终端并执行以下命令
安装存储库deb
dpkg -i ni-ubuntu2004firstlook-drivers-2021Q4.deb
更新包信息
sudo apt update
安装内核头
sudo apt install linux-headers-$(uname -r)
安装ni-usrp-rio
sudo apt install ni-usrp-rio
通过DKMS创建内核模块
dkms autoinstall
关机
poweroff
- PCIe通信测试
由于PCIe接口不允许热插拔,因此需要先将PCIe线缆连接好后,将USRP开机,再启动电脑主机,随后打开终端执行以下命令
uhd_find_devices #查找usrp硬件设备
resource:RIO0
是USRP RIO设备通过PCI Express传输的唯一标识符,即表明此时USRP与UHD之间的通信通过PCIe线缆传输,而非网口。若提示Input stream error
,则执行reboot
重启电脑,再重新执行uhd_find_devices
uhd_usrp_probe #查看usrp设备信息
设备信息如下
[INFO] [UHD] linux; GNU C++ version 9.3.0; Boost_107100; UHD_3.15.0.HEAD-0-gaea0e2de
[INFO] [X300] X300 initialization sequence...
[INFO] [X300] Connecting to niusrpriorpc at localhost:5444...
[INFO] [X300] Using LVBITX bitfile /usr/local/share/uhd/images/usrp_x310_fpga_HG.lvbitx
[INFO] [X300] Radio 1x clock: 200 MHz
[INFO] [GPS] Found an internal GPSDO: LC_XO, Firmware Rev 0.929b
[INFO] [0/DmaFIFO_0] Initializing block control (NOC ID: 0xF1F0D00000000000)
[INFO] [0/DmaFIFO_0] BIST passed (Throughput: 1303 MB/s)
[INFO] [0/DmaFIFO_0] BIST passed (Throughput: 1320 MB/s)
[INFO] [0/Radio_0] Initializing block control (NOC ID: 0x12AD100000000001)
[INFO] [0/Radio_1] Initializing block control (NOC ID: 0x12AD100000000001)
[INFO] [0/DDC_0] Initializing block control (NOC ID: 0xDDC0000000000000)
[INFO] [0/DDC_1] Initializing block control (NOC ID: 0xDDC0000000000000)
[INFO] [0/DUC_0] Initializing block control (NOC ID: 0xD0C0000000000000)
[INFO] [0/DUC_1] Initializing block control (NOC ID: 0xD0C0000000000000)
_____________________________________________________
/
| Device: X-Series Device
| _____________________________________________________
| /
| | Mboard: X310
| | revision: 11
| | revision_compat: 7
| | product: 30810
| | mac-addr0: 00:80:2f:31:9c:59
| | mac-addr1: 00:80:2f:31:9c:5a
| | gateway: 192.168.10.1
| | ip-addr0: 192.168.10.2
| | subnet0: 255.255.255.0
| | ip-addr1: 192.168.20.2
| | subnet1: 255.255.255.0
| | ip-addr2: 192.168.30.2
| | subnet2: 255.255.255.0
| | ip-addr3: 192.168.40.2
| | subnet3: 255.255.255.0
| | serial: 31F9358
| | name: UE_USRP #name一般为空,但由于我的usrp被我命名过,所以此处显示UE——USRP,下面有修改usrp设备的教程
| | FW Version: 6.0
| | FPGA Version: 36.0
| | FPGA git hash: fde2a94
| | RFNoC capable: Yes
| |
| | Time sources: internal, external, gpsdo
| | Clock sources: internal, external, gpsdo
| | Sensors: gps_gpgga, gps_gprmc, gps_time, gps_locked, gps_servo, ref_locked
| | _____________________________________________________
| | /
| | | RX Dboard: A
| | | ID: UBX-160 v1 (0x007a)
| | | Serial: 31F5AE9
| | | _____________________________________________________
| | | /
| | | | RX Frontend: 0
| | | | Name: UBX RX
| | | | Antennas: TX/RX, RX2, CAL
| | | | Sensors: lo_locked
| | | | Freq range: 10.000 to 6000.000 MHz
| | | | Gain range PGA0: 0.0 to 31.5 step 0.5 dB
| | | | Bandwidth range: 160000000.0 to 160000000.0 step 0.0 Hz
| | | | Connection Type: IQ
| | | | Uses LO offset: No
| | | _____________________________________________________
| | | /
| | | | RX Codec: A
| | | | Name: ads62p48
| | | | Gain range digital: 0.0 to 6.0 step 0.5 dB
| | _____________________________________________________
| | /
| | | RX Dboard: B
| | | ID: UBX-160 v1 (0x007a)
| | | Serial: 31F5AEE
| | | _____________________________________________________
| | | /
| | | | RX Frontend: 0
| | | | Name: UBX RX
| | | | Antennas: TX/RX, RX2, CAL
| | | | Sensors: lo_locked
| | | | Freq range: 10.000 to 6000.000 MHz
| | | | Gain range PGA0: 0.0 to 31.5 step 0.5 dB
| | | | Bandwidth range: 160000000.0 to 160000000.0 step 0.0 Hz
| | | | Connection Type: IQ
| | | | Uses LO offset: No
| | | _____________________________________________________
| | | /
| | | | RX Codec: B
| | | | Name: ads62p48
| | | | Gain range digital: 0.0 to 6.0 step 0.5 dB
| | _____________________________________________________
| | /
| | | TX Dboard: A
| | | ID: UBX-160 v1 (0x0079)
| | | Serial: 31F5AE9
| | | _____________________________________________________
| | | /
| | | | TX Frontend: 0
| | | | Name: UBX TX
| | | | Antennas: TX/RX, CAL
| | | | Sensors: lo_locked
| | | | Freq range: 10.000 to 6000.000 MHz
| | | | Gain range PGA0: 0.0 to 31.5 step 0.5 dB
| | | | Bandwidth range: 160000000.0 to 160000000.0 step 0.0 Hz
| | | | Connection Type: QI
| | | | Uses LO offset: No
| | | _____________________________________________________
| | | /
| | | | TX Codec: A
| | | | Name: ad9146
| | | | Gain Elements: None
| | _____________________________________________________
| | /
| | | TX Dboard: B
| | | ID: UBX-160 v1 (0x0079)
| | | Serial: 31F5AEE
| | | _____________________________________________________
| | | /
| | | | TX Frontend: 0
| | | | Name: UBX TX
| | | | Antennas: TX/RX, CAL
| | | | Sensors: lo_locked
| | | | Freq range: 10.000 to 6000.000 MHz
| | | | Gain range PGA0: 0.0 to 31.5 step 0.5 dB
| | | | Bandwidth range: 160000000.0 to 160000000.0 step 0.0 Hz
| | | | Connection Type: QI
| | | | Uses LO offset: No
| | | _____________________________________________________
| | | /
| | | | TX Codec: B
| | | | Name: ad9146
| | | | Gain Elements: None
| | _____________________________________________________
| | /
| | | RFNoC blocks on this device:
| | |
| | | * DmaFIFO_0
| | | * Radio_0
| | | * Radio_1
| | | * DDC_0
| | | * DDC_1
| | | * DUC_0
| | | * DUC_1
连接成功后,将相应的镜像烧写进手头的usrp
cd /usr/local/bin
./uhd_image_loader --args="type=x300,serial=31F9358" #将x300对应的镜像烧写进serial为31F9358的usrp设备
重启USRP以生效
此后若想关闭或者打开UHD与USRP的PCIe通信,可执行以下命令
systemctl stop niusrpriorpc.service #停用ni usrp设备驱动程序
systemctl start niusrpriorpc.service #开启ni usrp设备驱动程序
2.4.3 1Gbps网口通信配置
此种通信配置需要SFP转RJ45光模块,一般购买USRP时可在附件中增选,若没有,可以在某宝平台购买。将该光模块插入端口0中,便可以用网线连接电脑和USRP
随后打开有线网络配置,USRP 1Gbps端口0的默认IP地址为192.168.10.2,因此电脑的IP地址需进行静态配置到统一网段。可配置如下
在终端执行ping 192.168.10.2
,网络可达
查找usrp硬件设备并查看usrp设备信息
uhd_find_devices #查找usrp硬件设备
uhd_usrp_probe #查看usrp设备信息
需要注意的是,如果此前用过PCIe连接,现在改用网口连接,会有Error
出现,提示input stream error
,这是因为没有将ni usrp设备驱动程序停用或卸载,UHD会优先通过PCIe接口去找usrp设备。只有当ni usrp设备驱动程序被停用或卸载后,UHD才会通过网口去找usrp设备
systemctl stop niusrpriorpc.service #停用ni usrp设备驱动程序
apt remove ni-usrp-rio
apt autoremove #卸载ni usrp设备驱动程序
最后,和此前通过PCIe连接一样,通过网口连接成功后,将相应的镜像烧写进手头的usrp
cd /usr/local/bin
./uhd_image_loader --args="type=x300,serial=31F9358" #将x300对应的镜像烧写进serial为31F9358的usrp设备
重启USRP以生效
2.5 USRP设备命名
如果一台电脑连接了多台USRP,那么为方便起见,可以考虑给USRP设备分配自定义名称,这样以后可以通过名称而不是难以记住的序列号或IP地址来识别USRP设备
- 通过序列号来找到主机所连接的某个具体的USRP设备
uhd_find_devices --args="serial=31F9358" #该序列号从之前的步骤中获取
- 对序列号为
31F9358
的USRP设备命名,重置name
属性
cd /home/workarea-uhd/uhd/host/utils
g++ usrp_burn_mb_eeprom.cpp -o usrp_burm_mb_eeprom #先通过g++ -o命令编译生成可执行文件usrp_burn_mb_eeprom
可能会发现有以下报错:undefined reference to
,即未定义引用
这是因此使用g++编译c/c++项目文件时,没有链接上所需的动态库,参考博文【错误】undefined reference to `boost::……`的解决后修改编译命令如下
g++ usrp_burn_mb_eeprom.cpp -o usrp_burn_mb_eeprom -l boost_program_options -l uhd #对于c++文件用g++,对于c文件用gcc
成功生成可执行文件如下
按以下命令启用上面所生成的可执行文件,重置序列号为31F9358
的USRP的名称为UE_USRP
./usrp_burn_mb_eeprom --args="serial=31F9358" --value="name=UE_USRP" #将设备命名为UE_USRP
最后重启电脑即可生效
- 通过设备的自定义名称来查找到该设备
uhd_find_devices --args="name=UE_USRP"
2.6 更改USRP设备IP地址
出于一些应用需求,我们可能需要更改USRP设备的IP地址,一般USRP设备ip-addr0
属性默认为192.168.10.2
,更改操作类似步骤2.5
#前面的命令均一样
./usrp_burn_mb_eeprom --args="serial=31F9358" --value="ip-addr0=192.168.10.11" #将usrp的ip地址更改为192.168.10.11
重启电脑即可生效
3 srsRAN环境配置
3.1 srsRAN源码编译安装
打开终端,执行以下命令(若遇权限问题加sudo
)
sudo apt-get install build-essential cmake libfftw3-dev libmbedtls-dev libboost-program-options-dev libconfig++-dev libsctp-dev
git clone https://github.com/srsRAN/srsRAN.git
cd srsRAN
mkdir build
cd build
cmake ../ #交叉编译上层目录
make -j8 #多核(8处理器)加速处理
make test #功能测试,可不执行
sudo make install
ldconfig #更新动态链接库
sudo srsran_install_configs.sh user
3.2 srsGUI源码编译安装
sudo apt-get install libboost-system-dev libboost-test-dev libboost-thread-dev libqwt-qt5-dev qtbase5-dev
sudo git clone https://github.com/srsLTE/srsGUI.git
cd srsGUI
mkdir build
cd build
cmake ../
make -j8
make test
sudo make install
ldconfig
3.3 低时延内核安装
sudo apt-get install linux-lowlatency
sudo apt-get install linux-image-`uname -r | cut -d- -f1-2`-lowlatency
sudo apt-get install linux-headers-`uname -r | cut -d- -f1-2`-lowlatency
reboot
4 srsue & srsepc & srsenb pending
4.1 UE(srsue)
4.1.1 前置操作
- 操作系统设置
srsue使用标准linux内核在用户空间中运行,为了获得最佳性能,可以禁用CPU频率缩放,执行以下命令
for f in /sys/devices/system/cpu/cpu[0-9]*/cpufreq/scaling_governor ; do
echo performance > $f
done
-
参数配置
-
USRP前端设置
为了减少TX-RX串扰,可以将TX和RX天线互成90度,也可以通过SMA-SMA连接线(某宝搜)实现有线连接,对于USRP等射频前端,将TX直接连接到RX时要确保至少有30dB的衰减,避免损坏USRP设备,这种衰减器某宝也有,我用的是下面这种固定衰减器
有关有线连接的更多详细信息,见下面4.1.3 高级用法 -
结果观察
4.1.2 UE参数配置
4.1.3 高级用法
4.2 EPC(srsepc)
4.3 eNB(srsenb)
5 srsRAN+USRP应用举例
以下示例都可以在 ./srsRAN/build/lib/examples
目录中找到
5.1 NB-IoT信号检测
本实验例子旨在发现并解码当地的商用NB-IoT传输,基本实验硬件如下图所示
其中,Machine1为自己的电脑,RF-FRONTEN在这里表示USRP设备,接下来我们用cell_search_nbiot
来搜索本地区域内的窄带物联网基站,并用npdsch_ue
来解码该基站的下行数据。需要注意的是:国内的NB-IoT主要运行在B5和B8频段
- 通过
cell_search_nbiot
搜索基站
cd srsRAN/build/lib/examples
./cell_search_nbiot -b 5 #选用B5
搜索结果如下
Opening RF device...
Available RF device list: UHD
Trying to open RF device 'UHD'
[INFO] [UHD] linux; GNU C++ version 9.3.0; Boost_107100; UHD_3.15.0.HEAD-0-gaea0e2de
[INFO] [LOGGING] Fastpath logging disabled at runtime.
Opening USRP channels=1, args: type=x300,master_clock_rate=184.32e6
[INFO] [UHD RF] RF UHD Generic instance constructed
[INFO] [X300] X300 initialization sequence...
[INFO] [X300] Connecting to niusrpriorpc at localhost:5444...
[INFO] [X300] Using LVBITX bitfile /usr/local/share/uhd/images/usrp_x310_fpga_HG.lvbitx
[INFO] [X300] Radio 1x clock: 184.32 MHz
[INFO] [GPS] Found an internal GPSDO: LC_XO, Firmware Rev 0.929b
[INFO] [0/DmaFIFO_0] Initializing block control (NOC ID: 0xF1F0D00000000000)
[INFO] [0/DmaFIFO_0] BIST passed (Throughput: 1310 MB/s)
[INFO] [0/DmaFIFO_0] BIST passed (Throughput: 1306 MB/s)
[INFO] [0/Radio_0] Initializing block control (NOC ID: 0x12AD100000000001)
[INFO] [0/Radio_1] Initializing block control (NOC ID: 0x12AD100000000001)
[INFO] [0/DDC_0] Initializing block control (NOC ID: 0xDDC0000000000000)
[INFO] [0/DDC_1] Initializing block control (NOC ID: 0xDDC0000000000000)
[INFO] [0/DUC_0] Initializing block control (NOC ID: 0xD0C0000000000000)
[INFO] [0/DUC_1] Initializing block control (NOC ID: 0xD0C0000000000000)
RF device 'UHD' successfully opened
[ 0/249]: EARFCN 2400, 869.00 MHz looking for NPSS.
[ 1/249]: EARFCN 2401, 869.10 MHz looking for NPSS.
[ 2/249]: EARFCN 2402, 869.20 MHz looking for NPSS.
[ 3/249]: EARFCN 2403, 869.30 MHz looking for NPSS.
[ 4/249]: EARFCN 2404, 869.40 MHz looking for NPSS.
[ 5/249]: EARFCN 2405, 869.50 MHz looking for NPSS.
[ 6/249]: EARFCN 2406, 869.60 MHz looking for NPSS.
[ 7/249]: EARFCN 2407, 869.70 MHz looking for NPSS.
[ 8/249]: EARFCN 2408, 869.80 MHz looking for NPSS.
[ 9/249]: EARFCN 2409, 869.90 MHz looking for NPSS.
[ 10/249]: EARFCN 2410, 870.00 MHz looking for NPSS.
[ 11/249]: EARFCN 2411, 870.10 MHz looking for NPSS.
[ 12/249]: EARFCN 2412, 870.20 MHz looking for NPSS.
[ 13/249]: EARFCN 2413, 870.30 MHz looking for NPSS.
[ 14/249]: EARFCN 2414, 870.40 MHz looking for NPSS.
[ 15/249]: EARFCN 2415, 870.50 MHz looking for NPSS.
[ 16/249]: EARFCN 2416, 870.60 MHz looking for NPSS.
[ 17/249]: EARFCN 2417, 870.70 MHz looking for NPSS.
[ 18/249]: EARFCN 2418, 870.80 MHz looking for NPSS.
[ 19/249]: EARFCN 2419, 870.90 MHz looking for NPSS.
[ 20/249]: EARFCN 2420, 871.00 MHz looking for NPSS.
[ 21/249]: EARFCN 2421, 871.10 MHz looking for NPSS.
[ 22/249]: EARFCN 2422, 871.20 MHz looking for NPSS.
[ 23/249]: EARFCN 2423, 871.30 MHz looking for NPSS.
[ 24/249]: EARFCN 2424, 871.40 MHz looking for NPSS.
[ 25/249]: EARFCN 2425, 871.50 MHz looking for NPSS.
[ 26/249]: EARFCN 2426, 871.60 MHz looking for NPSS.
[ 27/249]: EARFCN 2427, 871.70 MHz looking for NPSS.
[ 28/249]: EARFCN 2428, 871.80 MHz looking for NPSS.
[ 29/249]: EARFCN 2429, 871.90 MHz looking for NPSS.
[ 30/249]: EARFCN 2430, 872.00 MHz looking for NPSS.
[ 31/249]: EARFCN 2431, 872.10 MHz looking for NPSS.
[ 32/249]: EARFCN 2432, 872.20 MHz looking for NPSS.
[ 33/249]: EARFCN 2433, 872.30 MHz looking for NPSS.
[ 34/249]: EARFCN 2434, 872.40 MHz looking for NPSS.
[ 35/249]: EARFCN 2435, 872.50 MHz looking for NPSS.
[ 36/249]: EARFCN 2436, 872.60 MHz looking for NPSS.
[ 37/249]: EARFCN 2437, 872.70 MHz looking for NPSS.
[ 38/249]: EARFCN 2438, 872.80 MHz looking for NPSS.
[ 39/249]: EARFCN 2439, 872.90 MHz looking for NPSS.
[ 40/249]: EARFCN 2440, 873.00 MHz looking for NPSS.
[ 41/249]: EARFCN 2441, 873.10 MHz looking for NPSS.
[ 42/249]: EARFCN 2442, 873.20 MHz looking for NPSS.
[ 43/249]: EARFCN 2443, 873.30 MHz looking for NPSS.
[ 44/249]: EARFCN 2444, 873.40 MHz looking for NPSS.
[ 45/249]: EARFCN 2445, 873.50 MHz looking for NPSS.
[ 46/249]: EARFCN 2446, 873.60 MHz looking for NPSS.
[ 47/249]: EARFCN 2447, 873.70 MHz looking for NPSS.
[ 48/249]: EARFCN 2448, 873.80 MHz looking for NPSS.
[ 49/249]: EARFCN 2449, 873.90 MHz looking for NPSS.
[ 50/249]: EARFCN 2450, 874.00 MHz looking for NPSS.
[ 51/249]: EARFCN 2451, 874.10 MHz looking for NPSS.
[ 52/249]: EARFCN 2452, 874.20 MHz looking for NPSS.
[ 53/249]: EARFCN 2453, 874.30 MHz looking for NPSS.
[ 54/249]: EARFCN 2454, 874.40 MHz looking for NPSS.
[ 55/249]: EARFCN 2455, 874.50 MHz looking for NPSS.
[ 56/249]: EARFCN 2456, 874.60 MHz looking for NPSS.
[ 57/249]: EARFCN 2457, 874.70 MHz looking for NPSS.
[ 58/249]: EARFCN 2458, 874.80 MHz looking for NPSS.
[ 59/249]: EARFCN 2459, 874.90 MHz looking for NPSS.
[ 60/249]: EARFCN 2460, 875.00 MHz looking for NPSS.
[ 61/249]: EARFCN 2461, 875.10 MHz looking for NPSS.
[ 62/249]: EARFCN 2462, 875.20 MHz looking for NPSS.
[ 63/249]: EARFCN 2463, 875.30 MHz looking for NPSS.
[ 64/249]: EARFCN 2464, 875.40 MHz looking for NPSS.
[ 65/249]: EARFCN 2465, 875.50 MHz looking for NPSS.
[ 66/249]: EARFCN 2466, 875.60 MHz looking for NPSS.
[ 67/249]: EARFCN 2467, 875.70 MHz looking for NPSS.
[ 68/249]: EARFCN 2468, 875.80 MHz looking for NPSS.
[ 69/249]: EARFCN 2469, 875.90 MHz looking for NPSS.
[ 70/249]: EARFCN 2470, 876.00 MHz looking for NPSS.
[ 71/249]: EARFCN 2471, 876.10 MHz looking for NPSS.
[ 72/249]: EARFCN 2472, 876.20 MHz looking for NPSS.
[ 73/249]: EARFCN 2473, 876.30 MHz looking for NPSS.
[ 74/249]: EARFCN 2474, 876.40 MHz looking for NPSS.
[ 75/249]: EARFCN 2475, 876.50 MHz looking for NPSS.
[ 76/249]: EARFCN 2476, 876.60 MHz looking for NPSS.
[ 77/249]: EARFCN 2477, 876.70 MHz looking for NPSS.
[ 78/249]: EARFCN 2478, 876.80 MHz looking for NPSS.
[ 79/249]: EARFCN 2479, 876.90 MHz looking for NPSS.
[ 80/249]: EARFCN 2480, 877.00 MHz looking for NPSS.
[ 81/249]: EARFCN 2481, 877.10 MHz looking for NPSS.
[ 82/249]: EARFCN 2482, 877.20 MHz looking for NPSS.
[ 83/249]: EARFCN 2483, 877.30 MHz looking for NPSS.
[ 84/249]: EARFCN 2484, 877.40 MHz looking for NPSS.
[ 85/249]: EARFCN 2485, 877.50 MHz looking for NPSS.
[ 86/249]: EARFCN 2486, 877.60 MHz looking for NPSS.
[ 87/249]: EARFCN 2487, 877.70 MHz looking for NPSS.
[ 88/249]: EARFCN 2488, 877.80 MHz looking for NPSS.
[ 89/249]: EARFCN 2489, 877.90 MHz looking for NPSS.
[ 90/249]: EARFCN 2490, 878.00 MHz looking for NPSS.
[ 91/249]: EARFCN 2491, 878.10 MHz looking for NPSS.
[ 92/249]: EARFCN 2492, 878.20 MHz looking for NPSS.
[ 93/249]: EARFCN 2493, 878.30 MHz looking for NPSS.
[ 94/249]: EARFCN 2494, 878.40 MHz looking for NPSS.
[ 95/249]: EARFCN 2495, 878.50 MHz looking for NPSS.
[ 96/249]: EARFCN 2496, 878.60 MHz looking for NPSS.
[ 97/249]: EARFCN 2497, 878.70 MHz looking for NPSS.
[ 98/249]: EARFCN 2498, 878.80 MHz looking for NPSS.
[ 99/249]: EARFCN 2499, 878.90 MHz looking for NPSS.
[100/249]: EARFCN 2500, 879.00 MHz looking for NPSS.
[101/249]: EARFCN 2501, 879.10 MHz looking for NPSS.
[102/249]: EARFCN 2502, 879.20 MHz looking for NPSS.
[103/249]: EARFCN 2503, 879.30 MHz looking for NPSS.
[104/249]: EARFCN 2504, 879.40 MHz looking for NPSS.
[105/249]: EARFCN 2505, 879.50 MHz looking for NPSS.
NSSS with peak=3.109345, cell-id: 121, partial SFN: 0
Found CELL ID 121.
[106/249]: EARFCN 2506, 879.60 MHz looking for NPSS.
NSSS with peak=4.332994, cell-id: 82, partial SFN: 0
Found CELL ID 82.
[107/249]: EARFCN 2507, 879.70 MHz looking for NPSS.
NSSS with peak=3.191105, cell-id: 407, partial SFN: 0
Found CELL ID 407.
[108/249]: EARFCN 2508, 879.80 MHz looking for NPSS.
[109/249]: EARFCN 2509, 879.90 MHz looking for NPSS.
NSSS with peak=6.628917, cell-id: 44, partial SFN: 0
Found CELL ID 44.
[110/249]: EARFCN 2510, 880.00 MHz looking for NPSS.
[111/249]: EARFCN 2511, 880.10 MHz looking for NPSS.
[112/249]: EARFCN 2512, 880.20 MHz looking for NPSS.
[113/249]: EARFCN 2513, 880.30 MHz looking for NPSS.
[114/249]: EARFCN 2514, 880.40 MHz looking for NPSS.
[115/249]: EARFCN 2515, 880.50 MHz looking for NPSS.
[116/249]: EARFCN 2516, 880.60 MHz looking for NPSS.
[117/249]: EARFCN 2517, 880.70 MHz looking for NPSS.
[118/249]: EARFCN 2518, 880.80 MHz looking for NPSS.
[119/249]: EARFCN 2519, 880.90 MHz looking for NPSS.
[120/249]: EARFCN 2520, 881.00 MHz looking for NPSS.
[121/249]: EARFCN 2521, 881.10 MHz looking for NPSS.
[122/249]: EARFCN 2522, 881.20 MHz looking for NPSS.
[123/249]: EARFCN 2523, 881.30 MHz looking for NPSS.
[124/249]: EARFCN 2524, 881.40 MHz looking for NPSS.
[125/249]: EARFCN 2525, 881.50 MHz looking for NPSS.
[126/249]: EARFCN 2526, 881.60 MHz looking for NPSS.
[127/249]: EARFCN 2527, 881.70 MHz looking for NPSS.
[128/249]: EARFCN 2528, 881.80 MHz looking for NPSS.
[129/249]: EARFCN 2529, 881.90 MHz looking for NPSS.
[130/249]: EARFCN 2530, 882.00 MHz looking for NPSS.
[131/249]: EARFCN 2531, 882.10 MHz looking for NPSS.
[132/249]: EARFCN 2532, 882.20 MHz looking for NPSS.
[133/249]: EARFCN 2533, 882.30 MHz looking for NPSS.
[134/249]: EARFCN 2534, 882.40 MHz looking for NPSS.
[135/249]: EARFCN 2535, 882.50 MHz looking for NPSS.
[136/249]: EARFCN 2536, 882.60 MHz looking for NPSS.
[137/249]: EARFCN 2537, 882.70 MHz looking for NPSS.
[138/249]: EARFCN 2538, 882.80 MHz looking for NPSS.
[139/249]: EARFCN 2539, 882.90 MHz looking for NPSS.
[140/249]: EARFCN 2540, 883.00 MHz looking for NPSS.
[141/249]: EARFCN 2541, 883.10 MHz looking for NPSS.
[142/249]: EARFCN 2542, 883.20 MHz looking for NPSS.
[143/249]: EARFCN 2543, 883.30 MHz looking for NPSS.
[144/249]: EARFCN 2544, 883.40 MHz looking for NPSS.
[145/249]: EARFCN 2545, 883.50 MHz looking for NPSS.
[146/249]: EARFCN 2546, 883.60 MHz looking for NPSS.
[147/249]: EARFCN 2547, 883.70 MHz looking for NPSS.
[148/249]: EARFCN 2548, 883.80 MHz looking for NPSS.
[149/249]: EARFCN 2549, 883.90 MHz looking for NPSS.
[150/249]: EARFCN 2550, 884.00 MHz looking for NPSS.
[151/249]: EARFCN 2551, 884.10 MHz looking for NPSS.
[152/249]: EARFCN 2552, 884.20 MHz looking for NPSS.
[153/249]: EARFCN 2553, 884.30 MHz looking for NPSS.
[154/249]: EARFCN 2554, 884.40 MHz looking for NPSS.
[155/249]: EARFCN 2555, 884.50 MHz looking for NPSS.
[156/249]: EARFCN 2556, 884.60 MHz looking for NPSS.
[157/249]: EARFCN 2557, 884.70 MHz looking for NPSS.
[158/249]: EARFCN 2558, 884.80 MHz looking for NPSS.
[159/249]: EARFCN 2559, 884.90 MHz looking for NPSS.
[160/249]: EARFCN 2560, 885.00 MHz looking for NPSS.
[161/249]: EARFCN 2561, 885.10 MHz looking for NPSS.
[162/249]: EARFCN 2562, 885.20 MHz looking for NPSS.
[163/249]: EARFCN 2563, 885.30 MHz looking for NPSS.
[164/249]: EARFCN 2564, 885.40 MHz looking for NPSS.
[165/249]: EARFCN 2565, 885.50 MHz looking for NPSS.
[166/249]: EARFCN 2566, 885.60 MHz looking for NPSS.
[167/249]: EARFCN 2567, 885.70 MHz looking for NPSS.
[168/249]: EARFCN 2568, 885.80 MHz looking for NPSS.
[169/249]: EARFCN 2569, 885.90 MHz looking for NPSS.
[170/249]: EARFCN 2570, 886.00 MHz looking for NPSS.
[171/249]: EARFCN 2571, 886.10 MHz looking for NPSS.
[172/249]: EARFCN 2572, 886.20 MHz looking for NPSS.
[173/249]: EARFCN 2573, 886.30 MHz looking for NPSS.
[174/249]: EARFCN 2574, 886.40 MHz looking for NPSS.
[175/249]: EARFCN 2575, 886.50 MHz looking for NPSS.
[176/249]: EARFCN 2576, 886.60 MHz looking for NPSS.
[177/249]: EARFCN 2577, 886.70 MHz looking for NPSS.
[178/249]: EARFCN 2578, 886.80 MHz looking for NPSS.
[179/249]: EARFCN 2579, 886.90 MHz looking for NPSS.
[180/249]: EARFCN 2580, 887.00 MHz looking for NPSS.
[181/249]: EARFCN 2581, 887.10 MHz looking for NPSS.
[182/249]: EARFCN 2582, 887.20 MHz looking for NPSS.
[183/249]: EARFCN 2583, 887.30 MHz looking for NPSS.
[184/249]: EARFCN 2584, 887.40 MHz looking for NPSS.
[185/249]: EARFCN 2585, 887.50 MHz looking for NPSS.
[186/249]: EARFCN 2586, 887.60 MHz looking for NPSS.
[187/249]: EARFCN 2587, 887.70 MHz looking for NPSS.
[188/249]: EARFCN 2588, 887.80 MHz looking for NPSS.
[189/249]: EARFCN 2589, 887.90 MHz looking for NPSS.
[190/249]: EARFCN 2590, 888.00 MHz looking for NPSS.
[191/249]: EARFCN 2591, 888.10 MHz looking for NPSS.
[192/249]: EARFCN 2592, 888.20 MHz looking for NPSS.
[193/249]: EARFCN 2593, 888.30 MHz looking for NPSS.
[194/249]: EARFCN 2594, 888.40 MHz looking for NPSS.
[195/249]: EARFCN 2595, 888.50 MHz looking for NPSS.
[196/249]: EARFCN 2596, 888.60 MHz looking for NPSS.
[197/249]: EARFCN 2597, 888.70 MHz looking for NPSS.
[198/249]: EARFCN 2598, 888.80 MHz looking for NPSS.
[199/249]: EARFCN 2599, 888.90 MHz looking for NPSS.
[200/249]: EARFCN 2600, 889.00 MHz looking for NPSS.
[201/249]: EARFCN 2601, 889.10 MHz looking for NPSS.
[202/249]: EARFCN 2602, 889.20 MHz looking for NPSS.
[203/249]: EARFCN 2603, 889.30 MHz looking for NPSS.
[204/249]: EARFCN 2604, 889.40 MHz looking for NPSS.
[205/249]: EARFCN 2605, 889.50 MHz looking for NPSS.
[206/249]: EARFCN 2606, 889.60 MHz looking for NPSS.
[207/249]: EARFCN 2607, 889.70 MHz looking for NPSS.
[208/249]: EARFCN 2608, 889.80 MHz looking for NPSS.
[209/249]: EARFCN 2609, 889.90 MHz looking for NPSS.
[210/249]: EARFCN 2610, 890.00 MHz looking for NPSS.
[211/249]: EARFCN 2611, 890.10 MHz looking for NPSS.
[212/249]: EARFCN 2612, 890.20 MHz looking for NPSS.
[213/249]: EARFCN 2613, 890.30 MHz looking for NPSS.
[214/249]: EARFCN 2614, 890.40 MHz looking for NPSS.
[215/249]: EARFCN 2615, 890.50 MHz looking for NPSS.
[216/249]: EARFCN 2616, 890.60 MHz looking for NPSS.
[217/249]: EARFCN 2617, 890.70 MHz looking for NPSS.
[218/249]: EARFCN 2618, 890.80 MHz looking for NPSS.
[219/249]: EARFCN 2619, 890.90 MHz looking for NPSS.
[220/249]: EARFCN 2620, 891.00 MHz looking for NPSS.
[221/249]: EARFCN 2621, 891.10 MHz looking for NPSS.
[222/249]: EARFCN 2622, 891.20 MHz looking for NPSS.
[223/249]: EARFCN 2623, 891.30 MHz looking for NPSS.
[224/249]: EARFCN 2624, 891.40 MHz looking for NPSS.
[225/249]: EARFCN 2625, 891.50 MHz looking for NPSS.
[226/249]: EARFCN 2626, 891.60 MHz looking for NPSS.
[227/249]: EARFCN 2627, 891.70 MHz looking for NPSS.
[228/249]: EARFCN 2628, 891.80 MHz looking for NPSS.
[229/249]: EARFCN 2629, 891.90 MHz looking for NPSS.
[230/249]: EARFCN 2630, 892.00 MHz looking for NPSS.
[231/249]: EARFCN 2631, 892.10 MHz looking for NPSS.
[232/249]: EARFCN 2632, 892.20 MHz looking for NPSS.
[233/249]: EARFCN 2633, 892.30 MHz looking for NPSS.
[234/249]: EARFCN 2634, 892.40 MHz looking for NPSS.
[235/249]: EARFCN 2635, 892.50 MHz looking for NPSS.
[236/249]: EARFCN 2636, 892.60 MHz looking for NPSS.
[237/249]: EARFCN 2637, 892.70 MHz looking for NPSS.
[238/249]: EARFCN 2638, 892.80 MHz looking for NPSS.
[239/249]: EARFCN 2639, 892.90 MHz looking for NPSS.
[240/249]: EARFCN 2640, 893.00 MHz looking for NPSS.
[241/249]: EARFCN 2641, 893.10 MHz looking for NPSS.
[242/249]: EARFCN 2642, 893.20 MHz looking for NPSS.
[243/249]: EARFCN 2643, 893.30 MHz looking for NPSS.
[244/249]: EARFCN 2644, 893.40 MHz looking for NPSS.
[245/249]: EARFCN 2645, 893.50 MHz looking for NPSS.
[246/249]: EARFCN 2646, 893.60 MHz looking for NPSS.
[247/249]: EARFCN 2647, 893.70 MHz looking for NPSS.
[248/249]: EARFCN 2648, 893.80 MHz looking for NPSS.
Found 4 cells
Found CELL 879.5 MHz, EARFCN=2505, PHYID=121, NPSS power=-1.6 dBm
Found CELL 879.6 MHz, EARFCN=2506, PHYID=82, NPSS power=4.0 dBm
Found CELL 879.7 MHz, EARFCN=2507, PHYID=407, NPSS power=-6.7 dBm
Found CELL 879.9 MHz, EARFCN=2509, PHYID=44, NPSS power=0.4 dBm
Bye
即总共发现了四个不同频率的NB-IoT载波,以第一个为例,其载波频率为879.5MHz;EARFCN即E-UTRA Absolute Radio Frequency Channel Number,表示LTE绝对频点号,由它可以计算该LTE频点的中心频率,计算方法可以参考LTE频点计算公式及频点号对应表;PHYID表示所属小区的ID识别号,为121;NPSS即Narrowband Primary Synchronization Signal,表示窄带主同步信号,后面的数值体现了该信号的强弱
- 使用
npdsch_ue
解码第四个基站的下行数据
./npdsch_ue -f 879.9e6
解码情况如下所示
Opening RF device...
Available RF device list: UHD
Trying to open RF device 'UHD'
[INFO] [UHD] linux; GNU C++ version 9.3.0; Boost_107100; UHD_3.15.0.HEAD-0-gaea0e2de
[INFO] [LOGGING] Fastpath logging disabled at runtime.
Opening USRP channels=1, args: type=x300,master_clock_rate=184.32e6
[INFO] [UHD RF] RF UHD Generic instance constructed
[INFO] [X300] X300 initialization sequence...
[INFO] [X300] Connecting to niusrpriorpc at localhost:5444...
[INFO] [X300] Using LVBITX bitfile /usr/local/share/uhd/images/usrp_x310_fpga_HG.lvbitx
[INFO] [X300] Radio 1x clock: 184.32 MHz
[INFO] [GPS] Found an internal GPSDO: LC_XO, Firmware Rev 0.929b
[INFO] [0/DmaFIFO_0] Initializing block control (NOC ID: 0xF1F0D00000000000)
[INFO] [0/DmaFIFO_0] BIST passed (Throughput: 1320 MB/s)
[INFO] [0/DmaFIFO_0] BIST passed (Throughput: 1299 MB/s)
[INFO] [0/Radio_0] Initializing block control (NOC ID: 0x12AD100000000001)
[INFO] [0/Radio_1] Initializing block control (NOC ID: 0x12AD100000000001)
[INFO] [0/DDC_0] Initializing block control (NOC ID: 0xDDC0000000000000)
[INFO] [0/DDC_1] Initializing block control (NOC ID: 0xDDC0000000000000)
[INFO] [0/DUC_0] Initializing block control (NOC ID: 0xD0C0000000000000)
[INFO] [0/DUC_1] Initializing block control (NOC ID: 0xD0C0000000000000)
RF device 'UHD' successfully opened
Set RX gain: 70.0 dB
Set RX freq: 879.900000 MHz
Setting sampling rate 1.92 MHz
Actual sampling rate 1.92 MHz
NSSS with peak=5.396919, cell-id: 44, partial SFN: 0
*Found n_id_ncell: 44 DetectRatio= 0% PSR=9.72, Power=69.0 dBm
Finding PSS... Peak: 4.0, FrameCnt: 0, State: 100
Finding PSS... Peak: 7.2, FrameCnt: 0, State: 100
MIB received (CFO: -0.07 kHz) FrameCnt: 0, State: 100
Finding PSS... Peak: 10.3, FrameCnt: 0, State: 100
SIGINT received. Exiting....1, FrameCnt: 0, State: 1 0
Saving PCAP file
Bye
5.2 4G端到端系统
本实例旨在实现UE与eNB的空中通信,具体硬件配置架构如下图所示
其中,核心网部分srsepc
和基站部分srsenb
可以作为网络内置配置在同一台电脑运行,srsue
则在另一台电脑上运行。两台电脑的USRP设备按步骤2各自实现配置即可。电脑和所连接的USRP设备IP地址可设置如下
设备 | IP Address |
---|---|
UE-主机 | 192.168.10.2 |
UE-USRP | 192.168.10.22 |
eNB-主机 | 192.168.10.1 |
eNB-USRP | 192.168.10.11 |
因为我的基站侧电脑采用PCIe线缆和USRP设备进行通信,所以基站侧的主机IP无需进行静态配置 |
- eNB侧
sudo srsepc
使用默认配置,这将在eNB侧的主机上创建一个IP为172.16.0.1
的虚拟网络接口srs_spgw_sgi,此后所有连接到该基站的UE将在此网络中分配一个IP
sudo srsenb #在另一个终端执行
- UE侧
sudo srsue
使用默认配置,这将在UE侧的主机上创建一个IP为172.16.0.x
的虚拟网络接口tun_srsue,该接口可用作 PC上的任何其他网络接口,支持进出网络的数据流量。随后UE会在通信范围内主动搜索存在的基站并建立RRC连接发起随机接入,随后将在网络172.16.0.x
中分配到一个IP,假设分配到172.16.0.2
。成功实现网络连接的示例控制台输出如下图所示(进入RRC IDLE后需要在控制台上敲入t
启用指标跟踪)
开启另一个终端,执行ping 172.16.0.1
,控制台便会出现实时的指标跟踪情况
5.3 基站小区切换 IMPORTANT
5.3.1 Intra-eNB
5.3.2 Inter-eNB
To Be Continue
✨如有问题欢迎在底下评论留言或私信!
如果这篇【文章】对你有帮助😄,希望可以给博主【点个赞👍】鼓励一下😘
❤️Thanks for your encouragement❤️