最近被安排做一个ADS-B信号接收的项目,之前都没有接触过fpga这些东西,拿到软件无线电模块(ANTSDR E310V2)后安装环境和软件真的太折磨了。。在此记录一下我走过的弯路,大家可以参考。
Ubuntu20.04+GNU Radio3.8+Pluto SDR:环境搭建过程记录
Step1. ANTSDR_UHD安装
- 安装依赖库
sudo apt-get install autoconf automake build-essential ccache cmake cpufrequtils doxygen ethtool \
g++ git inetutils-tools libboost-all-dev libncurses5 libncurses5-dev libusb-1.0-0 libusb-1.0-0-dev \
libusb-dev python3-dev python3-mako python3-numpy python3-requests python3-scipy python3-setuptools \
python3-ruamel.yaml
- 下载源码
git clone https://github.com/MicroPhase/antsdr_uhd
- 编译安装
cd host/
mkdir build & cd build
cmake -DENABLE_X400=OFF -DENABLE_N320=OFF -DENABLE_B100=OFF -DENABLE_B200=OFF -DENABLE_X300=OFF -DENABLE_USRP2=OFF -DENABLE_USRP1=OFF -DENABLE_N300=OFF -DENABLE_E320=OFF -DENABLE_E300=OFF ../
cmake后出现:
-- 省略若干行... ...
-- Python checking for Mako templates 0.4 or greater
-- Python checking for Mako templates 0.4 or greater - "import mako" failed
--
-- Configuring LibUHD support...
-- Dependency Boost_FOUND =
-- Dependency HAVE_PYTHON_PLAT_MIN_VERSION = TRUE
-- Dependency HAVE_PYTHON_MODULE_MAKO = FALSE
CMake Error at cmake/Modules/UHDComponent.cmake: (MESSAGE):
Dependencies for required component LibUHD not met.
Call Stack (most recent call first):
CMakeLists.txt: (LIBUHD_REGISTER_COMPONENT)
-- Configuring incomplete, errors occurred!
See also "/home/hao/software/uhd-3.9.0/build/CMakeFiles/CMakeOutput.log".
原因是依赖库Mako未安装,解决方法是**pip install Mako
**。
make
sudo make install
sudo ldconfig
sudo ldconfig可能会出现以下报错:
/sbin/ldconfig.real: /usr/local/cuda-11.3/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8 不是符号链接
- 添加环境变量
gedit $HOME/.bashrc
# add the line below to the end of ./bashrc file:
export LD_LIBRARY_PATH=/usr/local/lib
- 安装测试
uhd_find_devices
如果没有报错,则就安装成功,如下图所示。(此时还未连接usrp)
- 下载镜像文件
为了使uhd识别我们的设备,还需要下载相应设备的镜像文件:sudo uhd_images_downloader
下载UHD FPGA Images。
由于我硬件的特殊性,买来的时候开发资料里面提供了ANTSDR E310的uhd镜像文件,所以我这里直接下载好了,记得放入\usr\local\share\uhd\images文件夹中。
- 硬件连接测试
一开始什么都不懂,直接把板子的OTG接口、网口和电脑连好就开始测试,实际上还需要更改主机的以太网ip地址,使两者存在于同一个网段,能ping通才行。
这里注意查看设备的ip地址,我这里是将boot调成qspi启动模式,电脑会挂载PlutoSDR(?不太懂),里面有一个config.txt文件,说明了设备的ip地址:
其中,NETWORK是boot模式为qspi下的ip,USB ETHERNET是boot模式为sd下的ip,注意别搞混了。
因为我们想测试uhd能否识别设备,所以要把boot模式调为sd卡启动,并且配置电脑的以太网ip地址。
-
首先在终端中输入
ifconfig
,我们可以得到电脑的所有网口:其中,enp6s0是我电脑的以太网网口。
-
我们要把以太网ip地址改为与设备同样的网段。通过上面的config.txt文件可以了解到,此时设备的ip为192.168.1.10。所以作出以下更改:
sudo ifconfig enp6s0 192.168.1.100
ping一下试试:
😋嗯嗯~是可以ping通哒!那我们再试试uhd_find_devices
能不能识别我们的设备:
芜湖!成功识别!
用uhd_usrp_probe
也能成功打印出设备的信息!至此完成!!!
Step2. GNU Radio安装
很尴尬的是,我首先下载了gnuradio3.8.2,准备手动编译安装,但是在此之前我又想先装libiio,所以就进行了它的依赖库安装,没仔细看。。
sudo apt install -y gnuradio-dev libxml2 libxml2-dev bison flex cmake git libaio-dev
libboost-all-dev swig
发现gnuradio也顺带安装好了。不过是3.8.1版本
Step3. PlutoSDR driver安装
libiio安装
接着上面,我们开始安装libiio。
按照ANTSDR开发手册-GNU Radio篇进行安装即可。
- 依赖库安装
sudo apt install -y gnuradio-dev libxml2 libxml2-dev bison flex cmake git libaio-dev
libboost-all-dev swig
- 下载源码
git clone https://github.com/analogdevicesinc/libiio.git
- 编译安装
cd libiio
mkdir build && cd build
cmake -DPYTHON_BINDINGS=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr ..
make
sudo make install
sudo ldconfig
cd ../..
可能会出现的问题:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:”
主要是变量AVAHI_CLIENT_LIBRARY和AVAHI_COMMON_LIBRARY。应该是依赖库没装好。
解决方法是:sudo apt install libavahi-common-dev libavahi-client-dev
。
libad9361-iio
按照ANTSDR开发手册-GNU Radio篇进行安装即可。
git clone https://github.com/analogdevicesinc/libad9361-iio.git
cd libad9361-iio
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr ..
make
sudo make install
sudo ldconfig
cd ../..
gr-iio
git clone https://github.com/analogdevicesinc/gr-iio.git
cd gr-iio
git checkout upgrade-3.8
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr ..
make
sudo make install
cd ../..
sudo ldconfig
按照ANTSDR开发手册-GNU Radio篇进行安装会出现以下错误:
make[2]: *** 没有规则可制作目标“/usr/lib/x86_64-linux-gnu/liborc-0.4.so”,由“lib/libgnuradio-iio.so.0.3” 需求。 停止。
make[1]: *** [CMakeFiles/Makefile2:219:lib/CMakeFiles/gnuradio-iio.dir/all] 错误 2
make: *** [Makefile:130:all] 错误 2
根据官方文档,发现是因为依赖库liborc-dev没有装好,解决方法是:sudo apt install liborc-dev
。
GNU Radio运行测试
运行成功条件:qspi启动模式,此时ping 192.168.2.10
和ping ant.local
皆可ping通。
不知道为什么设置ip:192.168.2.10不行,而设置成ip:ant.local可以成功运行。
Step4. gr-air-modes安装(已弃用)
4.1 安装依赖库
sudo apt-get install sqlite3 libsqlite3-dev python-zmq python-numpy python-scipy
4.2 下载源码
git clone https://github.com/bistromath/gr-air-modes.git
4.3 编译安装
cd gr-air-modes/
mkdir build
cd build
cmake ../
cmake后会提示:
CMake Warning at res/CMakeLists.txt:28 (find_package):
By not providing "FindPyQt4.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "PyQt4", but
CMake did not find one.
Could not find a package configuration file provided by "PyQt4" with any of
the following names:
PyQt4Config.cmake
pyqt4-config.cmake
Add the installation prefix of "PyQt4" to CMAKE_PREFIX_PATH or set
"PyQt4_DIR" to a directory containing one of the above files. If "PyQt4"
provides a separate development package or SDK, be sure it has been
installed.
-- PyQt4 not found, not installing GUI application
-- Configuring done
-- Generating done
-- Build files have been written to: /home/xinyue/gr-air-modes/build
说明需要安装pyqt4。搜索一番之后发现ubuntu20.04不再支持pyqt4,直接apt-get install也不行。。痛苦。。继续尝试安装pyqt4。。也许用ubuntu18.04安装会少不少问题。。我哭死
Step5. dump1090 for PlutoSDR安装
https://github.com/PlutoSDR/dump1090
这个是plutosdr可用的dump1090,可视化地图我记得改成了openstreet(?),可以直接用。
-------------------------未完待续--------------------------------