GNU Radio: USRP2 and N2x0 Series

Comparative features list 相对性能清单

Hardware Capabilities:

  • 1 transceiver card slot
  • External PPS reference input
  • External 10 MHz reference input
  • MIMO cable shared reference
  • Fixed 100 MHz clock rate
  • Internal GPSDO option (N2x0 only)

FPGA Capabilities:

  • 2 RX DDC chains in FPGA
  • 1 TX DUC chain in FPGA
  • Timed commands in FPGA (N2x0 only)
  • Timed sampling in FPGA
  • 16-bit and 8-bit sample modes (sc8 and sc16)
    • Up to 25 MHz of RF BW with 16-bit samples
    • Up to 50 MHz of RF BW with 8-bit samples

Load the Images onto the SD card (USRP2 only) 将映像文件装入 SD 卡中(仅对 USRP2)

Warning! Use usrp2_card_burner with caution. If you specify the wrong device node, you could overwrite your hard drive. Make sure that --dev= specifies the SD card.

提示! 谨慎使用命令 usrp2_card_burner.py。如若指向错误的设备节点,可能会重写硬盘。请确认 --dev= 指向 SD 卡。

Warning! It is possible to use 3rd party SD cards with the USRP2. However, certain types of SD cards will not interface with the CPLD:

提示! 尽管理论上 USRP2 可以使用第三方 SD 卡。但是有些类型的 SD 卡不能同 CPLD 进行交互: 

  • Cards can be SDHC, which is not a supported interface. 该卡可能是 SDHC,它不支持同 CPLD 的交互。
  • Cards can have unexpected timing characteristics. 该卡有意外的时间特性

For these reasons, we recommend that you use the SD card that was supplied with the USRP2.

鉴于上面的这些因素,建议使用随机的 SD 卡。

Use the card burner tool (UNIX) 使用 Unix 烧卡工具

sudo <install-path>/lib/uhd/utils/usrp2_card_burner_gui.py

-- OR --

cd <install-path>/lib/uhd/utils
sudo ./usrp2_card_burner.py --dev=/dev/sd<XXX> --fpga=<path_to_fpga_image>
sudo ./usrp2_card_burner.py --dev=/dev/sd<XXX> --fw=<path_to_firmware_image>

Use the --list option to get a list of possible raw devices. The list result will filter out disk partitions and devices too large to be the sd card. The list option has been implemented on Linux, Mac OS X, and Windows.

使用选项 --list 可获取可能的原始设备清单。list 将会剔除容量太大无法装入 SD 卡的磁盘扇区和设备。Linux, Mac OS X, 和 Windows 都具有该 --list 选项。

Use the card burner tool (Windows) 使用 windows 烧卡工具

<path_to_python.exe> <install-path>/lib/uhd/utils/usrp2_card_burner_gui.py

Load the Images onto the On-board Flash (USRP-N Series only) 将映像文件装入板上闪存中 (仅对 USRP-N 系列)

The USRP-N Series can be reprogrammed over the network to update or change the firmware and FPGA images. When updating images, always burn both the FPGA and firmware images before power cycling. This ensures that when the device reboots, it has a compatible set of images to boot into.

USRP-N 系列产品可以通过网络进行重新编程来更新或更改固件(firmware)和 FPGA 映像(images)。但每当在更新映像(images)过程中,总是在系统重新启动(power cycling)之前对 FPGA 和固件两者的映像烧结。这便可确保设备一旦被重启,其映像文件与之配套。

Use the image loader

Use default images:

uhd_image_loader --args="type=usrp2,addr=<IP address>"

举例:给 USRP N210 刷固件可以使用下面的命令:(第一行是自动下载image镜像,如果已经下载过就不需要再执行这行了) 

$ sudo /usr/local/lib/uhd/utils/uhd_images_downloader.py
$ sudo /usr/local/bin/uhd_image_loader --args="type=usrp2,addr=192.168.10.2"
linux; GNU C++ version 4.8.4; Boost_105500; UHD_003.010.000.000-0-unknown

