问题
When trying to execute a GNU Radio program that uses a USRP, I get an error backtrace, which (in Python) typically ends with:
self.u = uhd.usrp_source(device_addr=args, stream_args=uhd.stream_args('fc32'))
File "/home/marcus/.usrlocal/lib64/python2.7/site-packages/gnuradio/uhd/__init__.py", line 122, in constructor_interceptor
return old_constructor(*args)
File "/home/marcus/.usrlocal/lib64/python2.7/site-packages/gnuradio/uhd/uhd_swig.py", line 2351, in make
return _uhd_swig.usrp_source_make(*args)
RuntimeError: LookupError: KeyError: No devices found for ----->
The USRP is running.
回答1:
You should always test raw UHD functionality first with the uhd_find_devices
tool first:
uhd_find_devices
If it doesn't find your device, though it is booted, my experience is that you have a high chance of simply not being able to communicate with the device:
- If you're not using a UHD version from Ettus' own repositories, especially on not-brand-new Ubuntus, your UHD might simply be older than the device and can't talk to it. The first line of output of
uhd_find_devices
will contain info on the version. At the time of writing (Oct 2014), 3.9 is the latest release. If possible, always use the latest release.- B200/B210 needs at least 3.6.0, but functionality improved significantly with 3.8.4
- X300/X310 needs at least 3.7.0
- B200mini needs 3.9
- USRP1/2/B100/N200/N210 should be directly supported for but the oldest releases you'll find in the wild. Not so much for all daughterboards that you can use with them – as mentioned, try to use a recent version.
- If you're using an USB connected device (USRP B200, B210, B200mini, B100, USRP1), chances are that you either
- on Linux: don't have the udev rules installed necessary to allow "normal" users to communicate with the USRPs; check whether
/etc/udev/rules.d/
contains something likeuhd-usrp.rules
. - on Windows: you might not have the Windows USB drivers installed.
- if you've built UHD yourself (also, if you installed GNU Radio through
build-gnuradio.sh
or pybombs), there might have been USB libraries missing. Make sure your UHD cmake logs contain "Enabling USB". - USB3: Some USB3 host controllers don't behave standards-conforming, and connectivity cannot be achieved. If your USRP is detected when plugged into a USB2 port (anyone that isn't blue, usually), you should be fine.
- on Linux: don't have the udev rules installed necessary to allow "normal" users to communicate with the USRPs; check whether
- If you're on a networked device (USRP X300/X310 with 1Gbit/10Gbit Ethernet, USRP N200/N210, USRP2)
- make sure your network interface is
- 1Gbit-capable (or 10GE, if applying); "Fast Ethernet" (10/100Mbit) NICs do not work with the USRPs.
- Not the Intel 82579LM network controller (the only PCIe network controller IC known to occasionally drop packets without telling the operating system
- not a USB3-to-Gigabit adapter (these tend to do interesting reordering on the packets, making them unsuitable for high-rate real time samples)
- make sure your computer is on the same IP network. By default, USRPs have addresses from the
192.168.10.XXX
range (XXX=2
in factory settings). Make sure your computer has an IP address from the same range, but not the same address. - make sure basic communication works (by
ping <ip address of USRP>
). If not, re-check your own IP address, and try to make sure the USRP is configured to the right address.- To find out the current IP address of your USRP, it's often easiest to properly install
wireshark
(that's a network packet sniffer software), have a dedicated network interface connect to the (powered off USRP), start the capture on that interface, and power on the USRP. - If the address is wrong, you can reprogram the IP address of the USRP X300/X310:
cd <install-path>/lib/uhd/utils ; ./usrp_burn_mb_eeprom --args=addr=<current IP address> --values="ip-addr0=<new ip address>"
- If the address is wrong, you can reprogram the IP address of the USRP N200/N210/USRP2:
cd <install-path>/lib/uhd/utils ; ./usrp_burn_mb_eeprom --args=<optional device args> --values="ip-addr=192.168.10.3"
- To find out the current IP address of your USRP, it's often easiest to properly install
- make sure you have your firewall configured to permit traffic coming from the USRP's port 49152. On linux, the following
iptables
command typically does the trick¹:sudo iptables -A INPUT -p udp --sport 49152 -j ACCEPT
. Notice that this does punch a hole in your firewall. Your institution's security policies might apply.
- make sure your network interface is
- If you're trying to use a USRP E100, E110, E310 or E312 connected to your PC:
- The E-series devices are standalone embedded Linux SDR devices; they don't attach to a PC as a peripheral. You will have to compile your software (if applicable) with a cross-compiler and run the software on the E-series device itself, not on your host PC.
As a quick test whether your PC, USRP and cabling and device IP configuration are correct, download the current GNU Radio Live DVD² (which, by the way, also contains copious amounts of cool examples), boot it, and try uhd_find_devices
there.
¹ your mileage might vary, as each distribution has its own idea of how to manage the firewall
² Please use the torrent files, if possible -- Amazon AWS traffic isn't free for the maintainers of the GNU Radio project. The torrent file also uses the AWS servers as source, but tries to get a part of the image from other users.
回答2:
Run Below Command :
sudo gedit /usr/lib/python2.7/dist-packages/gnuradio/uhd/uhd_swig.py
In line containig device_addr
add B210
as it's value.
Args:
device_addr : B210
来源:https://stackoverflow.com/questions/33304828/when-trying-to-use-my-usrp-in-gnu-radio-i-get-a-no-devices-found-for