== USRP-2974 (Krypton) driver install and usage == === Description === A quick walk thru on how to install the PCIe driver for Krypton and start using the device. The Krypton is a stand-alone SDR with a host controller with radio portion connected to the host via PCIe bus. The specifications for Krypton is [http://www.ni.com/documentation/en/usrp-software-defined-radio-stand-alone-device/latest/specs-usrp-2974/specs/ here]. === Installation / Starting of PCIe driver === From the COSMOS console, load an image that has a compatible UHD & kernel driver already installed. The image baseline-uhd.ndz or similar can be used. {{{#!shell-session console:~# omf load -i baseline-uhd.ndz -t sdr2-lg1.sb1.cosmos-lab.org console:~# omf tell -a on -t sdr2-lg1.sb1.cosmos-lab.org }}} Now ssh into the Krypton host and verify it is able to detect the radio on the PCIe bus. Use ''lspci'' to list all the devices that are detected. {{{#!shell-session root@sdr2-lg1:~# lspci }}} In the output of lspci, search for ''Signal processing controller: National Instruments PXIe/PCIe Device''. This means the host computer's PCIe controller sees the Krypton radio. Now download and install the PCIe driver so the UHD applications access the radio. Complete details on this driver is [https://files.ettus.com/manual/page_ni_rio_kernel.html here]. {{{#!shell-session root@sdr2-lg1:~# wget http://files.ettus.com/binaries/niusrprio/niusrprio-installer-18.0.0.tar.gz root@sdr2-lg1:~# tar -zxf niusrprio-installer-18.0.0.tar.gz root@sdr2-lg1:~# sudo niusrprio_installer/INSTALL }}} After the installation is complete start the driver by loading it into the kernel modules. {{{#!shell-session root@sdr2-lg1:~# /usr/local/bin/niusrprio_pcie start Making sure drivers are up to date... Module nikal is up-to-date Module nistreamk is up-to-date Module nibds is up-to-date Module niusrpriok is up-to-date Module NiRioSrv is up-to-date Loading: NiRioSrv niusrpriok Starting: niusrpriorpc }}} At this point use ''uhd_find_devices'' and ''uhd_usrp_probe'' query the radio. {{{#!shell-session root@sdr2-lg1:~# uhd_find_devices --args="type=x300" [INFO] [UHD] linux; GNU C++ version 7.4.0; Boost_106501; UHD_3.14.0.HEAD-0-g6875d061 -------------------------------------------------- -- UHD Device 0 -------------------------------------------------- Device Address: serial: 31557B9 fpga: HG name: product: X310 resource: RIO0 type: x300 }}} === Trouble shooting === ==== FPGA version mismatch ==== If the above commands return with an error message stating an FPGA version mismatch, then we'll need to update the FPGA that is compatible with the current UHD version. The typical error message would be similar to the following: {{{ [ERROR] [0/DmaFIFO_0] Major compat number mismatch for noc_shell: Expecting 5, got 2. [INFO] [MPM.PeriphManager] init() called with device args `clock_source=internal,time_source=internal,mgmt_addr=10.115.2.1,product=n310'. [ERROR] [MPMD] Failure during block enumeration: RuntimeError: FPGA component `noc_shell' is revision 2 and UHD supports revision 5. Please either up. Error: RuntimeError: Failed to run enumerate_rfnoc_blocks() }}} To update the FPGA following these steps. {{{#!shell-session root@sdr2-lg1:~# /usr/local/lib/uhd/utils/uhd_images_downloader.py root@sdr2-lg1:~# uhd_image_loader --args "type=x300" root@sdr2-lg1:~# restart }}} '''Note:''' If the Krypton host is rebooted, the driver modules are NOT automatically reloaded into the kernel. So the command ''/usr/local/bin/niusrprio_pcie start'' has to be run on the Krypton host everytime it is power-cycled or rebooted. {{{#!shell-session root@sdr2-lg1:~# /usr/local/bin/niusrprio_pcie start }}} ==== NI Driver does not build ==== While trying to build the NI driver following the instructions above, you may encounter an error regarding the ''do_munmap'' function not having enough input arguments. To fix, issue the following command to open the problematic C code file in nano: {{{#!shell nano /var/lib/nikal/5.0.0-29-generic/nikal/nikal.c }}} In nano, use CTRL-W to search for "do_munmap" and locate the following function: {{{#!c static inline int nNIKAL240_do_munmap(struct mm_struct *mm, unsigned long addr, size_t len) { #if defined(nNIKAL1_kDoMunmapHasUf) return do_munmap(mm, addr, len, NULL); #elif defined(nNIKAL100_kDoMunmapHasAcct) return do_munmap(mm, addr, len, 1); #else return do_munmap(mm, addr, len); #endif } }}} Note that the third and final call to ''do_munmap'' is missing the fourth parameter. Add NULL as the fourth parameter so that the line reads as the following: {{{#!c return do_munmap(mm, addr, len, NULL); }}} Save the file by typing CTRL-O, Enter and close by typing CTRL-X. Try building the driver again - it should proceed without issue.