Unit: USRP N210 r3 (211318031, 192.168.10.2)
Firmware image: /usr/local/share/uhd/images/usrp_n210_fw.bin
-- Erasing firmware image...successful.
-- Writing firmware image...successful.
-- Verifying firmware image...successful.
FPGA image: /usr/local/share/uhd/images/usrp_n210_r3_fpga.bin
-- Erasing FPGA image...successful.
-- Writing FPGA image...successful.
-- Verifying FPGA image...successful.

默认情况下刷 r3 版本,如需刷其他版本需要使用下面自定义的方法:

 Use custom-built images:

uhd_image_loader --args="type=usrp2,addr=<IP address>" --fw-path="<firmware path>" --fpga-path="<FPGA path>"

举例:自定义 fw 和 fpga 固件版本。

$ uhd_image_loader --args="type=usrp2,addr=192.168.10.2" --fw-path="/usr/local/share/uhd/images/usrp_n210_fw.bin" --fpga-path="/usr/local/share/uhd/images/usrp_n210_r4_fpga.bin"
linux; GNU C++ version 4.8.4; Boost_105500; UHD_003.010.000.000-0-unknown

Unit: USRP N210 r4 (4095, 192.168.10.2)
Firmware image: /usr/local/share/uhd/images/usrp_n210_fw.bin
-- Erasing firmware image...successful.
-- Writing firmware image...successful.
-- Verifying firmware image...successful.
FPGA image: /usr/local/share/uhd/images/usrp_n210_r4_fpga.bin
-- Erasing FPGA image...successful.
-- Writing FPGA image...successful.
-- Verifying FPGA image...successful.

Note: Different hardware revisions require different FPGA images. Determine the revision number from the sticker on the rear of the chassis. Use this number to select the correct FPGA image for your device.

注意:不同的固件版本需要不同的 fpga 镜像。固件刷好之后,需要断电才能重新识别。

Device recovery and bricking 设备恢复

Its possible to put the device into an unusable state by loading bad images. Fortunately, the USRP-N Series can be booted into a safe (read-only) image. Once booted into the safe image, the user can once again load images onto the device.

载入有问题的映像文件可能会招致设备处于无法工作的状态。幸运的是,USRP-N 系列可以启用安全(只读)映像模式。如若启用安全映像模式,用户便可试图再次装入映像文件。

The safe-mode button is a pushbutton switch (S2) located inside the enclosure. To boot into the safe image, hold-down the safe-mode button while power-cycling the device. Continue to hold-down the button until the front-panel LEDs blink and remain solid.

壳体内的按钮(S2)便是安全模式按钮。在上电启动过程中按下该按钮便可启动安全映像模式。持续按住该按钮直到前面板的 LED 从闪烁到稳定(blink and remain solid)。

When in safe-mode, the USRP-N device will always have the IP address 192.168.10.2.

在安全模式中,USRP-N 设备的 IP 地址总是 192.168.10.2 。

For more information on using external tools to unbrick your device when even this fails, see Unbricking an N-Series Device.

Setup Networking 配置网络

The USRP2 only supports Gigabit Ethernet and will not work with a 10/100 Mbps interface. However, a 10/100 Mbps interface can be connected indirectly to a USRP2 through a Gigabit Ethernet switch.

USRP2 仅支持千兆级以太网,所以其无法同 10/100 Mbps 接口直接相互工作。尽管如此,10/100 Mbps 接口还是可以通过一个千兆级的以太网交换机间接同 USRP2 相连接。

Setup the host interface 配置主机接口

The USRP2 communicates at the IP/UDP layer over the gigabit ethernet. The default IP address of the USRP2 is 192.168.10.2. You will need to configure the host's Ethernet interface with a static IP address to enable communication. An address of 192.168.10.1 and a subnet mask of 255.255.255.0 is recommended.

USRP2 的通过千兆级以太网的通信是基于 IP/UDP 层。其缺省 IP 地址为 192.168.10.2。这样只需配置计算机侧一个静态 IP 地址便可使其相互通信。推荐使用 IP 地址 192.168.10.1 和子网掩码 255.255.255.0.

On a Linux system, you can set a static IP address very easily by using the 'ifconfig' command:

sudo ifconfig <interface> 192.168.10.1

Note that interface is usually something like eth0. You can discover the names of the network interfaces in your computer by running ifconfig without any parameters:

ifconfig -a

