pluto sdr使用gps-sdr-sim
在前文中捣鼓了hackrf使用gps-sdr-sim - cyqsd's blog,虽然hackrf one有着诸多优点,但是毕竟收发不能同时进行的硬件限制在哪里,真要进行一些测试,还是没有那么方便的,这个时候使用Pluto SDR就是更好的选择。可以使用以前弄的zynq-zc702+fmcomms2+Linux环境搭建和编译 - cyqsd's blog进行测试,因为里面已经是Pluto SDR的固件了,就直接拿来用就行。本次的操作都在Windows11平台上,如果是Linux可以参考官方教程。
本次使用的还是项目:osqzss/gps-sdr-sim: Software-Defined GPS Signal Simulator,不过看到项目在2025年1月27日已经被设置为只读了,估计后续不再更新了。
编译
进入项目的目录:player/plutoplayer_win
中,gps-sdr-sim/player/plutoplayer_win at master · osqzss/gps-sdr-sim,里面有使用Visual Studio 2022编译的说明。
### Build on Windows with Visual Studio 2022
The libiio library can be obtained on the [Github](https://github.com/analogdevicesinc/libiio/releases) page of the project. Download __Windows.zip__ for the latest stabel build and extract it.
1. Start Visual Studio 2022
2. Create an empty project for a console application
3. On the _Solution Explorer_ at right, add the source files to the project.
4. Add the paths to the following folder in `Configuration Properties -> C/C++ -> General -> Additional Include Directories`:
* __Windows/include__ for iio.h
5. Add the paths to the following folder in `Configuration Properties -> Linker -> General -> Additional Library Directories`:
* __Windows/Windows-VS-2022-x64__ for libiio.lib
6. Specify the name of the additional library in `Configuration Properties -> Linker -> Input -> Additional Dependencies`:
* __libiio.lib__
7. Select __Release__ in the _Solution Configurations_ drop-down list
8. Select __X64__ in the _Sofution Platforms_ drop-down list
9. Run `Build -> Build Solution`
After a successful build, you can find the executable in the __Release/x64__ folder. Copy it into the __Windows/Windows-VS-2022-x64__ folder and run it.
### 使用Visual Studio 2022在Windows上构建
可以在项目的[Github](https://github.com/analogdevicesinc/libiio/releases)页面获取libiio库。下载最新稳定版本的__Windows.zip__并解压。
1. 启动Visual Studio 2022
2. 创建一个空的控制台应用程序项目
3. 在右侧的_解决方案资源管理器_中,将源文件添加到项目中
4. 在`配置属性 -> C/C++ -> 常规 -> 附加包含目录`中添加以下文件夹路径:
* __Windows/include__(用于iio.h)
5. 在`配置属性 -> 链接器 -> 常规 -> 附加库目录`中添加以下文件夹路径:
* __Windows/Windows-VS-2022-x64__(用于libiio.lib)
6. 在`配置属性 -> 链接器 -> 输入 -> 附加依赖项`中指定附加库的名称:
* __libiio.lib__
7. 在_解决方案配置_下拉列表中选择__Release__
8. 在_解决方案平台_下拉列表中选择__X64__
9. 执行`生成 -> 生成解决方案`
构建成功后,可在__Release/x64__文件夹中找到可执行文件。将其复制到__Windows/Windows-VS-2022-x64__文件夹中并运行。
新建一个空白的纯C++项目,然后按下面的结构放入文件:
生成成功就可以使用了。
测试
Pluto SDR的硬件这边,因为是自己编译的,里面得自己配置一下。我这就设置直连了。
# 设置IP地址和子网掩码
ip addr add 192.168.1.10/24 dev eth0
# 确保接口已启用
ip link set eth0 up
Project1.exe
是编译好的可执行文件,还需要iio的依赖库,因为我本来就是用的PothosSDR编译好的iio,就直接把可执行文件复制过去就行,就像下面这样:
<DIR> .
<DIR> ..
1,580,280,000 gpssim.bin
49,664 iio_attr.exe
29,184 iio_genxml.exe
32,768 iio_info.exe
33,792 iio_readdev.exe
29,184 iio_reg.exe
34,304 iio_writedev.exe
14,457 libiio-py39-amd64.tar.gz
27,136 libiio-sharp.dll
110,080 libiio.dll
22,150 libiio.exp
3,314 libiio.iss
36,920 libiio.lib
1,249,280 libiio.pdb
300,639 libserialport-0.dll
166,912 libusb-1.0.dll
1,434,112 libxml2.dll
567,328 msvcp140.dll
19,968 Project1.exe
98,336 vcruntime140.dll
20 个文件 1,584,539,528 字节
2 个目录 80,969,359,360 可用字节
直接运行可以看到参数。
C:\Users\cyqsd\Desktop\Windows-VS-2022-x64>Project1.exe
Specify a path to a file to transmit
Usage: plutoplayer [options]
-t <filename> Transmit data from file (required)
-a <attenuation> Set TX attenuation [dB] (default -20.0)
-b <bw> Set RF bandwidth [MHz] (default 5.0)
-u <uri> ADALM-Pluto URI
-n <network> ADALM-Pluto network IP or hostname (default pluto.local)
指定要传输的文件路径
用法:plutoplayer [选项]
-t <文件名> 从文件传输数据(必需)
-a <衰减> 设置发射衰减 [dB](默认 -20.0)
-b <带宽> 设置射频带宽 [MHz](默认 5.0)
-u <uri> ADALM-Pluto URI
-n <网络> ADALM-Pluto 网络 IP 或主机名(默认 pluto.local)
本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。