下载镜像文件
获取文件系统Mender映像(这些文件带有.mender后缀),请在具有Internet访问权限的主机上运行以下命令:
$ sudo uhd_images_downloader -t mender -t n3xx --yes
接下来,您需要将此Mender文件系统映像复制到USRP N3xx。这可以通过Linux实用程序scp完成。
scp /usr/local/share/uhd/images/usrp_n3xx_fs.mender root@192.168.1.101:~/.
注意,ip地址是 N321的RG45网口ip地址,根据实际的ip地址修改。
将文件复制到N321后,然后开始更新文件系统,在N321的命令行输入:
root@ni-n3xx-serial:~# mender -rootfs /home/root/usrp_n3xx_fs.mender
这条命令可能会报错,报错信息如下:
root@ni-n3xx-31CF839:~# mender -rootfs /home/root/usrp_n3xx_fs.mender
INFO[0000] Configuration file does not exist: /var/lib/mender/mender.conf module=config
INFO[0000] Loaded configuration file: /etc/mender/mender.conf module=config
INFO[0000] Mender running on partition: /dev/mmcblk0p2 module=main
INFO[0000] Start updating from local image file: [/home/root/usrp_n3xx_fs.mender] module=rootfs
Installing update from the artifact of size 397741056
INFO[0000] no public key was provided for authenticating the artifact module=installer
ERRO[0000] Installation failed: installer: failed to read and install update: will not install artifact with state-scripts when installing from cmd-line. Use -f to override module=rootfs
ERRO[0000] installer: failed to read and install update: will not install artifact with state-scripts when installing from cmd-line. Use -f to override module=main
root@ni-n3xx-31CF839:~# mender -rootfs /home/root/usrp_n3xx_fs.mender
INFO[0000] Configuration file does not exist: /var/lib/mender/mender.conf module=config
INFO[0000] Loaded configuration file: /etc/mender/mender.conf module=config
INFO[0000] Mender running on partition: /dev/mmcblk0p2 module=main
INFO[0000] Start updating from local image file: [/home/root/usrp_n3xx_fs.mender] module=rootfs
Installing update from the artifact of size 397741056
INFO[0000] no public key was provided for authenticating the artifact module=installer
ERRO[0000] Installation failed: installer: failed to read and install update: will not install artifact with state-scripts when installing from cmd-line. Use -f to override module=rootfs
ERRO[0000] installer: failed to read and install update: will not install artifact with state-scripts when installing from cmd-line. Use -f to override module=main
根据提示,在命令的后面加-f,即输入:
root@ni-n3xx-serial:~# mender -rootfs /home/root/usrp_n3xx_fs.mender -f
不过,加入-f会不会在后面有什么副作用暂时还不清楚。
最终显示成功
然后reboot,不过这个时候reboot可能会无法重启,或者重启较快。不能重启就等一会儿执行shutdown,然后重启开机,ssh登陆。
接着提交更改,以便引导加载程序知道可以永久引导到该分区:
$ mender -commit
要从命令行识别当前安装的Mender工件,可以在N3xx上查询以下文件:
$ cat /etc/mender/artifact_info
根据N321教程的意思,本来在/etc/systemd/network/文件夹下,应该有 eth0.network sfp0.network sfp1.network 三个文件,不过重启后打开,现实并没有,在host主机查看,可以在host中找到 sfp0.network sfp1.network这两个文件,将其拷贝到N321的/etc/systemd/network/文件夹下.
因为之前的host的uhd版本已经更新到4.0.0.0,usrp和host的uhd版本已经一致,不需要继续执行教程步骤。在host执行uhd_usrp_proble,查看usrpN321的uhd信息,可以验证信息是否正确。
然后安装GNURadio,版本最好安装3.8以上的,否则Gnuradio可能找不到N3xx系列的USRP。安装Gnuradio3.8的详细过程可以参考我的另一篇配置N310的博客。Gnuradio安装好后,打开gnuradio,用N321采集一下信号,成功!
下一阶段就是在windows matlab下成功使用usrp n321。
这是之前用windows刷卡的系统的UHD版本,说明了目前windows matlab的uhd驱动应该是3.15.0.0版本。
如果host ubuntu装的uhd版本低于usrp n321中的版本,那么在host ubuntu中查看或运行usrp可能会提示出现一下信息:
csy@CsyGNU:~/test6$ uhd_usrp_probe
[INFO] [UHD] linux; GNU C++ version 8.4.0; Boost_106501; UHD_3.14.1.HEAD-0-g0347a6d8
[INFO] [MPMD] Initializing 1 device(s) in parallel with args: mgmt_addr=192.168.10.2,type=n3xx,product=n310,serial=316BF1E,claimed=False,addr=192.168.10.2
Error: rpc::timeout: Timeout of 2000ms while calling RPC function 'get_num_xbars'
提示这个情况,就只有老老实实修改UHD的版本,保持host和N3xx的uhd一致。