[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r10237 - in gnuradio/branches/developers/gnychis/inban
From: |
gnychis |
Subject: |
[Commit-gnuradio] r10237 - in gnuradio/branches/developers/gnychis/inband_dboard/usrp/host: apps-inband lib/inband |
Date: |
Thu, 15 Jan 2009 23:24:31 -0700 (MST) |
Author: gnychis
Date: 2009-01-15 23:24:28 -0700 (Thu, 15 Jan 2009)
New Revision: 10237
Modified:
gnuradio/branches/developers/gnychis/inband_dboard/usrp/host/apps-inband/test_usrp_inband_tx.cc
gnuradio/branches/developers/gnychis/inband_dboard/usrp/host/lib/inband/usrp_usb_interface.cc
gnuradio/branches/developers/gnychis/inband_dboard/usrp/host/lib/inband/usrp_usb_interface.h
Log:
cleaning up TX and RX tuning code, tested and the cards are tuning properly,
but the transmission attempts are failing
Modified:
gnuradio/branches/developers/gnychis/inband_dboard/usrp/host/apps-inband/test_usrp_inband_tx.cc
===================================================================
---
gnuradio/branches/developers/gnychis/inband_dboard/usrp/host/apps-inband/test_usrp_inband_tx.cc
2009-01-16 05:56:39 UTC (rev 10236)
+++
gnuradio/branches/developers/gnychis/inband_dboard/usrp/host/apps-inband/test_usrp_inband_tx.cc
2009-01-16 06:24:28 UTC (rev 10237)
@@ -124,9 +124,10 @@
pmt_intern("interp-tx"),
pmt_from_long(64));
- pmt_dict_set(usrp_dict,
- pmt_intern("rf-freq"),
- pmt_from_long(10e6));
+// If unspecified, chooses center frequency from range
+// pmt_dict_set(usrp_dict,
+// pmt_intern("rf-freq"),
+// pmt_from_long(10e6));
define_component("server", "usrp_server", usrp_dict);
Modified:
gnuradio/branches/developers/gnychis/inband_dboard/usrp/host/lib/inband/usrp_usb_interface.cc
===================================================================
---
gnuradio/branches/developers/gnychis/inband_dboard/usrp/host/lib/inband/usrp_usb_interface.cc
2009-01-16 05:56:39 UTC (rev 10236)
+++
gnuradio/branches/developers/gnychis/inband_dboard/usrp/host/lib/inband/usrp_usb_interface.cc
2009-01-16 06:24:28 UTC (rev 10237)
@@ -60,7 +60,7 @@
d_rx_reading(false),
d_interp_tx(128),
d_decim_rx(128),
- d_rf_freq(10e6),
+ d_rf_freq(-1),
d_rbf("inband_tx_rx.rbf")
{
// Dictionary for arguments to all of the components
@@ -300,39 +300,56 @@
return;
}
+ // Perform TX daughterboard tuning
+ double target_freq;
+ unsigned int mux;
+ int tgain, rgain;
+ float input_rate;
+ bool ok;
+ usrp_tune_result r;
+
+ // Cast to usrp_basic and then detect daughterboards
d_ub_tx = d_utx;
usrp_subdev_spec tspec = pick_tx_subdevice();
db_base_sptr tsubdev = d_ub_tx->selected_subdev(tspec);
- printf("TX Subdevice name is %s\n", tsubdev->name().c_str());
- printf("TX Subdevice freq range: (%g, %g)\n",
- tsubdev->freq_min(), tsubdev->freq_max());
- unsigned int mux = d_utx->determine_tx_mux_value(tspec);
- printf("mux: %#08x\n", mux);
+
+ // Set the TX mux value
+ mux = d_utx->determine_tx_mux_value(tspec);
d_utx->set_mux(mux);
- int tgain = tsubdev->gain_max();
+
+ // Set the TX gain and determine rate
+ tgain = tsubdev->gain_max();
tsubdev->set_gain(tgain);
- float input_rate = d_ub_tx->converter_rate() / d_utx->interp_rate();
- printf("baseband rate: %g\n", input_rate);
- usrp_tune_result r;
- double target_freq = d_rf_freq;
- bool ok = d_utx->tune(tsubdev->which(), tsubdev, target_freq, &r);
+ input_rate = d_ub_tx->converter_rate() / d_utx->interp_rate();
+
+ // Perform the actual tuning, if no frequency specified then pick
+ if(d_rf_freq==-1)
+ target_freq =
tsubdev->freq_min()+((tsubdev->freq_max()-tsubdev->freq_min())/2.0);
+ else
+ target_freq = d_rf_freq;
+ ok = d_utx->tune(tsubdev->which(), tsubdev, target_freq, &r);
tsubdev->set_enable(true);
+
+ if(verbose) {
+ printf("TX Subdevice name is %s\n", tsubdev->name().c_str());
+ printf("TX Subdevice freq range: (%g, %g)\n",
+ tsubdev->freq_min(), tsubdev->freq_max());
+ printf("mux: %#08x\n", mux);
+ printf("target_freq: %f\n", target_freq);
+ printf("ok: %s\n", ok ? "true" : "false");
+ printf("r.baseband_freq: %f\n", r.baseband_freq);
+ printf("r.dxc_freq: %f\n", r.dxc_freq);
+ printf("r.residual_freq: %f\n", r.residual_freq);
+ printf("r.inverted: %d\n", r.inverted);
+ }
if(!ok) {
- if (verbose)
- std::cout << "[USRP_USB_INTERFACE] Failed to set center frequency on
TX\n";
+ std::cerr << "[USRP_USB_INTERFACE] Failed to set center frequency on TX\n";
reply_data = pmt_list2(invocation_handle, PMT_F);
d_cs->send(s_response_usrp_open, reply_data);
return;
}
- printf("target_freq: %f\n", target_freq);
- printf("ok: %s\n", ok ? "true" : "false");
- printf("r.baseband_freq: %f\n", r.baseband_freq);
- printf("r.dxc_freq: %f\n", r.dxc_freq);
- printf("r.residual_freq: %f\n", r.residual_freq);
- printf("r.inverted: %d\n", r.inverted);
-
//d_utx->start();
if (verbose)
@@ -356,37 +373,43 @@
return;
}
+ // Cast to usrp_basic and then detect daughterboards
d_ub_rx = d_urx;
usrp_subdev_spec rspec = pick_rx_subdevice();
db_base_sptr rsubdev = d_ub_rx->selected_subdev(rspec);
- printf("RX Subdevice name is %s\n", rsubdev->name().c_str());
- printf("RX Subdevice freq range: (%g, %g)\n",
- rsubdev->freq_min(), rsubdev->freq_max());
+
+ // Set the RX mux value
mux = d_urx->determine_rx_mux_value(rspec);
- printf("mux: %#08x\n", mux);
d_urx->set_mux(mux);
- int rgain = rsubdev->gain_max();
+
+ // Set the TX gain and determine rate
+ rgain = rsubdev->gain_max();
rsubdev->set_gain(rgain);
input_rate = d_ub_rx->converter_rate() / d_urx->decim_rate();
- printf("baseband rate: %g\n", input_rate);
+
ok = d_urx->tune(rsubdev->which(), rsubdev, target_freq, &r);
rsubdev->set_enable(true);
+// if(verbose) {
+ printf("RX Subdevice name is %s\n", rsubdev->name().c_str());
+ printf("RX Subdevice freq range: (%g, %g)\n",
+ rsubdev->freq_min(), rsubdev->freq_max());
+ printf("mux: %#08x\n", mux);
+ printf("target_freq: %f\n", target_freq);
+ printf("ok: %s\n", ok ? "true" : "false");
+ printf("r.baseband_freq: %f\n", r.baseband_freq);
+ printf("r.dxc_freq: %f\n", r.dxc_freq);
+ printf("r.residual_freq: %f\n", r.residual_freq);
+ printf("r.inverted: %d\n", r.inverted);
+// }
+
if(!ok) {
- if (verbose)
- std::cout << "[USRP_USB_INTERFACE] Failed to set center frequency on
RX\n";
+ std::cerr << "[USRP_USB_INTERFACE] Failed to set center frequency on RX\n";
reply_data = pmt_list2(invocation_handle, PMT_F);
d_cs->send(s_response_usrp_open, reply_data);
return;
}
- printf("target_freq: %f\n", target_freq);
- printf("ok: %s\n", ok ? "true" : "false");
- printf("r.baseband_freq: %f\n", r.baseband_freq);
- printf("r.dxc_freq: %f\n", r.dxc_freq);
- printf("r.residual_freq: %f\n", r.residual_freq);
- printf("r.inverted: %d\n", r.inverted);
-
if (verbose)
std::cout << "[USRP_USB_INTERFACE] Setup RX channel\n";
Modified:
gnuradio/branches/developers/gnychis/inband_dboard/usrp/host/lib/inband/usrp_usb_interface.h
===================================================================
---
gnuradio/branches/developers/gnychis/inband_dboard/usrp/host/lib/inband/usrp_usb_interface.h
2009-01-16 05:56:39 UTC (rev 10236)
+++
gnuradio/branches/developers/gnychis/inband_dboard/usrp/host/lib/inband/usrp_usb_interface.h
2009-01-16 06:24:28 UTC (rev 10237)
@@ -52,7 +52,7 @@
long d_interp_tx;
long d_decim_rx;
- long d_rf_freq;
+ double d_rf_freq;
std::string d_rbf;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r10237 - in gnuradio/branches/developers/gnychis/inband_dboard/usrp/host: apps-inband lib/inband,
gnychis <=