32 #include <boost/format.hpp> 35 #include <uhd/usrp/multi_usrp.hpp> 38 #include <boost/foreach.hpp> 39 #include <boost/format.hpp> 41 #include <uhd/utils/safe_main.hpp> 42 #include <uhd/version.hpp> 43 #include <uhd/device.hpp> 44 #include <uhd/types/ranges.hpp> 45 #include <uhd/property_tree.hpp> 46 #include <boost/algorithm/string.hpp> 47 #include <uhd/usrp/dboard_id.hpp> 48 #include <uhd/usrp/mboard_eeprom.hpp> 49 #include <uhd/usrp/dboard_eeprom.hpp> 52 std::string
getMbName(uhd::usrp::multi_usrp::sptr usrp)
54 uhd::property_tree::sptr tree = usrp->get_device()->get_tree();
55 std::string mbname = tree->list(
"/mboards").at(0);
56 return tree->access<std::string>(
"/mboards/" + mbname +
"/name").
get();
61 uhd::property_tree::sptr tree = usrp->get_device()->get_tree();
62 std::string mbname = tree->list(
"/mboards").at(0);
64 uhd::usrp::mboard_eeprom_t eeprom = tree->access<uhd::usrp::mboard_eeprom_t>(
"/mboards/" + mbname +
"/eeprom").
get();
65 BOOST_FOREACH(
const std::string & key, eeprom.keys()) {
66 if( eeprom[key].empty() ) {
67 std::cerr << boost::format(
"Empty key [%s]\n") % key;
70 std::cerr << boost::format(
" eeprom[%s] = [%s]\n") % key % eeprom[key];
74 std::cerr << boost::format(
"went the direct route = [%s]\n")
75 % tree->access<uhd::usrp::mboard_eeprom_t>(
"/mboards/" + mbname +
"/eeprom").
get()[
"ip-addr"];
78 int main(
int argc,
char ** argv)
81 std::cerr <<
"Usage: IntN_FreqTable dev-arg-string" << std::endl;
85 std::string devaddr(argv[1]);
86 uhd::device_addr_t rad(devaddr);
88 uhd::usrp::multi_usrp::sptr usrp;
90 usrp = uhd::usrp::multi_usrp::make(rad);
93 uhd::freq_range_t rx_rf_freq_range, tx_rf_freq_range;
94 rx_rf_freq_range = usrp->get_rx_freq_range();
95 tx_rf_freq_range = usrp->get_tx_freq_range();
97 uhd::tune_result_t tunres_int;
100 double ff_incr = 1.0e6;
101 double r_st, r_en, target;
105 for(
int i = 0; i < 2; i++) {
106 r_st = (i == 0) ? rx_rf_freq_range.start() : tx_rf_freq_range.start();;
107 r_en = (i == 0) ? rx_rf_freq_range.stop() : tx_rf_freq_range.stop();;
110 uhd::tune_request_t treq(r_st);
111 treq.args = uhd::device_addr_t(
"mode_n=integer");
112 tunres_int = (i == 0) ? usrp->set_rx_freq(treq) : usrp->set_tx_freq(treq);
113 target = tunres_int.actual_rf_freq;
115 for(
double ff = target + ff_incr;
118 uhd::tune_request_t treq(ff);
120 treq.rf_freq_policy = uhd::tune_request_t::POLICY_MANUAL;
121 treq.args = uhd::device_addr_t(
"mode_n=integer");
122 tunres_int = (i == 0) ? usrp->set_rx_freq(treq) : usrp->set_tx_freq(treq);
124 std::string mode = (i == 0) ?
"RX" :
"TX";
126 std::cerr << boost::format(
"%s Range Check RF_actual %lf DDC = %lf target = %lf requested RF = %lf ddc = %lf\n")
128 % (1e-6 * tunres_int.actual_rf_freq)
129 % (1e-6 * tunres_int.actual_dsp_freq)
131 % (1e-6 * treq.rf_freq)
132 % (1e-6 * treq.dsp_freq);
134 if(target != tunres_int.actual_rf_freq) {
136 r_st = tunres_int.actual_rf_freq;
int main(int argc, char **argv)
void dumpProps(uhd::usrp::multi_usrp::sptr usrp)
std::string getMbName(uhd::usrp::multi_usrp::sptr usrp)