原文链接:
http://www.cnblogs.com/nickchan/archive/2011/10/02/3104476.html
2011-10-02
Introduce:
There are two RX chennels in USRP1. It can be implemented
double receivers by us.
Abstract:
Yesterday, I rewrote usrp_rx_cfile.cc to implement double
receivers. Now, I sum up how to write a multiple antenna receiver
code. I use this code to receive GSM donwlink. We can use double RX
to implement MIMO.
Environment :
Hardware : PC T61, USRP1, DBXR1 *
2
Software : Ubuntu 11.04, GNURADIO 3.4.1, airprobe
GSM-Receiver
When I found USRP1 having tow RXs, I always wanted to know how
could they work together. Now, I use both RXs to receive the same
GSM donwlink channel and save different
files: received_chan1.dat
and received_chan2.dat . Then, I
use GSM-Receiver which is a open-source project in airprobe
to decode GSM signals and dump to wireshark. I
contrast the different files result in wireshark and find they are
the same.
When you want to implement RX function, you should make sure
something you have already done.
- make usrp_source_c_sptr
usrp
- set nchannels (how many antennas do you need)
- select subdev (which daughterboard do you need)
- set frequency (which IF do you need)
- set mux (input mux configuration, more detail in GNURADIO
API)
- deinterleave function is called to separate RX1 data and RX2
data
1st step:
usrp_source_c_sptr usrp;
// contains 4 Rx paths
without halfbands and 0 tx paths.
std::string
fpga_filename="std_4rx_0tx.rbf";
// use default values
and add fpga_filename
usrp =
usrp_make_source_c(d_which, d_decim,
1, -1,
0, 0, 0,
fpga_filename.c_str());
2nd step:
usrp->set_nchannels(2);
3rd step:
usrp_subdev_spec myspec1(0,0);
db_base_sptr mysubdev1 =
usrp->selected_subdev(myspec1);
printf("\nSubdevice name is %s\n",
mysubdev1->side_and_name().c_str());
usrp_subdev_spec myspec2(1,0);
db_base_sptr mysubdev2 =
usrp->selected_subdev(myspec2);
printf("\nSubdevice name is %s\n",
mysubdev2->side_and_name().c_str());
4th step:
usrp_tune_result r;
bool ok = usrp->tune(0,
mysubdev1, freq, &r);//DDC0
if(!ok) {
throw
std::runtime_error("Could not set frequency.");
}
ok = usrp->tune(1,
mysubdev2, freq, &r);//DDC1
if(!ok) {
throw
std::runtime_error("Could not set frequency.");
}
5th step:
unsigned int mymux = 0x00003210;
//usrp->set_mux(mux);
usrp->set_mux(mymux);
printf("mux: %#08x\n",
mymux);
6th step:
gr_deinterleave_sptr my_deinter =
gr_make_deinterleave(sizeof(gr_complex));
Test:
Start wireshark and listen to your network interface. Use the
following capture filter:"port 4729"(Hint: Ctrl + i, then click
Option on any and enter the capture filter)
Keep wireshark running and keep listening. To decode RX1 file
and RX2 file and contrast both GSM
decoders.
use GSM-Receiver and type : ./go.sh
received_chan1.dat
you will see
and then type
: ./go.sh
received_chan2.dat
you will see
antenna2 channel RX's GSM data.
Conclusion :
USRP1 has double RXs and they both can work well. We can also
work in double TXs. However, if we use double antennas, USRP1 needs
4 RX channels and it can't work in TXs. In this experiment, we know
how to write code of RX and learn how to use double antennas of
USRP1 receive signal such as GSM downlink.
GNURADIO is interesting. Have fun!!
Reporter:Nick Chan
转载于:https://www.cnblogs.com/nickchan/archive/2011/10/02/3104476.html