Note: When using UHD software, if an IP address for the USRP2 is not specified, the software will use UDP broadcast packets to locate the USRP2. On some systems, the firewall will block UDP broadcast packets. It is recommended that you change or disable your firewall settings.

备注:在使用 UHD 情况下,如若 USRP2 的 IP 地址没有被指定,应用软件便会使用 UDP 广播的数据包来定位 USRP2。存在这样一些情况,防火墙软件会阻碍 UDP 广播的数据包。在此建议更改或取消防火墙相关功用。

Multiple devices per host 单口多机化

For maximum throughput, one Ethernet interface per USRP2 is recommended, although multiple devices may be connected via a Gigabit Ethernet switch. In any case, each Ethernet interface should have its own subnet, and the corresponding USRP2 device should be assigned an address in that subnet. Example:

为最大化数据处理能力,建议一个以太网接口配置一台 USRP2 设备。尽管如此,通过千兆级的交换机也可以同多台设备相互连接。无论哪种情况,每个以太网接口单元都必须有自己的子网,其相关的 USRP2 的地址应当处于其子网范围内。例如:

  • Configuration for USRP2 device 0:
    • Ethernet interface IPv4 address: 192.168.10.1
    • Ethernet interface subnet mask: 255.255.255.0
    • USRP2 device IPv4 address: 192.168.10.2
  • Configuration for USRP2 device 1:
    • Ethernet interface IPv4 address: 192.168.20.1
    • Ethernet interface subnet mask: 255.255.255.0
    • USRP2 device IPv4 address: 192.168.20.2

Change the USRP2's IP address 更改 USRP 的 IP 地址

You may need to change the USRP2's IP address for several reasons:

基于下面可能的原因需要对 USRP2 的 IP 地址进行更改:

  • to satisfy your particular network configuration 满足特定的网络配置要求
  • to use multiple USRP2s on the same host computer 在同一宿主计算下使用多台 USRP2
  • to set a known IP address into USRP2 (in case you forgot) 使用(用户)熟知的 IP 地址(以防遗忘)

Method 1

To change the USRP2's IP address, you must know the current address of the USRP2, and the network must be setup properly as described above. Run the following commands: 

更改 USRP2 IP 地址的先决条件是必须清楚其正在使用的地址,网络也必须如上所述地被恰当的配置成功。然后运行下面的命令:

cd <install-path>/lib/uhd/utils
./usrp_burn_mb_eeprom --args=<optional device args> --values="ip-addr=192.168.10.3"

Method 2 (Linux Only)

This method assumes that you do not know the IP address of your USRP2. It uses raw Ethernet packets to bypass the IP/UDP layer to communicate with the USRP2. Run the following commands:

此方法假定在对设备现在使用的 IP 地址不清楚的情况下。它使用以太网的原始数据包短接(bypass) IP/UDP 协议层而直接同 USRP2 通信。如下运行命令:

cd <install-path>/lib/uhd/utils
sudo ./usrp2_recovery.py --ifc=eth0 --new-ip=192.168.10.3

举例:设置USRP N210 IP地址,USRP 刷过固件之后,执行 $ uhd_usrp_probe 显示的 ip-addr: 255.255.255.255 ,我们需要修改这个IP地址,或者当两个USRP N210通过MIMO Cable同步时钟和数据时,也需要设置另一台 USRP 设备的 IP 地址。方法为:

$ cd /usr/local/lib/uhd/utils
$
sudo ./usrp2_recovery.py --ifc=eth0 --new-ip=192.168.10.2

Communication Problems 通信问题

When setting up a development machine for the first time, you may have various difficulties communicating with the USRP device. The following tips are designed to help narrow down and diagnose the problem.

首次构建一个开发平台时,碰到各种各样的 USRP 通信问题是不足为奇的。下面便是一些简化的问题和诊断的建议。

RuntimeError: no control response

This is a common error that occurs when you have set the subnet of your network interface to a different subnet than the network interface of the USRP device. For example, if your network interface is set to 192.168.20.1, and the USRP device is 192.168.10.2 (note the difference in the third numbers of the IP addresses), you will likely see a 'no control response' error message.

Fixing this is simple - just set the your host PC's IP address to the same subnet as that of your USRP device. Instructions for setting your IP address are in the previous section of this documentation.

Firewall issues 防火请问题

