Added option to force the DL/UL frequency at the UE

master
Ismael Gomez 7 years ago
parent a180b5ebac
commit fda886407b

@ -45,7 +45,9 @@ drb_config = drb.conf
# tx_gain: Transmit gain (dB).
# rx_gain: Optional receive gain (dB). If disabled, AGC if enabled
#
# Optional parameters:
# Optional parameters:
# dl_freq: Override DL frequency corresponding to dl_earfcn
# ul_freq: Override UL frequency corresponding to dl_earfcn (must be set if dl_freq is set)
# device_name: Device driver family. Supported options: "auto" (uses first found), "UHD" or "bladeRF"
# device_args: Arguments for the device driver. Options are "auto" or any string.
# Default for UHD: "recv_frame_size=9232,send_frame_size=9232"

@ -53,6 +53,7 @@ public:
void set_agc_enable(bool enable);
void set_earfcn(std::vector<uint32_t> earfcn);
void force_freq(float dl_freq, float ul_freq);
void reset_sync();
void cell_search_start();
@ -171,6 +172,10 @@ private:
int cell_meas_rsrp();
int cell_search(int force_N_id_2 = -1);
bool set_cell();
float dl_freq;
float ul_freq;
};
} // namespace srsue

@ -76,6 +76,7 @@ public:
void write_trace(std::string filename);
void set_earfcn(std::vector<uint32_t> earfcns);
void force_freq(float dl_freq, float ul_freq);
/********** RRC INTERFACE ********************/
void reset();
@ -167,7 +168,7 @@ private:
/* Current time advance */
uint32_t n_ta;
bool init_(srslte::radio *radio_handler, mac_interface_phy *mac, srslte::log *log_h, bool do_agc, uint32_t nof_workers);
void set_default_args(phy_args_t *args);
bool check_args(phy_args_t *args);

@ -65,6 +65,8 @@ void parse_args(all_args_t *args, int argc, char *argv[]) {
common.add_options()
("rf.dl_earfcn", bpo::value<uint32_t>(&args->rf.dl_earfcn)->default_value(3400), "Downlink EARFCN")
("rf.freq_offset", bpo::value<float>(&args->rf.freq_offset)->default_value(0), "(optional) Frequency offset")
("rf.dl_freq", bpo::value<float>(&args->rf.dl_freq)->default_value(-1), "Downlink Frequency (if positive overrides EARFCN)")
("rf.ul_freq", bpo::value<float>(&args->rf.ul_freq)->default_value(-1), "Uplink Frequency (if positive overrides EARFCN)")
("rf.rx_gain", bpo::value<float>(&args->rf.rx_gain)->default_value(-1), "Front-end receiver gain")
("rf.tx_gain", bpo::value<float>(&args->rf.tx_gain)->default_value(-1), "Front-end transmitter gain")
("rf.nof_rx_ant", bpo::value<uint32_t>(&args->rf.nof_rx_ant)->default_value(1), "Number of RX antennas")

@ -63,6 +63,8 @@ double callback_set_rx_gain(void *h, double gain) {
phch_recv::phch_recv() {
dl_freq = -1;
ul_freq = -1;
bzero(&cell, sizeof(srslte_cell_t));
running = false;
}
@ -445,6 +447,11 @@ void phch_recv::set_earfcn(std::vector<uint32_t> earfcn) {
this->earfcn = earfcn;
}
void phch_recv::force_freq(float dl_freq, float ul_freq) {
this->dl_freq = dl_freq;
this->ul_freq = ul_freq;
}
bool phch_recv::stop_sync() {
wait_radio_reset();
@ -568,17 +575,25 @@ bool phch_recv::cell_select(uint32_t earfcn, srslte_cell_t cell) {
bool phch_recv::set_frequency()
{
double dl_freq = 1e6*srslte_band_fd(current_earfcn);
double ul_freq = 1e6*srslte_band_fu(srslte_band_ul_earfcn(current_earfcn));
if (dl_freq > 0 && ul_freq > 0) {
double set_dl_freq = 0;
double set_ul_freq = 0;
if (this->dl_freq > 0 && this->ul_freq > 0) {
set_dl_freq = this->dl_freq;
set_ul_freq = this->ul_freq;
} else {
set_dl_freq = 1e6*srslte_band_fd(current_earfcn);
set_ul_freq = 1e6*srslte_band_fu(srslte_band_ul_earfcn(current_earfcn));
}
if (set_dl_freq > 0 && set_ul_freq > 0) {
log_h->info("SYNC: Set DL EARFCN=%d, f_dl=%.1f MHz, f_ul=%.1f MHz\n",
current_earfcn, dl_freq / 1e6, ul_freq / 1e6);
current_earfcn, set_dl_freq / 1e6, set_ul_freq / 1e6);
log_h->console("Searching cell in DL EARFCN=%d, f_dl=%.1f MHz, f_ul=%.1f MHz\n",
current_earfcn, dl_freq / 1e6, ul_freq / 1e6);
current_earfcn, set_dl_freq / 1e6, set_ul_freq / 1e6);
radio_h->set_rx_freq(dl_freq);
radio_h->set_tx_freq(ul_freq);
radio_h->set_rx_freq(set_dl_freq);
radio_h->set_tx_freq(set_ul_freq);
ul_dl_factor = radio_h->get_tx_freq()/radio_h->get_rx_freq();
srslte_ue_sync_reset(&ue_sync);

@ -332,6 +332,11 @@ void phy::set_earfcn(vector< uint32_t > earfcns)
sf_recv.set_earfcn(earfcns);
}
void phy::force_freq(float dl_freq, float ul_freq)
{
sf_recv.force_freq(dl_freq, ul_freq);
}
bool phy::sync_status()
{
return sf_recv.status_is_sync();

@ -193,6 +193,10 @@ bool ue::init(all_args_t *args_)
earfcn_list.push_back(args->rf.dl_earfcn);
phy.set_earfcn(earfcn_list);
if (args->rf.dl_freq > 0 && args->rf.ul_freq > 0) {
phy.force_freq(args->rf.dl_freq, args->rf.ul_freq);
}
printf("Waiting PHY to initialize...\n");
phy.wait_initialize();
phy.configure_ul_params();

@ -9,6 +9,8 @@
# rx_gain: Optional receive gain (dB). If disabled, AGC if enabled
#
# Optional parameters:
# dl_freq: Override DL frequency corresponding to dl_earfcn
# ul_freq: Override UL frequency corresponding to dl_earfcn
# nof_rx_ant: Number of RX antennas (Default 1, supported 1 or 2)
# device_name: Device driver family. Supported options: "auto" (uses first found), "UHD" or "bladeRF"
# device_args: Arguments for the device driver. Options are "auto" or any string.

Loading…
Cancel
Save