Skip to content
Draft
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
13 changes: 7 additions & 6 deletions CC/Sounder/BaseRadioSetUHD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,12 @@ BaseRadioSetUHD::BaseRadioSetUHD(Config* cfg) : _cfg(cfg) {
}

// write TDD schedule and beacons to FPFA buffers only for Iris
const auto clock_source = _cfg->getBsClockType();
bsRadios->RawDev()->set_time_source(clock_source);
const auto timing_source = _cfg->getBsTimingSrc();
const auto clock_source = _cfg->getBsClockSrc();
bsRadios->RawDev()->set_time_source(timing_source);
bsRadios->RawDev()->set_clock_source(clock_source);
bsRadios->RawDev()->set_time_unknown_pps(uhd::time_spec_t(0.0));
MLPD_INFO(
/*MLPD_INFO(
"USRP BS Clock source requested %s, actual %s, Time Source requested "
"%s, actual %s\n",
clock_source.c_str(),
Expand All @@ -95,7 +96,7 @@ BaseRadioSetUHD::BaseRadioSetUHD(Config* cfg) : _cfg(cfg) {
bsRadios->RawDev()
->get_time_source(uhd::usrp::multi_usrp::ALL_MBOARDS)
.c_str());

*/
// Wait for pps sync pulse
std::this_thread::sleep_for(std::chrono::seconds(1));

Expand Down Expand Up @@ -212,7 +213,6 @@ void BaseRadioSetUHD::init(BaseRadioContext* context) {
int c = context->cell;
std::atomic_ulong* thread_count = context->thread_count;
delete context;

MLPD_TRACE("Deleting context for tid: %d\n", i);

std::map<std::string, std::string> args;
Expand All @@ -222,7 +222,8 @@ void BaseRadioSetUHD::init(BaseRadioContext* context) {
std::vector<std::string> address_list;
for (size_t i = 0; i < num_radios; i++) {
std::ostringstream oss;
oss << "addr" << i;
//oss << "addr" << i;
oss << "serial";
address_list.push_back(oss.str());
args[address_list.at(i)] = _cfg->bs_sdr_ids().at(c).at(i);
}
Expand Down
10 changes: 6 additions & 4 deletions CC/Sounder/ClientRadioSetUHD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,12 @@ ClientRadioSetUHD::ClientRadioSetUHD(Config* cfg) : _cfg(cfg) {
"discovered in the network!"
<< std::endl;
} else {
const auto cl_clock_source = _cfg->getClClockType(0);
radio_->RawDev()->set_time_source(cl_clock_source);
const auto cl_timing_source = _cfg->getClTimingSrc(0);
const auto cl_clock_source = _cfg->getClClockSrc(0);
radio_->RawDev()->set_time_source(cl_timing_source);
radio_->RawDev()->set_clock_source(cl_clock_source);
radio_->RawDev()->set_time_unknown_pps(uhd::time_spec_t(0.0));
MLPD_INFO(
/*MLPD_INFO(
"USRP UE Clock source requested %s, actual %s, Time Source requested "
"%s, actual %s\n",
cl_clock_source.c_str(),
Expand All @@ -108,6 +109,7 @@ ClientRadioSetUHD::ClientRadioSetUHD(Config* cfg) : _cfg(cfg) {
radio_->RawDev()
->get_time_source(uhd::usrp::multi_usrp::ALL_MBOARDS)
.c_str());
*/
radio_->activateRecv();
radio_->activateXmit();
MLPD_INFO("%s done!\n", __func__);
Expand Down Expand Up @@ -137,7 +139,7 @@ void ClientRadioSetUHD::init(ClientRadioContext* context) {
std::map<std::string, std::string> args;
args["timeout"] = "1000000";
args["driver"] = "uhd";
args["addr"] = _cfg->cl_sdr_ids().at(i);
args["serial"] = _cfg->cl_sdr_ids().at(i);

try {
radio_ = nullptr;
Expand Down
4 changes: 2 additions & 2 deletions CC/Sounder/RadioUHD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ void RadioUHD::dev_init([[maybe_unused]] Config* _cfg, int ch, double rxgain,
dev_->set_rx_antenna("TX/RX", ch);

// update for UHD multi USRP
dev_->set_rx_gain(std::min(31.5, rxgain), "PGA0", ch);
dev_->set_tx_gain(std::min(31.5, txgain), "PGA0", ch);
dev_->set_rx_gain(std::min(100.5, rxgain), ch);
dev_->set_tx_gain(std::min(100.5, txgain), ch);
}

void RadioUHD::drain_buffers(std::vector<void*> buffs, int symSamp) {
Expand Down
18 changes: 12 additions & 6 deletions CC/Sounder/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ static constexpr size_t kMaxSupportedFFTSize = 2048;
static constexpr size_t kMinSupportedFFTSize = 64;
static constexpr size_t kMaxSupportedCPSize = 128;

static const std::string kDefaultBsClockType = "external";
static const std::string kDefaultUeClockType = "internal";
static const std::string kDefaultBsClockSrc = "internal";
static const std::string kDefaultUeClockSrc = "internal";
static const std::string kDefaultBsTimingSrc = "internal";
static const std::string kDefaultUeTimingSrc = "internal";

Config::Config(const std::string& jsonfile, const std::string& directory,
const bool bs_only, const bool client_only, const bool calibrate)
Expand Down Expand Up @@ -127,7 +129,8 @@ Config::Config(const std::string& jsonfile, const std::string& directory,
beacon_ch_ = beacon_ant_ % bs_sdr_ch_;
max_frame_ = tddConf.value("max_frame", 0);
bs_hw_framer_ = tddConf.value("bs_hw_framer", true);
bs_clock_type_ = tddConf.value("bs_clock_type", kDefaultBsClockType);
bs_clock_src_ = tddConf.value("bs_clock_src", kDefaultBsClockSrc);
bs_timing_src_ = tddConf.value("bs_timing_src", kDefaultBsTimingSrc);

// Load/Build BS and Client SDRs' Schedules
bs_array_frames_.resize(num_cells_);
Expand Down Expand Up @@ -211,15 +214,18 @@ Config::Config(const std::string& jsonfile, const std::string& directory,
corr_scale_.assign(corr_scale.begin(), corr_scale.end());
}

auto cl_clock_type = tddConf.value("cl_clock_type", json::array());
auto cl_clock_src = tddConf.value("cl_clock_src", json::array());
auto cl_timing_src = tddConf.value("cl_timing_src", json::array());
if (tx_advance.empty() == true) {
cl_clock_type_.resize(num_cl_sdrs_, kDefaultUeClockType);
cl_clock_src_.resize(num_cl_sdrs_, kDefaultUeClockSrc);
cl_timing_src_.resize(num_cl_sdrs_, kDefaultUeTimingSrc);
} else {
if (client_present_ && tx_advance.size() != num_cl_sdrs_) {
MLPD_ERROR("cl_clock_type size must be same as the number of clients!\n");
std::exit(1);
}
cl_clock_type_.assign(cl_clock_type.begin(), cl_clock_type.end());
cl_clock_src_.assign(cl_clock_src.begin(), cl_clock_src.end());
cl_timing_src_.assign(cl_timing_src.begin(), cl_timing_src.end());
}

ul_data_frame_num_ = tddConf.value("ul_data_frame_num", 1);
Expand Down
2 changes: 1 addition & 1 deletion CC/Sounder/files/special_conf/usrp_16qam.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"Clients": {
"sdr": [
"10.10.23.5"
"30AD2E0"
]
}
}
16 changes: 11 additions & 5 deletions CC/Sounder/include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,13 @@ class Config {
}
inline size_t getTxFrameDelta() const { return tx_frame_delta_; }

inline const std::string getBsClockType() const { return bs_clock_type_; }
inline const std::string getClClockType(size_t ue_idx) const {
return cl_clock_type_.at(ue_idx);
inline const std::string getBsClockSrc() const { return bs_clock_src_; }
inline const std::string getClClockSrc(size_t ue_idx) const {
return cl_clock_src_.at(ue_idx);
}
inline const std::string getBsTimingSrc() const { return bs_timing_src_; }
inline const std::string getClTimingSrc(size_t ue_idx) const {
return cl_timing_src_.at(ue_idx);
}

size_t getNumAntennas();
Expand Down Expand Up @@ -384,7 +388,8 @@ class Config {
bool ref_node_enable_;
size_t cal_ref_sdr_id_;
size_t tx_frame_delta_;
std::string bs_clock_type_;
std::string bs_clock_src_;
std::string bs_timing_src_;

// Clients features
std::vector<std::string> cl_sdr_ids_;
Expand All @@ -398,7 +403,8 @@ class Config {
bool cl_power_ramp_;
int cl_power_ramp_lo_;
int cl_power_ramp_hi_;
std::vector<std::string> cl_clock_type_;
std::vector<std::string> cl_clock_src_;
std::vector<std::string> cl_timing_src_;

std::vector<int> tx_advance_;
std::vector<float> corr_scale_;
Expand Down