When the IP address is not specified, the device discovery broadcasts UDP packets from each ethernet interface. Many firewalls will block the replies to these broadcast packets. If disabling your system's firewall or specifying the IP address yields a discovered device, then your firewall may be blocking replies to UDP broadcast packets. If this is the case, we recommend that you disable the firewall or create a rule to allow all incoming packets with UDP source port 49152.

在没有配置设备的 IP 地址的情况下,设备查询机制便会通过各个以太网接口广播 UDP 数据包来试图建立相互间的通信。众多防火墙会阻碍对这些广播信息的反馈。如若(如此,只能)禁止系统的防火墙功能、或明晰需确认的设备的 IP 地址。在此情况下的建议是:要么关闭防火墙、要么建立一个规则为端口号为 49152 的 UDP 的数据源建立通道。

Ping the device "ping" 设备

The USRP device will reply to ICMP echo requests. A successful ping response means that the device has booted properly and that it is using the expected IP address.

USRP 响应 icmp echo 。 成功的 ping 意味着设备已经被成功地启动,也意味着希望的 IP 地址被成功的配置。

ping 192.168.10.2

Monitor the serial output 监视串口输出

Read the serial port to get debug verbose output from the embedded microcontroller. The microcontroller prints useful information about IP addresses, MAC addresses, control packets, fast-path settings, and bootloading. Use a standard USB to 3.3v-level serial converter at 230400 baud. Connect GND to the converter ground, and connect TXD to the converter receive. The RXD pin can be left unconnected as this is only a one-way communication.

  • USRP2: Serial port located on the rear edge
  • N210: Serial port located on the left side

Monitor the host network traffic 监视网络流量

Use Wireshark to monitor packets sent to and received from the device.

Addressing the Device 配置设备地址

Single device configuration 单一设备配置

In a single-device configuration, the USRP device must have a unique IPv4 address on the host computer. The USRP can be identified through its IPv4 address, resolvable hostname, or by other means. See the application notes on Device Identification. Please note that this addressing scheme should also be used with the multi_usrp interface.

Example device address string representation for a USRP2 with IPv4 address 192.168.10.2:

addr=192.168.10.2

Multiple device configuration 多台设备配置

In a multi-device configuration, each USRP device must have a unique IPv4 address on the host computer. The device address parameter keys must be suffixed with the device index. Each parameter key should be of the format <key><index>. Use this addressing scheme with the uhd::usrp::multi_usrp interface.

  • The order in which devices are indexed corresponds to the indexing of the transmit and receive channels.
  • The key indexing provides the same granularity of device identification as in the single device case.

Example device address string representation for 2 USRP2s with IPv4 addresses 192.168.10.2 and 192.168.20.2:

addr0=192.168.10.2, addr1=192.168.20.2

Using the MIMO Cable 使用 MIMO 电缆

The MIMO cable allows two USRP devices to share reference clocks, time synchronization, and the Ethernet interface. One of the devices will sync its clock and time references to the MIMO cable. This device will be referred to as the slave, and the other device, the master.

MIMO Cable 允许两个USRP设备共享时钟,时间同步,网口。其中一个设备将会同步它的时钟,时间参考来自MIMO Cable。这个设备被称作从设备(slave),另一个设备被称作主设备(master)。

  • The slave device acquires the clock and time references from the master device.  从设备从主设备哪里获得时钟和时间参考。
  • The master and slave may be used individually or in a multi-device configuration. 主设备和从设备可能使用独立的或者多设备配置
  • External clocking is optional and should only be supplied to the master device. 外部时钟是课选的,并且只有主设备支持外部时钟。

Shared Ethernet mode 共享网络模式

In shared Ethernet mode, only one device in the configuration can be attached to the Ethernet.

在共享网络模式,只有一个设备可以连接到以太网配置。

  • Clock reference, time reference, and data are communicated over the MIMO cable. 时钟参考,时间参考,数据 都是通过MIMO Cable通信。
  • Master and slave must have different IPv4 addresses in the same subnet. 主设备和从设备必须有不同的IPv4地址,在一个子网内。

Dual Ethernet mode 双网模式

In dual Ethernet mode, both devices in the configuration must be attached to the Ethernet. 

