SDR/USRPに適したPCの選択方法

Linux版 LabVIEWでSDR開発を試して見る (5) PCI Express経由で接続したUSRP X310を認識させる

こんにちはドルフィンシステム福島です。

Linux版 LabVIEWでSDR開発を試すシリーズの第5弾です。
さて前回は、Linux版 NI-USRPドライバがAPIではなく、PCI Expressのデバイスドライバだけだったことが分かりました。

全くビックリです。


【前回】Linux版 LabVIEWでSDR開発を試して見る (4) NI-USRPドライバをインストールする
http://mikioblog.dolphinsystem.jp/2022/05/linux-labviewsdr-3-ubuntu-linuxlabview.html


仕方が無いのでインストールしたLinux版 USRPデバイスドライバでPCI Express接続したUSRP X310を認識させてみます。


PCI Express経由でX310を認識させる

まずUSRPの電源を入れずにPCを起動し、lspciコマンドでPCI Expressバスにあるデバイスを確認します。
以下の様にUSRPらしきデバイスは存在していません。

想定通りです。

$ lspci 00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers (rev 05) ~中略~ 01:00.0 PCI bridge: PLX Technology, Inc. PEX 8608 8-lane, 8-Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba) 02:01.0 PCI bridge: PLX Technology, Inc. PEX 8608 8-lane, 8-Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba) 05:00.0 Ethernet controller: Intel Corporation I211 Gigabit Network Connection (rev 03)

次にPCをシャットダウンしてPCI ExpressにX310を接続しPCの電源を投入します。
MXI ExpressカードのLEDも緑色に点灯し、USRPと正常にリンクしている事を指し示しています。(LEDが赤点灯だとリンクされていない)

以下の様に、USRPらしきデバイスが"Signal processing controller"として認識しました。

これで良さそうです。


$ lspci 00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers (rev 05) ~中略~ 01:00.0 PCI bridge: PLX Technology, Inc. PEX 8608 8-lane, 8-Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba) 02:01.0 PCI bridge: PLX Technology, Inc. PEX 8608 8-lane, 8-Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba) 03:00.0 Signal processing controller: National Instruments PXIe/PCIe Device 05:00.0 Ethernet controller: Intel Corporation I211 Gigabit Network Connection (rev 03) dolphin@dolphin-XH110G:~$ $ lspci -k -d 1093:c4c4 03:00.0 Signal processing controller: National Instruments PXIe/PCIe Device Subsystem: National Instruments PXIe/PCIe Device


UHDでUSRPと接続する

次にUHDを使ってUSRPと接続確認をします。


$ sudo apt install uhd-host
$ sudo /usr/lib/uhd/utils/uhd_images_downloader.py
$ uhd_find_device
[INFO] [UHD] linux; GNU C++ version 7.5.0; Boost_106501; UHD_3.15.0.HEAD-0-gaea0e2de
[ERROR] [UHD] Device discovery error: input stream error
Error: LookupError: KeyError: No devices found for ----->
Device Address:

$ uhd_usrp_probe

あれ?認識していません。
おかしいな。--argsを指定してもダメ。

$ uhd_usrp_probe --args "type=x300,resource=RIO0"
[INFO] [UHD] linux; GNU C++ version 7.5.0; Boost_106501; UHD_3.15.0.HEAD-0-gaea0e2de
[ERROR] [UHD] Device discovery error: input stream error
Error: LookupError: KeyError: No devices found for ----->
Device Address:
    type: x300
    resource: RIO0


サービスの動作確認

ちゃんとインストールしたni-usrp-rioが動作しているのか確認します。
プロセスは生きているようですね。

$ ps ax|grep usrp
    680 ?        Sl     0:00 /usr/sbin/niusrpriorpc --daemon
   1624 pts/0    S+     0:00 grep --color=auto usrp

調べてみるとデーモンが動作しているようなので、オープンしているポート番号から調べます。

以下の様にちゃんと動いているようです。

$ sudo netstat -anp|grep 5444
tcp        0      0 0.0.0.0:5444            0.0.0.0:*               LISTEN      2335/niusrpriorpc
tcp        0      0 127.0.0.1:5444          127.0.0.1:53364         CLOSE_WAIT  2335/niusrpriorpc

これは一体どういうことなのか?


X310の挙動を確認する

まずX310の電源を投入します。

しばらくするとイーサネットのLEDが点灯を始めます。フロントパネルのLink LEDもイーサネットのLEDと同じくイーサネットフレームを受信したタイミングで点灯しますので、イーサネットは動いているようです。



では、PCの電源を投入します。

PCのMXIインターフェイスカードのLEDが緑色に点灯していますので、PCとUSRPのリンクが確立したようです。

USRPのイーサネットのLEDが消灯しました。USRPの接続方式がイーサネットからPCI Expressに変更されると消灯するので、恐らく排他利用なのでしょうか。


ですが、今までと同じようにlspciではUSRPを検出しましたが、相変わらずuhd_find_deviceでは認識していません。

$ /usr/sbin/niusrpriorpc --help
NI USRP RIO RPC Server

Allowed options:
  --help                     help message
  --port arg (=5444)         Port number to bind the server to.
  --log-level arg (=warning) Log level. Choose from {(o)ff, (w)arning, (s)tatus, (v)erbose}
  --daemon                   Run niusrpriorpc as a daemon

以下の様にデーモンをフォアグラウンドで起動しエラーメッセージが出ていないか確認します。puttyをもう一つ起動し別コンソールからuhd_find_deviceを実行します。

$ /usr/sbin/niusrpriorpc --log-level verbose
[niusrpriorpc] RPC Server starting on 0.0.0.0:5444
[niusrpriorpc] RPC server started
[niusrpriorpc] Accepted client connection request
[niusrpriorpc] Server Archive Version = 17, Client Archive Version = 17
[niusrpriorpc] Connection to client 0xd76153d00000899 established
[niusrpriorpc] Grew thread pool to 1 threads
[niusrpriorpc] Calling function 256 for client 0xd76153d00000899
[niusrpriorpc] Connection to client 0xd76153d00000899 closed

Device Identification
USRP Hardware Driver and USRP Manual: Device Identification (ettus.com)


$ uhd_find_devices --args="type=x300"
[INFO] [UHD] linux; GNU C++ version 9.2.1 20200304; Boost_107100; UHD_3.15.0.0-2build5
[ERROR] [UHD] Device discovery error: input stream error
No UHD Devices Found

何故か出ません。

$ dpkg -l |grep ni-
ii  ni-apal-errors                             19.0.0.49152-0+f0                               all          Device driver error code descriptions
ii  ni-bds                                     20.0.0.49152-0+f0                               all          NI Bus Driver Support (BDS)
ii  ni-bds-dkms                                20.0.0.49152-0+f0                               amd64        NI Bus Driver Support (BDS) kernel module
ii  ni-euladepot                               20.1.0.49152-0+f0                               all          End User License Agreement documents
ii  ni-fpga-interface                          20.0.1.49152-0+f0                               amd64        FPGA Interface C API
ii  ni-kal                                     20.0.0.49152-0+f0                               all          National Instruments kernel abstraction layer
ii  ni-p2p                                     20.0.0.49152-0+f0                               all          NI Peer-to-Peer(P2P) Streaming (metapackage)
ii  ni-p2p-dkms                                20.0.0.49152-0+f0                               amd64        NI Peer-to-Peer(P2P) Streaming Kernel Module
ii  ni-p2p-errors                              20.0.0.49152-0+f0                               all          NI Peer-to-Peer(P2P) Streaming Error Code Descriptions
ii  ni-rio                                     20.0.1.49152-0+f0                               amd64        NI-RIO Libraries
ii  ni-rio-dkms                                20.0.1.49152-0+f0                               amd64        NI-RIO Driver
ii  ni-rio-fpga-ids                            20.0.1.49152-0+f0                               amd64        FPGA Interface Driver Support
ii  ni-rio-server                              20.0.1.49152-0+f0                               amd64        NI-RIO Server
ii  ni-software-2020-bionic                    20.1.0.49152-0+f0                               all          National Instruments 2020 Software repository enablement
ii  ni-usrp-rio                                20.1.0.49153-0+f1                               all          NI USRP RIO Linux Support
ii  ni-usrp-rio-dkms                           20.1.0.49153-0+f1                               amd64        NI USRP RIO Linux DKMS Support
ii  ni-usrp-rio-libs                           20.1.0.49153-0+f1                               amd64        NI USRP RIO Linux Libraries Support

$ ls /dev/ni
ls: '/dev/ni' にアクセスできません: そのようなファイルやディレクトリはありません


イーサネット接続にしてみる

PCI Expressで接続が出来ませんでしたので、イーサネットで接続をしてみます。

PCとUSRPを接続しているPCI Expressケーブルを外して起動します。


次に、イーサネットケーブルでUSRPとPCを接続しpingを打ちます。

USRPのデフォルトIPアドレスは以下のページに書かれています。


IP Address
https://files.ettus.com/manual/page_usrp_x3x0.html

$ uhd_usrp_probe --args addr=192.168.10.2
[INFO] [UHD] linux; GNU C++ version 9.2.1 20200304; Boost_107100; UHD_3.15.0.0-2build5
[INFO] [X300] X300 initialization sequence...
Error: RuntimeError: Expected FPGA compatibility number 36, but got 13:
The FPGA image on your device is not compatible with this host code build.
Download the appropriate FPGA images for this version of UHD.

