Burn Firmware and FPGA
To connect USRP2 to an external clock, you need to change the firmware and FPGA code on the SD Card
- Insert the SD card into the card reader
- Use "dmesg" command to check which interface is in use. The following is an example output in my machine, where the SC card is installed in /dev/sdc
- Run
$ cd gnuratio/usrp2/firmware/
Be careful: /dev/XXXX has to be replaced with the device for the SD card reader.
$ sudo ./u2_flash_tool --dev=/dev/XXXX -t s/w txrx.bin -w
$ sudo ./u2_flash_tool --dev=/dev/XXXX -t fpga u2_rev3-20100603.bin -w - Insert the SD card to USRP2 and reboot USRP2. If your SD card is upgraded successfully, you should see all 6 LEDs flash, and LED 'D' and 'F' will remain on. If not, the card is not upgraded properly.
$ dmesg
sd 4:0:0:1: [sdc] 3878912 512-byte logical blocks: (1.98 GB/1.84 GiB)
sd 4:0:0:1: [sdc] Assuming drive cache: write through
sd 4:0:0:1: [sdc] Assuming drive cache: write through
sdc: unknown partition table
NOTE: Note that these firmware and FPGA codes work only when the external clock is in use. Otherwise, the USRPs behavior is unpredictable.
http://nms.citi.sinica.edu.tw/n+/software.html
Write Your Own Module
To create your own python module, you will need to write the python script (.py files), C library (.cc files), and the swig file (.i file). The simplest way to create a new module is to copy the existing module and modify it to what you want. We suggest modifying the 'mimo_ofdm_siso' module because it provides the most basic functionality so that you can build your own functions on top of it. In the following, we use modifying 'mimo_ofdm_siso' as the example to demonstrate how to create a new module, called 'mimo_ofdm_new'.
- Create python files
$ cd gr-mimo/python/
Edit 'mimo_usrp2_ofdm_receiver_new.py' and replace all strings "_siso" with "_new". You might need to make other modifications if you want to create a module with a different number of input ports and output ports.
$ cp mimo_usrp2_ofdm_receiver_siso.py mimo_usrp2_ofdm_receiver_new.py
$ ln -sf mimo_usrp2_ofdm_receiver_new.py mimo_usrp2_ofdm_receiver.py - Create C library
$ cd ../lib/
Edit 'mimo_ofdm_new.cc' and 'mimo_ofdm_new.h', and replace all strings "_siso" and "_SISO" to "_new" and "_NEW", respectively. Modify the makefile 'Makefile.am'. Add "mimo_ofdm_new.h" under the tag "modinclude_HEADERS =", and add "mimo_ofdm_new.cc" under the tag "libgnuradio_mimo_la_SOURCES =".
$ cp mimo_ofdm_siso.cc mimo_ofdm_new.cc
$ cp mimo_ofdm_siso.h mimo_ofdm_new.h - Create .i file
$ cd ../swig/
Edit 'mimo_ofdm_new.i', and replace all strings "_siso" with "_new".
$ cp mimo_ofdm_siso.i mimo_ofdm_new.i
Add the following two lines in 'mimo.i'.#include "mimo_ofdm_new.h"
Modify the makefile 'Makefile.am'. Add "mimo_ofdm_new.i" under the tag "mimo_swiginclude_headers =".
%include "mimo_ofdm_new.i" - Re-build
$ cd ../
$ make; sudo make install - Create the new transmitter code
$ cd gnuradio/usrp2/host/apps/
Add "mimo_new.cc" in 'Makefile.am', and reinstall
$ cp mimo_siso_tx1.cc mimo_new.cc$ make; sudo make install
- Run the example
In the receiver,$ cd gr-mimo/python
In the transmitter,
$ sudo ./mimo_usrp2_rx.py -f 2.45G -d 64 -e eth0 --rx_ant_num 1 -v$ cd source/
$ sudo mimo_new -f 2.45G -i 64 -e eth1 -v
没有评论:
发表评论