Skip to content

Add support for Ettus subdevices. #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions Transceiver52M/UHDDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ class uhd_device : public RadioDevice {
uhd_device(int sps, bool skip_rx);
~uhd_device();

int open(const std::string &args, bool extref);
int open(const std::string &args, bool extref, const std::string &subdev);
bool start();
bool stop();
void restart(uhd::time_spec_t ts);
Expand Down Expand Up @@ -530,7 +530,7 @@ bool uhd_device::parse_dev_type()
return true;
}

int uhd_device::open(const std::string &args, bool extref)
int uhd_device::open(const std::string &args, bool extref, const std::string &subdev)
{
// Find UHD devices
uhd::device_addr_t addr(args);
Expand All @@ -555,7 +555,13 @@ int uhd_device::open(const std::string &args, bool extref)

if (extref)
set_ref_clk(true);


//specify subdevice (daughterboard)
if(!subdev.empty()) {
usrp_dev->set_tx_subdev_spec(subdev);
usrp_dev->set_rx_subdev_spec(subdev);
}

// Create TX and RX streamers
uhd::stream_args_t stream_args("sc16");
tx_stream = usrp_dev->get_tx_stream(stream_args);
Expand Down
2 changes: 1 addition & 1 deletion Transceiver52M/radioDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class RadioDevice {
static RadioDevice *make(int sps, bool skipRx = false);

/** Initialize the USRP */
virtual int open(const std::string &args = "", bool extref = false)=0;
virtual int open(const std::string &args = "", bool extref = false, const std::string &subdev = "")=0;

/** Start the USRP */
virtual bool start()=0;
Expand Down
5 changes: 3 additions & 2 deletions Transceiver52M/runTransceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ int testConfig(const char *filename)
int main(int argc, char *argv[])
{
int trxPort, radioType, extref = 0, fail = 0;
std::string deviceArgs, logLevel, trxAddr;
std::string deviceArgs, logLevel, trxAddr, subdev;
RadioDevice *usrp = NULL;
RadioInterface *radio = NULL;
Transceiver *trx = NULL;
Expand Down Expand Up @@ -141,6 +141,7 @@ int main(int argc, char *argv[])
logLevel = gConfig.getStr("Log.Level");
trxPort = gConfig.getNum("TRX.Port");
trxAddr = gConfig.getStr("TRX.IP");
subdev = gConfig.getStr("TRX.Subdevice");

if (gConfig.defines("TRX.Reference"))
extref = gConfig.getNum("TRX.Reference");
Expand All @@ -155,7 +156,7 @@ int main(int argc, char *argv[])
srandom(time(NULL));

usrp = RadioDevice::make(SPS);
radioType = usrp->open(deviceArgs, extref);
radioType = usrp->open(deviceArgs, extref, subdev);
if (radioType < 0) {
LOG(ALERT) << "Transceiver exiting..." << std::endl;
return EXIT_FAILURE;
Expand Down
11 changes: 11 additions & 0 deletions apps/GetConfigurationKeys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3077,6 +3077,17 @@ ConfigurationKeyMap getConfigurationKeys()
);
map[tmp.getName()] = tmp;
}

{ ConfigurationKey tmp("TRX.Subdevice","",
"",
ConfigurationKey::CUSTOMERWARN,
ConfigurationKey::STRING,
"",
true,
"This value is a string that specifies a subdevice for Ettus Hardware."
);
map[tmp.getName()] = tmp;
}

{ ConfigurationKey tmp("TRX.Timeout.Clock","10",
"seconds",
Expand Down
1 change: 1 addition & 0 deletions apps/OpenBTS.example.sql
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ INSERT OR IGNORE INTO "CONFIG" VALUES('TRX.IP','127.0.0.1',1,0,'IP address of th
INSERT OR IGNORE INTO "CONFIG" VALUES('TRX.MinimumRxRSSI','-63',0,0,'Bursts received at the physical layer below this threshold are automatically ignored. Values in dB. Set at the factory. Do not adjust without proper calibration.');
INSERT OR IGNORE INTO "CONFIG" VALUES('TRX.Port','5700',1,0,'IP port of the transceiver application. Static.');
INSERT OR IGNORE INTO "CONFIG" VALUES('TRX.RadioFrequencyOffset','128',1,0,'Fine-tuning adjustment for the Transceiver master clock. Roughly 170 Hz/step. Set at the factory. Do not adjust without proper calibration. Static.');
INSERT OR IGNORE INTO "CONFIG" VALUES('TRX.Subdevice','',1,0,'Subdevice (Daughterboard) to use on Ettus hardware that supports it');
INSERT OR IGNORE INTO "CONFIG" VALUES('TRX.Timeout.Clock','10',0,0,'How long to wait during a read operation from the Transceiver before giving up.');
INSERT OR IGNORE INTO "CONFIG" VALUES('TRX.Timeout.Start','2',0,0,'How long to wait during system startup before checking to see if the Transceiver can be reached.');
INSERT OR IGNORE INTO "CONFIG" VALUES('TRX.TxAttenOffset','0',1,0,'Hardware-specific gain adjustment for transmitter, matched to the power amplifier, expessed as an attenuation in dB. Set at the factory. Do not adjust without proper calibration. Static.');
Expand Down