Please run:
 "/usr/lib/uhd/utils/uhd_images_downloader.py"

Then burn a new image to the on-board flash storage of your USRP X3xx device using the image loader utility. Use this command:

"/usr/bin/uhd_image_loader" --args="type=x300,addr=192.168.10.2"

For more information, refer to the UHD manual:
http://files.ettus.com/manual/page_usrp_x3x0.html#x3x0_flash

無事認識したようですが、USRPのFPGAバージョンが古くPCのUHDに適合していない、という趣旨のエラーが出ました。

というわけでメッセージの通りにUSRPのFPGAイメージを更新します。

$ /usr/bin/uhd_image_loader --args="type=x300,addr=192.168.10.2"
[INFO] [UHD] linux; GNU C++ version 9.2.1 20200304; Boost_107100; UHD_3.15.0.0-2build5
Unit: USRP X310 (3252798, 192.168.10.2)
FPGA Image: /usr/share/uhd/images/usrp_x310_fpga_HG.bit
-- Initializing FPGA loading...successful.
-- Loading HG FPGA image: 100% (121/121 sectors)
-- Finalizing image load...successful.
Power-cycle the USRP X310 to use the new image.

dolphin@dolphin-XH110G:~$

出来ましたので、USRPの電源を入り切りして更新を完了します。するとIPアドレスを指定することで正しく認識しました。IPアドレスを指定しなくても認識することが多いのですが、認識しない場合はIPアドレスを指定した方が良いですね。

$ uhd_find_devices
[INFO] [UHD] linux; GNU C++ version 9.2.1 20200304; Boost_107100; UHD_3.15.0.0-2build5
[ERROR] [UHD] Device discovery error: input stream error
No UHD Devices Found

$ uhd_usrp_probe
[INFO] [UHD] linux; GNU C++ version 9.2.1 20200304; Boost_107100; UHD_3.15.0.0-2build5
[ERROR] [UHD] Device discovery error: input stream error
Error: LookupError: KeyError: No devices found for ----->
Empty Device Address

$ uhd_find_devices --args addr=192.168.10.2
[INFO] [UHD] linux; GNU C++ version 9.2.1 20200304;
Boost_107100; UHD_3.15.0.0-2build5

--------------------------------------------------
-- UHD Device 0
--------------------------------------------------

Device Address:
    serial: 3252798
    addr: 192.168.10.2
    fpga: HG
    name:
    product: X310
    type: x300

$ uhd_usrp_probe --args addr=192.168.10.2
[INFO] [UHD] linux; GNU C++ version 9.2.1 20200304; Boost_107100; UHD_3.15.0.0-2build5
[INFO] [X300] X300 initialization sequence...
[INFO] [X300] Maximum frame size: 1472 bytes.
[INFO] [X300] Radio 1x clock: 200 MHz
~中略~
|   |    /
|   |   |       RFNoC blocks on this device:
|   |   |
|   |   |   * DmaFIFO_0
|   |   |   * Radio_0
|   |   |   * Radio_1
|   |   |   * DDC_0
|   |   |   * DDC_1
|   |   |   * DUC_0
|   |   |   * DUC_1

というわけで、イーサネット接続はIPアドレスを指定することで接続は出来ました。


ではPCI Expressは?

さてUSRPのFPGAを更新したことで、PCI Expressで認識されるようになったでしょうか?

$ uhd_find_device
[INFO] [UHD] linux; GNU C++ version 7.5.0; Boost_106501; UHD_3.15.0.HEAD-0-gaea0e2de
[ERROR] [UHD] Device discovery error: input stream error
Error: LookupError: KeyError: No devices found for ----->
Device Address:

だめでした

以下のページがEttusのトラブルシューティングページですが、これに沿って色々試しましたが認識はできませんでした。

試したLinuxは、Ubuntu Linux 18, 20, 22の3種類。


Troubleshooting X300/X310 Device Discovery Issues
https://kb.ettus.com/Troubleshooting_X300/X310_Device_Discovery_Issues


まとめ

  • USRP X310をPCI Expressバスで接続が確立している場合は、インタフェースカードのLEDが緑色に点灯する。接続が確立していない場合は、赤色で点灯する。
  • USRP X310のPXI Expressバスとイーサネットは排他利用のようだ。
  • イーサネット接続でIPアドレスを指定してuhd_usrp_probeを行うと、必要であればFPGAファームウェア更新の警告が発せられるので、適宜更新する。
  • Ubuntu Linux 18, 20, 22の3種類でuhd_find_deviceで認識しなかった。


結局接続は出来ず原因も分からず、ちょっと納得がいかない結果ですね。


以上、ドルフィンシステム福島でした。


コメント