在双网模式中,两个设备必须都连接到以太网。

  • Only clock reference and time reference are communicated over the MIMO cable. 只有时钟参考,时间参考通过MIMO Cable 在设备间通信。
  • The master and slave must have different IPv4 addresses in different subnets. 主设备和从设备必须有不同的IPv4地址,在一个子网内。

Configuring the slave 配置从设备

In order for the slave to synchronize to the master over MIMO cable, the following clock configuration must be set on the slave device: :

为了从设备通过MIMO Cavle 与主设备同步,以下时钟配置需要在从设备设置。

usrp->set_time_source("mimo", slave_index);
usrp->set_clock_source("mimo", slave_index);

总结:

使用MIMO Cable可以实现两个设备的时钟(clock)同步,时间(time)同步,网口同步。分主设备,从设备

从设备从主设备哪里获得时钟和时间参考。只有主设备可以接外部时钟(可选).

又分共享网络模式和双网模式

为了从主设备哪里获得同步,需要在从设备做一些设置。

Alternative stream destination

It is possible to program the USRP device to send RX packets to an alternative IP/UDP destination.

Set the subnet and gateway

To use an alternative streaming destination, the device needs to be able to determine if the destination address is within its subnet, and ARP appropriately. Therefore, the user should ensure that subnet and gateway addresses have been programmed into the device's EEPROM.

Run the following commands:

cd <install-path>/lib/uhd/utils
./usrp_burn_mb_eeprom --args=<optional device args> --values="subnet=255.255.255.0, gateway=192.168.10.2"

Create a receive streamer

Set the stream args "addr" and "port" values to the alternative destination. Packets will be sent to this destination when the user issues a stream command.

//create a receive streamer, host type does not matter
uhd::stream_args_t stream_args("fc32");
//resolvable address and port for a remote udp socket
stream_args.args["addr"] = "192.168.10.42";
stream_args.args["port"] = "12345";
//create the streamer
uhd::rx_streamer::sptr rx_stream = usrp->get_rx_stream(stream_args);
//issue stream command
uhd::stream_cmd_t stream_cmd(uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE);
stream_cmd.num_samps = total_num_samps;
stream_cmd.stream_now = true;
usrp->issue_stream_cmd(stream_cmd);

Note: Calling recv() on this streamer object should yield a timeout.

Hardware Setup Notes 硬件配置注解

Front panel LEDs 前面板指示灯

The LEDs on the front panel can be useful in debugging hardware and software issues. The LEDs reveal the following about the state of the device:

  • LED A: transmitting
  • LED B: MIMO cable link
  • LED C: receiving
  • LED D: firmware loaded
  • LED E: reference lock
  • LED F: CPLD loaded

Ref Clock - 10 MHz 参考时钟

Using an external 10 MHz reference clock, a square wave will offer the best phase noise performance, but a sinusoid is acceptable. The reference clock requires the following power level:

  • USRP2 5 to 15 dBm
  • N2XX 0 to 15 dBm

PPS - Pulse Per Second

Using a PPS signal for timestamp synchronization requires a square wave signal with the following amplitude:

  • USRP2 5Vpp
  • N2XX 3.3 to 5Vpp

Test the PPS input with the following app:

  • <args> are device address arguments (optional if only one USRP device is on your machine)

  cd <install-path>/lib/uhd/examples ./test_pps_input –args=<args>

Internal GPSDO 内部 GPS 伺服时钟

Please see Internal GPSDO (USRP-N2x0/E1X0 Models) for information on configuring and using the internal GPSDO.

Installation instructions:

  1. Remove the daughterboard.
  2. Move J510 jumper on the motherboard from 1-2 to 2-3 in order to switch from external 10 MHz Ref Clock to GPSDO’s 10 MHz Ref Clock
  3. Screw the GPSDO module in place with the screws provided. The screws are treated to avoid loosening with vibration.
  4. Connect the GPSDO power cable to J509 on the motherboard, and then to connector D on the GPSDO module
  5. Connect an SMB to SMA cable between connectors B and J506 (PPS2)
  6. Connect an SMB to SMA cable between connectors C and J507 (CLK REF2)
  7. Connect the serial cable between connectors A and J312 (RS232-3) on the motherboard. If J312 on your USRP isn’t a keyed connector, please ensure to connect pin1 (TX) of connector A to pin3 (RX) on J312.
  8. Remove the washer and nut from the MMCX to SMA-Bulkhead cable. Connect it to connector E and then insert SMA-Bulkhead connector through the hole in the rear panel. Tighten nut to fasten in place.
  9. Replace the daughterboard pushing all the cables underneath.

