VMware 15.1
Ubuntu 20.04
UHD 3.15.0.0
基本操作:更新SD卡镜像、下载FPGA固件(安装的UHD版本不同,这两个文件也对应不同);配置IP地址,网线连接USRP和PC,ping 通,下载FPGA固件到USRP,然后就可以用usrp设备啦。
Getting_Started_Guide:https://kb.ettus.com/USRP_N300/N310/N320/N321_Getting_Started_Guide
连接设备前工作
更新SD卡
https://kb.ettus.com/Writing_the_USRP_File_System_Disk_Image_to_a_SD_Card
1)下载更新文件
从设备里把SD卡取出来,连接到有Linux操作系统的电脑上。
虚拟机建议:VMWare 15.1
操作系统安装了对应版本要求的UHD(UHD版本不同,SD镜像文件会不同)
运行如下命令:
sudo uhd_images_downloader -t sdimg -t n3xx
终端显示如下(UHD 3.15.0.0为例):
sudo uhd_images_downloader -t sdimg -t n3xx
[INFO] Images destination: /usr/local/share/uhd/images
[INFO] No inventory file found at /usr/local/share/uhd/images/inventory.json. Creating an empty one.
845962 kB / 845962 kB (100%) n3xx_common_sdimg_default-v3.15.0.0.zip
[INFO] Images download complete.
2)将文件镜像载入SD卡
命令:
dmesg | tail
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb 8:16 1 14.9G 0 disk
├─sdb1 8:17 1 16M 0 part /media/user/boot
├─sdb2 8:18 1 1.9G 0 part /media/user/primary
├─sdb3 8:19 1 1.9G 0 part /media/user/secondary
└─sdb4 8:20 1 11G 0 part /media/user/data
注意如上所示的四个分区,后续会用到
删除分区:注意修改user为自己的用户名
sudo umount /media/user/data
sudo umount /media/user/primary
sudo umount /media/user/secondary
sudo umount /media/user/boot
写入镜像文件的两种方法:
1)使用dd
来写入镜像:
sudo dd if=<IMAGE> of=<SD_CARD_DEV_NAME> bs=1M
注意<IMAGE>=/usr/local/share/uhd/images/usrp_n3xx_fs.sdimg
一般<SD_CARD_DEV_NAME>=/dev/sdb
示例:
sudo dd if=/usr/local/share/uhd/images/usrp_<deivce>_fs.sdimg of=/dev/sdb bs=1M
以防万一,最后运行一下:
sync
写入完毕,弹出SD卡,把SD卡装回设备。
2)使用bmaptool
写入镜像(该方法写入更快,官方说法,未验证)
sudo bmaptool copy <IMAGE> <SD_CARD_DEV_NAME> --bmap <IMAGE BMAP (*.sdimg.bmap)>
示例:
sudo bmaptool copy /usr/local/share/uhd/images/usrp_n3xx_fs.sdimg /dev/sdb --bmap /usr/local/share/uhd/images/usrp_n3xx_fs.sdimg.bmap
安装screen(用于串口连接的指令)
sudo apt install screen
下载FPGA镜像(UHD版本不同,镜像文件不同)
sudo uhd_images_downloader
下载成功时的设备镜像显示如下所示:
sudo uhd_images_downloader
[INFO] Images destination: /usr/local/share/uhd/images
00006 kB / 00006 kB (100%) usrp1_b100_fw_default-g6bea23d.zip
19810 kB / 19810 kB (100%) x3xx_x310_fpga_default-gf1ba32fe.zip
02757 kB / 02757 kB (100%) usrp2_n210_fpga_default-g6bea23d.zip
02123 kB / 02123 kB (100%) n230_n230_fpga_default-ge57dfe0.zip
00522 kB / 00522 kB (100%) usrp1_b100_fpga_default-g6bea23d.zip
00491 kB / 00491 kB (100%) b2xx_b200_fpga_default-ge57dfe0.zip
02415 kB / 02415 kB (100%) usrp2_n200_fpga_default-g6bea23d.zip
08988 kB / 08988 kB (100%) e3xx_e320_fpga_default-g3de8954a.zip
23045 kB / 23045 kB (100%) n3xx_n310_fpga_default-g3de8954a.zip
00523 kB / 00523 kB (100%) b2xx_b205mini_fpga_default-ge57dfe0.zip
18937 kB / 18937 kB (100%) x3xx_x300_fpga_default-gf1ba32fe.zip
00017 kB / 00017 kB (100%) octoclock_octoclock_fw_default-g14000041.zip
00007 kB / 00007 kB (100%) usrp2_usrp2_fw_default-g6bea23d.zip
00009 kB / 00009 kB (100%) usrp2_n200_fw_default-g6bea23d.zip
00450 kB / 00450 kB (100%) usrp2_usrp2_fpga_default-g6bea23d.zip
00144 kB / 00144 kB (100%) b2xx_common_fw_default-ga69ab0c.zip
25107 kB / 25107 kB (100%) n3xx_n320_fpga_default-g3de8954a.zip
00464 kB / 00464 kB (100%) b2xx_b200mini_fpga_default-ge57dfe0.zip
00319 kB / 00319 kB (100%) usrp1_usrp1_fpga_default-g6bea23d.zip
04839 kB / 04839 kB (100%) usb_common_windrv_default-g14000041.zip
00009 kB / 00009 kB (100%) usrp2_n210_fw_default-g6bea23d.zip
16065 kB / 16065 kB (100%) n3xx_n300_fpga_default-g3de8954a.zip
05578 kB / 05578 kB (100%) e3xx_e310_fpga_default-g4bc2c6f.zip
00885 kB / 00885 kB (100%) b2xx_b210_fpga_default-ge57dfe0.zip
[INFO] Images download complete.
以完整路径列出N3xx FPGA镜像
ls -w 1 /usr/local/share/uhd/images/usrp_n3*.bit
/usr/local/share/uhd/images/usrp_n300_fpga_AA.bit
/usr/local/share/uhd/images/usrp_n300_fpga_HG.bit
/usr/local/share/uhd/images/usrp_n300_fpga_WX.bit
/usr/local/share/uhd/images/usrp_n300_fpga_XG.bit
/usr/local/share/uhd/images/usrp_n310_fpga_AA.bit
/usr/local/share/uhd/images/usrp_n310_fpga_HG.bit
/usr/local/share/uhd/images/usrp_n310_fpga_WX.bit
/usr/local/share/uhd/images/usrp_n310_fpga_XG.bit
/usr/local/share/uhd/images/usrp_n320_fpga_AQ.bit
/usr/local/share/uhd/images/usrp_n320_fpga_HG.bit
/usr/local/share/uhd/images/usrp_n320_fpga_WX.bit
/usr/local/share/uhd/images/usrp_n320_fpga_XG.bit
/usr/local/share/uhd/images/usrp_n320_fpga_XQ.bit
显示镜像目标文件夹
[INFO] Images destination: /usr/local/share/uhd/images
FPGA镜像终端下载不成功的解决办法
(终端下载不成功有可能是网络问题,建议换个时间,重复多试几次。)
下载网址:
https://files.ettus.com/binaries/cache/
在上述网址下载没有下成功的压缩包,查看总共需要哪些压缩包:
在终端输入:
sudo uhd_images_downloader --verbose
再下载漏掉的,复制到路径/usr/local/share/uhd/images
,例如:
cp x3xx_x310_fpga_default-gfde2a94e.zip /usr/local/share/uhd/images/
再解压:
cd /usr/local/share/uhd/images/
unzip x3xx_x310_fpga_default-gfde2a94e.zip
启动设备
连接网口(注意限制MTU参数)
(USRP N3xx 系统网络配置文件路径(一般用不到):/etc/systemd/network/
)
ls /etc/systemd/network/
eth0.network sfp0.network sfp1.network
SFP0 at 1 Gb rates requires a MTU of 1500
SFP0 at 10 Gb rates requires a MTU of 9000
设置Streaming Connection
1Gb Streaming SFP Port 0
主机和USRP之间直接连接,在主机和USRP之间放置交换机或其他网络设备可能会降低传输链路的吞吐量。 尽量不要将USB转以太网适配器用于高速流接口,可能会限制性能或导致周期性的流控制错误。
HG FPGA镜像 配置 SFP Port 0
配置主机网络适配器(接口要不同于连接到1Gb RJ45的1Gb NIC/network接口设置):
IP Address: 192.168.10.1
Subnet Mask: 255.255.255.0
Gateway: 0.0.0.0
MTU: 1500
MTU的值必须是1500,不可以是automatic
测试连接:
ping 192.168.10.2
PING 192.168.10.2 (192.168.10.2) 56(84) bytes of data.
64 bytes from 192.168.10.2: icmp_seq=1 ttl=64 time=1.06 ms
^C
--- 192.168.10.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.065/1.065/1.065/0.000 ms
CTRL+C 停止 ping
10Gb Streaming SFP Port 1
电脑网口不支持10Gb的情况下,可能得外加设备提网速,不能网线直连。
Both the HG and XG FPGA images support 10Gb speeds over SFP Port 1.
主机:
IP Address: 192.168.20.1
Subnet Mask: 255.255.255.0
Gateway: 0.0.0.0
MTU: 9000
终端测试连接:
ping 192.168.20.2
Dual 10Gb Streaming SFP Ports 0/1
接口:SFP Ports 0/1
The XG FPGA image must be loaded for SFP Port 0 to operate at 10 Gb speeds. If the HG image is loaded, the port will be unresponsive at 10 Gb speeds.(加载HG镜像,10Gb网速不响应)
主机:
#1 10Gb Ethernet adapter:
IP Address: 192.168.10.1
Subnet Mask: 255.255.255.0
Gateway: 0.0.0.0
MTU: 9000
#2 10Gb Ethernet adapter:
IP Address: 192.168.20.1
Subnet Mask: 255.255.255.0
Gateway: 0.0.0.0
MTU: 9000
使用10Gb SFP或光纤电缆将USRP连接到主机计算机到SFP端口0/1
测试SFP Port 0:
ping 192.168.10.2
测试SFP Port 1:
ping 192.168.20.2
连接成功后输入:uhd_find_devices
能够看到usrp的设备信息
虚拟机连接网口额外需要的设置
1)管理员模式打开虚拟机,点击编辑->虚拟网络编辑器->vimnet0
->桥接模式->选择连接到USRP的网口名。
2)打开虚拟机,进入网络设置,配置IPv4的IP地址:192.168.10.x
,x
:与主机和设备不重合的数字,1-254
。10
:与设备在同一网段。
如:
若USRP原始IP地址为:192.168.10.2
则主机地址可设置为:192.168.10.1
虚拟机地址可设置为:192.168.10.3
3)虚拟机终端输入:ping 192.168.10.2
显示返回了信息,数据无遗漏即配置成功。
更新FPGA镜像
cd /usr/local/share/uhd/images
更新命令:
uhd_image_loader --args "type=n3xx,addr=192.168.10.2,fpga=HG"
/// 嵌入式设备更新FPGA镜像(E310 and E312):
uhd_image_loader --args "type=n3xx,fpga=HG"
AQ、XQ:连接QSFP接口
示例:
uhd_image_loader --args "type=n3xx,addr=192.168.1.151,fpga=HG"
[INFO] [UHD] linux; GNU C++ version 5.4.0 20160609; Boost_105800; UHD_3.11.1.HEAD-0-gad6b0935
[INFO] [MPMD] Initializing 1 device(s) in parallel with args: mgmt_addr=192.168.1.151,type=n3xx,product=n310,serial=313ABDA,claimed=False,skip_init=1
[INFO] [MPM.main] Launching USRP/MPM, version: 3.11.1.0-gunknown
[INFO] [MPM.main] Spawning RPC process...
[INFO] [MPM.PeriphManager] Device serial number: 313ABDA
[INFO] [MPM.PeriphManager] Found 2 daughterboard(s).
[INFO] [MPM.PeriphManager.UDP] No CHDR interfaces found!
[INFO] [MPM.PeriphManager.UDP] No CHDR interfaces found!
[INFO] [MPM.RPCServer] RPC server ready!
[INFO] [MPM.RPCServer] Spawning watchdog task...
[INFO] [MPM.PeriphManager.UDP] No CHDR interfaces found!
[INFO] [MPMD] Claimed device without full initialization.
[INFO] [MPMD IMAGE LOADER] Starting update. This may take a while.
[INFO] [MPM.PeriphManager] Updating component `fpga'
[INFO] [MPM.PeriphManager] Updating component `dts'
[INFO] [MPM.RPCServer] Resetting peripheral manager.
[INFO] [MPM.PeriphManager] Device serial number: 313ABDA
[INFO] [MPM.PeriphManager] Found 2 daughterboard(s).
[INFO] [MPMD IMAGE LOADER] Update component function succeeded.
https://files.ettus.com/manual/page_usrp_n3xx.html#n3xx_network_configuration
串口连接(对N321设备可不管)
连接usb串口线
建立串口连接(对N321设备一般可不管)
虚拟机:
将串口从主机断开,连接到虚拟机,两个串口,名称分别为:usb-Digilent_Digilent_USB_Device
;usb-Silicon_Labs_CP2105_Dual_USB_to_UART_Bridge_Controller
连接后打开终端
ls /dev/serial/by-id
usb-Digilent_Digilent_USB_Device_25163511FE00-if00-port0
usb-Digilent_Digilent_USB_Device_25163511FE00-if01-port0
usb-Silicon_Labs_CP2105_Dual_USB_to_UART_Bridge_Controller_007F6CB5-if00-port0
usb-Silicon_Labs_CP2105_Dual_USB_to_UART_Bridge_Controller_007F6CB5-if01-port0
后两个串口名称,分别拿来连接ARM CPU (if00)和 STM32 Microcontroller (if01)。
连接到 ARM CPU
注意根据终端显示,更改如下对应位置的串口名,设置波特率115200.
另开终端
sudo screen /dev/serial/by-id/usb-Silicon_Labs_CP2105_Dual_USB_to_UART_Bridge_Controller_00B5692D-if00-port0 115200
输入命令,回车,打开设备开关。
显示更新信息,最后出现提示语:done时,点击回车,出现如下信息:
OpenEmbedded test ni-n3xx-313ABDA ttyPS0
ni-n3xx-313ABDA login:
登录用户名:root
(小写),默认密码为无或者空格,输入用户名后按回车,出现:root@ni-n3xx-<motherboard serial #>:~#
<motherboard serial #>
:母板串口名。
连接到microcontroller
另开终端
sudo screen /dev/serial/by-id/usb-Silicon_Labs_CP2105_Dual_USB_to_UART_Bridge_Controller_00B5692D-if01-port0 115200
回车后会出现一堆数据,没有尽头,这个终端就可以不用管了。
其他内容,暂时没有用到
通过 SSH连接ARM
RJ45连接时,默认分配DHCP IP地址
识别 IP 地址:
ip a
如果不能用DHCP服务器连接到网络,使用dnsmasq
:
sudo dnsmasq -i <ETHERNET_ADAPTER_NAME> --dhcp-range=192.168.1.151,192.168.1.254 --except-interface=lo --bind-dynamic --no-daemon
<ETHERNET_ADAPTER_NAME>
:lo eth0 sfp0 sfp1
登录之后出现命令如下:
root@ni-n3xx-<motherboard serial #>:~#
设备关机前断开连接
1、(这个需要前面提到的连接串口操作)在连接ARM CPU的终端界面运行如下命令,其余终端输入会关闭Ubuntu。
先运行
shutdown -h now
或者
shutdown -r now
2、
短按电源键,等待设备电源指示灯熄灭,设备关机;
长按电源键,等待电源指示灯熄灭松手,稍等片刻设备重启。
或者所有运行程序确定关闭以后直接走第二步。
else
验证设备运行
N321
The USRP N321 contains 2 channels, each represented on the front panel as RF0-1. Below is the subdev mapping of RF Ports.
RF0 = A:0
RF1 = B:0
单块子板A:0
或者B:0
,两块子板A:0 B:0
(注意中间空格),num channel
设置为2
Additional details of UHD Subdevice Specifications can be found here in the UHD Manual:
http://files.ettus.com/manual/page_configuration.html#config_subdev
支持的采样率
The USRP N320/N321 supports the three fixed Master Clock Rates listed below.
200.00 MHz
245.76 MHz
250.00 MHz
改变采样率:--args "type=N3xx, addr=192.168.10.2, master_clock_rate = 200e6"
(默认245.76MHz)
http://files.ettus.com/manual/page_general.html#general_sampleratenotes
Probe the USRP
The UHD utility uhd_usrp_probe provides detailed information of the USRP device.
uhd_usrp_probe
出现如下信息:
root@i231-virtual-machine:/usr/local/share/uhd/images# uhd_usrp_probe
[INFO] [UHD] linux; GNU C++ version 9.3.0; Boost_107100; UHD_3.15.0.HEAD-0-gaea0e2de
[INFO] [MPMD] Initializing 1 device(s) in parallel with args: mgmt_addr=192.168.10.2,type=n3xx,product=n320,serial=32003A3,claimed=False,addr=192.168.10.2
[INFO] [MPM.PeriphManager] init() called with device args `product=n320,mgmt_addr=192.168.10.2,time_source=internal,clock_source=internal'.
[INFO] [MPM.Rhodium-0] init() called with args `product=n320,mgmt_addr=192.168.10.2,time_source=internal,clock_source=internal'
[INFO] [MPM.Rhodium-1] init() called with args `product=n320,mgmt_addr=192.168.10.2,time_source=internal,clock_source=internal'
[INFO] [0/Replay_0] Initializing block control (NOC ID: 0x4E91A00000000004)
[INFO] [0/Radio_0] Initializing block control (NOC ID: 0x12AD100000000320)
[INFO] [0/Radio_1] Initializing block control (NOC ID: 0x12AD100000000320)
[INFO] [0/DDC_0] Initializing block control (NOC ID: 0xDDC0000000000001)
[INFO] [0/DDC_1] Initializing block control (NOC ID: 0xDDC0000000000001)
[INFO] [0/DUC_0] Initializing block control (NOC ID: 0xD0C0000000000000)
[INFO] [0/DUC_1] Initializing block control (NOC ID: 0xD0C0000000000000)
[INFO] [0/FIFO_0] Initializing block control (NOC ID: 0xF1F0000000000000)
[INFO] [0/FIFO_1] Initializing block control (NOC ID: 0xF1F0000000000000)
_____________________________________________________
/
| Device: N300-Series Device
| _____________________________________________________
| /
| | Mboard: ni-n3xx-32003A3
| | eeprom_version: 3
| | mpm_version: 3.14.1.1-g0347a6d8
| | pid: 16962
| | product: n320
| | rev: 10
| | rpc_connection: remote
| | serial: 32003A3
| | type: n3xx
| | MPM Version: 1.2
| | FPGA Version: 5.3
| | FPGA git hash: fde2a94.clean
| | RFNoC capable: Yes
| |
| | Time sources: internal, external, gpsdo, sfp0
| | Clock sources: external, internal, gpsdo
| | Sensors: fan, ref_locked, temp, gps_tpv, gps_locked, gps_time, gps_sky, gps_gpgga
| | _____________________________________________________
| | /
| | | RX Dboard: B
| | | ID: Unknown (0x0152)
| | | Serial: 31FBF74
| | | _____________________________________________________
| | | /
| | | | RX Frontend: 0
| | | | Name: Rhodium
| | | | Antennas: TX/RX, RX2, CAL, TERM
| | | | Sensors: lo_locked
| | | | Freq range: 1.000 to 6000.000 MHz
| | | | Gain range all: 0.0 to 60.0 step 1.0 dB
| | | | Bandwidth range: 250000000.0 to 250000000.0 step 0.0 Hz
| | | | Connection Type:
| | | | Uses LO offset: No
| | | _____________________________________________________
| | | /
| | | | RX Codec: B
| | | | Name: ad9695-625
| | | | Gain Elements: None
| | _____________________________________________________
| | /
| | | RX Dboard: A
| | | ID: Unknown (0x0152)
| | | Serial: 31FBF72
| | | _____________________________________________________
| | | /
| | | | RX Frontend: 0
| | | | Name: Rhodium
| | | | Antennas: TX/RX, RX2, CAL, TERM
| | | | Sensors: lo_locked
| | | | Freq range: 1.000 to 6000.000 MHz
| | | | Gain range all: 0.0 to 60.0 step 1.0 dB
| | | | Bandwidth range: 250000000.0 to 250000000.0 step 0.0 Hz
| | | | Connection Type:
| | | | Uses LO offset: No
| | | _____________________________________________________
| | | /
| | | | RX Codec: A
| | | | Name: ad9695-625
| | | | Gain Elements: None
| | _____________________________________________________
| | /
| | | TX Dboard: B
| | | ID: Unknown (0x0152)
| | | Serial: 31FBF74
| | | _____________________________________________________
| | | /
| | | | TX Frontend: 0
| | | | Name: Rhodium
| | | | Antennas: TX/RX, CAL, TERM
| | | | Sensors: lo_locked
| | | | Freq range: 1.000 to 6000.000 MHz
| | | | Gain range all: 0.0 to 60.0 step 1.0 dB
| | | | Bandwidth range: 250000000.0 to 250000000.0 step 0.0 Hz
| | | | Connection Type:
| | | | Uses LO offset: No
| | | _____________________________________________________
| | | /
| | | | TX Codec: B
| | | | Name: dac37j82
| | | | Gain Elements: None
| | _____________________________________________________
| | /
| | | TX Dboard: A
| | | ID: Unknown (0x0152)
| | | Serial: 31FBF72
| | | _____________________________________________________
| | | /
| | | | TX Frontend: 0
| | | | Name: Rhodium
| | | | Antennas: TX/RX, CAL, TERM
| | | | Sensors: lo_locked
| | | | Freq range: 1.000 to 6000.000 MHz
| | | | Gain range all: 0.0 to 60.0 step 1.0 dB
| | | | Bandwidth range: 250000000.0 to 250000000.0 step 0.0 Hz
| | | | Connection Type:
| | | | Uses LO offset: No
| | | _____________________________________________________
| | | /
| | | | TX Codec: A
| | | | Name: dac37j82
| | | | Gain Elements: None
| | _____________________________________________________
| | /
| | | RFNoC blocks on this device:
| | |
| | | * Replay_0
| | | * Radio_0
| | | * Radio_1
| | | * DDC_0
| | | * DDC_1
| | | * DUC_0
| | | * DUC_1
| | | * FIFO_0
| | | * FIFO_1
看到WARNING
看到如下警告:
[WARNING] [UDP] The recv buffer could not be resized sufficiently.
终端运行如下命令,重置 socket buffers,一个管读buffer,一个管写buffer(具体大小看终端上在WARNING
后面的提示):
sudo sysctl -w net.core.rmem_max=288000
sudo sysctl -w net.core.wmem_max=288000
Windows
操作手册参考:
链接:https://pan.baidu.com/s/18BN1eLxxlgaCIinFnUAMkg
提取码:wqqi
1)安装最新版matlab
,下载安装Communications Toolbox Support Package for USRP Radio
支持包。
运行该工具,更新SD卡。
(或者直接采用Windows命令窗口烧写SD卡办法)
2)安装UHD:
UHD下载链接:
https://files.ettus.com/binaries/uhd_stable/uhd_003.015.000.000-release/Windows-10-x64/
下载完成后安装。
3)下载FPGA镜像
双击或命令窗口运行:
uhd_images_downloader.exe
4)烧写FPGA镜像
打开cmd
,进入路径C:\Program Files\UHD\bin
连接设备,并配置主机IP地址。
运行:uhd_image_loader --args "type=n3xx,addr=192.168.10.2,fpga=HG"
fpga镜像类型选择原则同Linux中选择方法。
在如下网页可以搜索其他设备使用信息:
https://lists.ettus.com/empathy