Commit a6168edf authored by kortke's avatar kortke

added support for USRP X300 (changing master clock rate)


git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6430 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 286dd891
...@@ -232,6 +232,8 @@ int openair0_device_init(openair0_device* device, openair0_config_t *openair0_cf ...@@ -232,6 +232,8 @@ int openair0_device_init(openair0_device* device, openair0_config_t *openair0_cf
memset(s, 0, sizeof(usrp_state_t)); memset(s, 0, sizeof(usrp_state_t));
// Initialize USRP device // Initialize USRP device
/* thomas 26.01.205*/
// std::string args = "type=b200";
std::string args = "type=b200"; std::string args = "type=b200";
/* std::string rx_subdev = "A:A A:B"; /* std::string rx_subdev = "A:A A:B";
...@@ -240,12 +242,40 @@ int openair0_device_init(openair0_device* device, openair0_config_t *openair0_cf ...@@ -240,12 +242,40 @@ int openair0_device_init(openair0_device* device, openair0_config_t *openair0_cf
uhd::device_addrs_t device_adds = uhd::device::find(args); uhd::device_addrs_t device_adds = uhd::device::find(args);
size_t i; size_t i;
printf("Checking for USRPs\n");
if(device_adds.size() == 0)
{
double usrp_master_clock = 184.32e6;
std::string args = "type=x300";
// workaround for an api problem, master clock has to be set with the constructor not via set_master_clock_rate
args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock);
uhd::device_addrs_t device_adds = uhd::device::find(args);
if(device_adds.size() == 0) if(device_adds.size() == 0)
{ {
std::cerr<<"No USRP Device Found. " << std::endl; std::cerr<<"No USRP Device Found. " << std::endl;
free(s); free(s);
return -1; return -1;
} }
printf("Found USRP X300\n");
s->usrp = uhd::usrp::multi_usrp::make(args);
// s->usrp->set_rx_subdev_spec(rx_subdev);
// s->usrp->set_tx_subdev_spec(tx_subdev);
// lock mboard clocks
s->usrp->set_clock_source("internal");
// this is not working yet, master clock has to be set via constructor
// set master clock rate and sample rate for tx & rx for streaming
//s->usrp->set_master_clock_rate(usrp_master_clock);
} else {
printf("Found USRP B200");
s->usrp = uhd::usrp::multi_usrp::make(args); s->usrp = uhd::usrp::multi_usrp::make(args);
// s->usrp->set_rx_subdev_spec(rx_subdev); // s->usrp->set_rx_subdev_spec(rx_subdev);
...@@ -255,7 +285,7 @@ int openair0_device_init(openair0_device* device, openair0_config_t *openair0_cf ...@@ -255,7 +285,7 @@ int openair0_device_init(openair0_device* device, openair0_config_t *openair0_cf
s->usrp->set_clock_source("internal"); s->usrp->set_clock_source("internal");
// set master clock rate and sample rate for tx & rx for streaming // set master clock rate and sample rate for tx & rx for streaming
s->usrp->set_master_clock_rate(30.72e6); s->usrp->set_master_clock_rate(30.72e6);
}
...@@ -297,6 +327,8 @@ int openair0_device_init(openair0_device* device, openair0_config_t *openair0_cf ...@@ -297,6 +327,8 @@ int openair0_device_init(openair0_device* device, openair0_config_t *openair0_cf
s->usrp->set_time_now(uhd::time_spec_t(0.0)); s->usrp->set_time_now(uhd::time_spec_t(0.0));
// display USRP settings // display USRP settings
std::cout << boost::format("Actual master clock: %fMHz...") % (s->usrp->get_master_clock_rate()/1e6) << std::endl << std::endl;
for (i=0;i<openair0_cfg[0].rx_num_channels;i++) { for (i=0;i<openair0_cfg[0].rx_num_channels;i++) {
if (i<openair0_cfg[0].rx_num_channels) { if (i<openair0_cfg[0].rx_num_channels) {
printf("RX Channel %lu\n",i); printf("RX Channel %lu\n",i);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment