Friday, April 1, 2011

Loading firmware on the USRP N210

It seems like whenever I need to update a driver or find firmware files from the Ettus site seems like I have to find it through some really subtle ways. This post simply documents my experiences from start to finish to get a USRP N210 up and running. I am using Ubuntu v10.10 on a laptop that will run the SDR and interface with the USRP.

I received a brand-spanking-new N210 in the mail yesterday, I tried connecting it to the Simulink FM demod demo as a first step -- did not find the device. After some time with Google I found that N210 is a UHD interface device and that the Simulink driver (which worked seamlessly with the USRP2 btw) is not compatible. So this means N210 => linux only!!.

That is not a major issue since I am planning to use Linux anyway -- first thing I did was to download the latest gnuradio (version 3.3.0 I believe), which of course does not have UHD. For this you need to download from the trunk or something like that. I was able to find a .gz file with the UHD source
https://download.github.com/EttusResearch-UHD-Mirror-95b966a.tar.gz


The steps are as follows (make sure you install cmake using Synaptic or apt-get)

cd host
mkdir build 

cd build 
cmake ../ 
make 
make test 
sudo make install 
sudo ldconfig



After all that I see some files /usr/local/share/uhd ... so I guess it worked!?

So then I plugged in the N210 (via ethernet, my host was 192.168.10.10 and I think the USRP N210 is set to 192.168.10.2)  and then ran a command called uhd_find_devices to which it responded
Warning:
Ignoring discovered device
RuntimeError: Expected protocol compatibility number 9, but got 7: The firware build is not compatible with the host code build. 
No UHD Devices Found

So I figured this meant that the firmware on the newly ordered N210 is stale. Hmm.. I guess I should learn how to do this anyway so why not now. There is no Flash card reader on the N210, so this means the firmware will be downloaded by the ethernet port. After doing a Google search, there appears to be a utility called usrp_n2xx_net_burner.py which I downloaded to my Windows XP machine (since I dont have internet access on the Linux box). I also managed to download what I think is the latest firmware (pls. be number 9, pls.) from here
http://www.ettus.com/downloads/uhd_images/UHD-images-most-recent/

I open up a command prompt on my Windows machine which is now connected to the N210 via ethernet and do the following:

C:\ettus_rsch\UHD>usrp_n2xx_net_burner.py --ip 192.168.10.2 --fw usrp_n2xx_fw.bin
Flash size: 4194304
Sector size: 65536




Begin firmware write: this should take about 1 second...
Erasing 31744 bytes at 3145728
Writing image
Verifying data
Read back 16383 bytes
Success.
Time elapsed: 0.890000 seconds

followed by
C:\ettus_rsch\UHD>usrp_n2xx_net_burner.py --ip
 192.168.10.2 --fpga usrp_n210_fpga.bin
Flash size: 4194304
Sector size: 65536


Begin FPGA write: this should take about 1 minute...
Erasing 1572864 bytes at 1572864
Writing image
Verifying data
Read back 1268576 bytes
Success.
Time elapsed: 30.219000 seconds



 Then I try the uhd_find_devices command on the linux box to see if can find the N210 and voila, it is found.   It says UHD Device 0, type usrp2 and the ip 192.168.10.2. I also ran uhd_usrp_probe and noticed that the daughterboard was found and everything seems in order. I also ran some examples from the uhd directory which were all indicative of an operational state. Now need to figure out some way to use it with the current version of gnuradio. On the following page there are some hints:
http://code.ettus.com/redmine/ettus/projects/uhd/wiki

It says: The gr-uhd component of Gnuradio comes with a set of source and sink blocks for UHD as well as block wrappers for the Gnuradio-Companion. On my windows machine I have installed Cygwin which fortunately has git. I download the master branch by issuing the following command
git clone http://gnuradio.org/git/gnuradio.git

This magically creates a gnuradio tree in the current folder. I proceed to follow the build instructions shown below (may have to issue a 'chmod +x bootstrap')


$ ./bootstrap         # Do NOT perform this step if you are building from a tarball.
$ ./configure
$ make
$ make check
$ sudo make install
$ sudo ldconfig 




After this I typed 'sudo gnuradio-companion' at the terminal to bring up GRC which tells me things are working. I would strongly recommend installing gnuradio on a fresh install. When I had some old gnuradio installations lying around I had a lot of trouble.. like messages saying PYTHONPATH was not configured, etc.

2 comments:

RTI said...

Hello
did you install Python on windows to use the usrp_n2xx_net_burner.py?
If yes how?
Thank you

mr_walnut said...

I installed Python(x,y), it installed Python and a bunch of other useful packages
http://www.pythonxy.com/

Also you may find cygwin useful.