Then run the following commands:

cd /share/uhd/utils
./usrp_burn_mb_eeprom --args= --key=gpsdo --val=internal

Removal instructions:
Restore the jumper setting, disconnect the cables, and unscrew the GPSDO unit. Then run the following commands:

cd /share/uhd/utils
./usrp_burn_mb_eeprom --args= --key=gpsdo --val=none

Antenna Types:
The GPSDO is capable of supplying a 3V for active GPS antennas or supporting passive antennas

Miscellaneous 杂类

Available Sensors 可选传感单元

The following sensors are available for the USRP2/N-Series motherboards; they can be queried through the API.

  • mimo_locked - clock reference locked over the MIMO cable
  • ref_locked - clock reference locked (internal/external)
  • other sensors are added when the GPSDO is enabled

Multiple RX channels 多接收链路

There are two complete DDC chains in the FPGA. In the single channel case, only one chain is ever used. To receive from both channels, the user must set the RX subdevice specification. This hardware has only one daughterboard slot, which has been aptly named slot A.

In the following example, a TVRX2 is installed. Channel 0 is sourced from subdevice RX1, and channel 1 is sourced from subdevice RX2 (RX1 and RX2 are the antenna ports on the TVRX2 daughterboard):

usrp->set_rx_subdev_spec("A:RX1 A:RX2");

Unbricking an N-Series Device

You'll need:

JTAG programmer: please connect it to the JTAG connector on the motherboard as shown in the attachment
Xilinx 'iMPACT': launch and cancel the new project wizards. You should be left with the screen which shows a single FPGA chip in the main document (auto-detected by the programmer).
N2xx-JTAG.jpg
              N2x0 JTAG Connection
Download the latest FPGA images, e.g. using uhd_images_downloader.

There is a sub-directory in the archive below the firmware/images called 'bit'. Use Impact to load usrp_n210_r4_fpga.bit via the programmer (the filename may be different depending on your device type and revision).

The USRP should now be able to communicate on the network (you'll see some LEDs light up and network link be established). The next step is to flash the device and program the serial number. Both these steps can be done with UHD (the JTAG step is complete).

To be sure, run uhd_find_devices and it should appear in the list - remember this IP address for the image loader utility (should be 192.168.10.2 - make sure your network settings enable to you communicate with that subnet!).

The first step is to flash the unit's safe-mode image, and then do a normal flash - both with the UHD Image Loader utility.

Make sure you have UHD installed, and the images from before, and follow the instructions in Load the Images onto the SD card (USRP2 only). You can combine the --fw-path and --fpga-path arguments into the single invocation of the image loader.

You will probably use "usrp_n210_fw.bin" for the firmware and "usrp_n210_r4_fpga.bin" for the FPGA image parameters (use the full/relative file path if your current directory is not that of the images).

uhd_image_loader --args="type=usrp2,addr=192.168.10.2,overwrite-safe" --fw-path=usrp_n210_fw.bin --fpga-path=usrp_n210_r4_fpga.bin

Use the overwrite-safe option the first time, and then repeat without it for the second time. Don't forget to power-cycle the device after it has been flashed.

You can change the normal IP address by following the instructions in Change the USRP2's IP address.

If you run uhd_usrp_probe, you can see the EEPROM keys at the top. Example:

Mboard: N210r4
hardware: 2577
mac-addr: a0:36:fa:25:34:a7
ip-addr: 192.168.10.4
subnet: 255.255.255.255
gateway: 255.255.255.255
gpsdo: none
serial: EAR14U7UP

If you need to change any of there, you should then be able to run:

usrp_burn_mb_eeprom --key=<key> --val=<val>

to set the 'mac-addr', 'serial' and 'Mboard'.

本文链接:GNU Radio: USRP2 and N2x0 Series

参考链接:USRP2 and N2x0 Series

posted @ 2016-09-05 21:25  moon1992  阅读(2140)  评论(0编辑  收藏  举报