0x00前言
本人第一次写博客,大佬不喜勿喷
笔者入手usrp之后折腾了足足3天才弄好uhd,很多东西要fq下载,很慢也很麻烦,所有才有了这篇博客,images镜像在末尾(版本v3.14.0.0),,,
0x01软硬件:
硬件:USRP B210
软件:Ububtu 16.04 LTS/18.04 LTS(笔者均成功编译安装)
在vmware pro 15运行 (4GB RAM | 4核 2.8ghz i7 7700 | 40g ssd)
0x02依赖环境(很重要):
±------------------------------------linux基础差得同学看这里--------------------------------------+
如果你是第一次!使用ubuntu系统,完成以下操作后食用更佳(_),大神可以直接跳过。。
1.如何打开shell终端
直接摁 Ctrl+Alt+T
2.设置root用户密码
sudo passwd root #之后输入你要设置的密码(密码不显示,不用害怕键盘坏了)
登录root用户
su root #之后输入你之前设置的密码(密码不显示,不用害怕键盘坏了)
3.将系统语言设置为中文
ubuntu16 (优秀文章):
https://jingyan.baidu.com/article/5553fa82cedaa265a2393420.html
ubuntu18(优秀文章):
https://jingyan.baidu.com/article/3aed632edafe2b7011809148.html
±------------------------------------linux入门教程结束(滑稽)--------------------------------------+
ubuntu 14.04/14.10依赖:
sudo apt-get -y install git swig cmake doxygen build-essential libboost-all-dev libtool libusb-1.0-0 libusb-1.0-0-dev
libudev-dev libncurses5-dev libfftw3-bin libfftw3-dev libfftw3-doc libcppunit-1.13-0 libcppunit-dev libcppunit-doc
ncurses-bin cpufrequtils python-numpy python-numpy-doc python-numpy-dbg python-scipy python-docutils qt4-bin-
dbg qt4-default qt4-doc libqt4-dev libqt4-dev-bin python-qt4 python-qt4-dbg python-qt4-dev python-qt4-doc python-
qt4-doc libfftw3-bin libfftw3-dev libfftw3-doc ncurses-bin libncurses5 libncurses5-dev libncurses5-dbg libfontconfig1-
dev libxrender-dev libpulse-dev swig g++ automake autoconf libtool python-dev libfftw3-dev libcppunit-dev libboost-
all-dev libusb-dev libusb-1.0-0-dev fort77 libsdl1.2-dev python-wxgtk2.8 git-core libqt4-dev python-numpy ccache
python-opengl libgsl0-dev python-cheetah python-mako python-lxml doxygen qt4-default qt4-dev-tools libusb-1.0-0-
dev libqwt5-qt4-dev libqwtplot3d-qt4-dev pyqt4-dev-tools python-qwt5-qt4 cmake git-core wget libxi-dev gtk2-engines-
pixbuf r-base-dev python-tk liborc-0.4-0 liborc-0.4-dev libasound2-dev python-gtk2 libzmq1 libzmq-dev python-
requests python-sphinx libcomedi-dev python-setuptool
ubuntu 16.04依赖:
sudo apt-get -y install git swig cmake doxygen build-essential libboost-all-dev libtool libusb-1.0-0 libusb-1.0-0-dev
libudev-dev libncurses5-dev libfftw3-bin libfftw3-dev libfftw3-doc libcppunit-1.13-0v5 libcppunit-dev libcppunit-doc
ncurses-bin cpufrequtils python-numpy python-numpy-doc python-numpy-dbg python-scipy python-docutils qt4-bin-
dbg qt4-default qt4-doc libqt4-dev libqt4-dev-bin python-qt4 python-qt4-dbg python-qt4-dev python-qt4-doc python-
qt4-doc libqwt6abi1 libfftw3-bin libfftw3-dev libfftw3-doc ncurses-bin libncurses5 libncurses5-dev libncurses5-dbg
libfontconfig1-dev libxrender-dev libpulse-dev swig g++ automake autoconf libtool python-dev libfftw3-dev libcppunit-
dev libboost-all-dev libusb-dev libusb-1.0-0-dev fort77 libsdl1.2-dev python-wxgtk3.0 git-core libqt4-dev python-
numpy ccache python-opengl libgsl-dev python-cheetah python-mako python-lxml doxygen qt4-default qt4-dev-tools
libusb-1.0-0-dev libqwt5-qt4-dev libqwtplot3d-qt4-dev pyqt4-dev-tools python-qwt5-qt4 cmake git-core wget libxi-dev
gtk2-engines-pixbuf r-base-dev python-tk liborc-0.4-0 liborc-0.4-dev libasound2-dev python-gtk2 libzmq-dev libzmq1
python-requests python-sphinx libcomedi-dev python-zmq python-setuptools
ubuntu 18.04依赖:
sudo apt-get -y install git swig cmake doxygen build-essential libboost-all-dev libtool libusb-1.0-0 libusb-1.0-0-dev
libudev-dev libncurses5-dev libfftw3-bin libfftw3-dev libfftw3-doc libcppunit-1.14-0 libcppunit-dev libcppunit-doc
ncurses-bin cpufrequtils python-numpy python-numpy-doc python-numpy-dbg python-scipy python-docutils qt4-bin-
dbg qt4-default qt4-doc libqt4-dev libqt4-dev-bin python-qt4 python-qt4-dbg python-qt4-dev python-qt4-doc python-
qt4-doc libqwt6abi1 libfftw3-bin libfftw3-dev libfftw3-doc ncurses-bin libncurses5 libncurses5-dev libncurses5-dbg
libfontconfig1-dev libxrender-dev libpulse-dev swig g++ automake autoconf libtool python-dev libfftw3-dev libcppunit-
dev libboost-all-dev libusb-dev libusb-1.0-0-dev fort77 libsdl1.2-dev python-wxgtk3.0 git libqt4-dev python-numpy
ccache python-opengl libgsl-dev python-cheetah python-mako python-lxml doxygen qt4-default qt4-dev-tools libusb-
1.0-0-dev libqwtplot3d-qt5-dev pyqt4-dev-tools python-qwt5-qt4 cmake git wget libxi-dev gtk2-engines-pixbuf r-base-
dev python-tk liborc-0.4-0 liborc-0.4-dev libasound2-dev python-gtk2 libzmq3-dev libzmq5 python-requests python-
sphinx libcomedi-dev python-zmq libqwt-dev libqwt6abi1 python-six libgps-dev libgps23 gpsd gpsd-clients python-gps
python-setuptools
0x03下载&&编译源码
创建工作区(强迫症)
cd ~
mkdir workarea-uhd && cd workarea-uhd
从github上克隆源码
git clone https://github.com/EttusResearch/uhd
cd uhd
查看可用分支,
git tag -l
...
release_003_009_004
release_003_009_005
release_003_010_000_000
切换分支 git checkout -b xxx
如果要使用笔者分享的images,看这里(不用的可以跳过)
笔者images使用3.14.0,所以uhd必须支持3.14.0版本
git checkout -b v3.14.0.0
完成之后编译安装源码
cd host
mkdir build && cd build
sudo cmake ../ #如果报错说明依赖没有装好,要重新安装
正常情况下的cmake。。。。
然后就是进入漫长的编译(大概10-20min)
sudo make #可使用-j参数加速编译(-jx x是处理器核心数,不能多于实际数量否则会JJ)
sudo make test
sudo make install
sudo ldconfig #共享缓存
export LD_LIBRARY_PATH=/usr/local/lib
0x04下载镜像
通道一:官网下载镜像(需要fq)
sudo uhd_images_downloader
通道二:笔者分享的镜像(百度网盘)
网盘下载完成后解压
链接: https://pan.baidu.com/s/1nsgsXcRzH-DMNUXGVlUw8w 提取码: xafe 复制这段内容后打开百度网盘手机App,操作更方便哦
下载后需要解压,然后复制到uhd安装目录
cp -r images /usr/local/share/uhd
0x05使用uhd
1.必须是root用户才能访问usblib,所以必须使用root用户执行uhd命令(或者sudo)
sudo uhd_fing_devices
sudo uhd_usrp_prode
第一次执行要写入FPGA镜像,要卡一会,属于正常现象请勿惊慌(3-8min)
如果一切正常会显示出usrp的具体信息
3.USRP知识拓扑(官网翻译)
输 出 “O” “U” “u” “a” “D” “S” “L” 的意义
当运行 gnu radio 程序时,会有时看见 “O” “U” “u” “a” 字符出现在屏幕上。这一般当数据从 USRP 到 PC 机数据传输停止或什么事情发生时会出现。很好奇它的涵义?速度快的 PC 能减少这些错误吗?
“u” = USRP
“a” = audio (声卡)
“O”(“D”) = overrun (PC 无法同步地接受来自 USRP 或 声卡的数据 - PC not keeping up with received data from usrp or audio card)
“U” = underrun(PC 无法快速的提供数据 - PC not providing data quickly enough)
“S” = indicates a sequence number error in Ethernet packets marking an overrun from USRP to PC like “O”
“L” = a bunch of late packet / late transmit packet
aUaU == audio underrun (PC 无法快速地给“漏”- 声卡提供数据 - not enough samples ready to send to sound card sink)
uUuU == USRP underrun (PC 无法快速地给“漏”- USRP提供数据 - not enough sample ready to send to USRP sink)
uOuO == USRP overrun (USRP 采样掉链源于它没有及时准备到位 - USRP samples dropped because they weren’t read in time)
是的,速度快的计算机可以避免问题。当然,前提是没有让 USB 干它负荷不起的事情。理想的情况是 USB 负荷 32MB/s。建议尽量避免使用 Intel 的 Celeron 或 “缓存能力不强”的部件。
4.uhd小撬门(手动滑稽)
输入 uhd_fin 然后按TAB键试试
0xfff END
如果有想交流usrp的朋友可以加我qq:
3505932208