add freq_offset option to ue.conf

master
Ismael Gomez 7 years ago
parent 14a901c807
commit b771c35371

@ -98,6 +98,7 @@ namespace srslte {
void set_tx_rx_gain_offset(float offset);
double set_rx_gain_th(float gain);
void set_freq_offset(float freq);
void set_tx_freq(float freq);
void set_rx_freq(float freq);
@ -158,7 +159,7 @@ namespace srslte {
const static double blade_default_tx_adv_samples = 27;
const static double blade_default_tx_adv_offset_sec = 1e-6;
float tx_freq, rx_freq;
float tx_freq, rx_freq, freq_offset;
trace<uint32_t> tr_local_time;
trace<uint32_t> tr_usrp_time;

@ -250,9 +250,13 @@ void radio::save_trace(uint32_t is_eob, srslte_timestamp_t *tx_time) {
}
}
void radio::set_freq_offset(float freq) {
freq_offset = freq;
}
void radio::set_rx_freq(float freq)
{
rx_freq = srslte_rf_set_rx_freq(&rf_device, freq);
rx_freq = srslte_rf_set_rx_freq(&rf_device, freq+freq_offset);
}
void radio::set_rx_gain(float gain)
@ -277,7 +281,7 @@ void radio::set_rx_srate(float srate)
void radio::set_tx_freq(float freq)
{
tx_freq = srslte_rf_set_tx_freq(&rf_device, freq);
tx_freq = srslte_rf_set_tx_freq(&rf_device, freq+freq_offset);
}
void radio::set_tx_gain(float gain)

@ -55,6 +55,7 @@ typedef struct {
uint32_t dl_earfcn;
float dl_freq;
float ul_freq;
float freq_offset;
float rx_gain;
float tx_gain;
uint32_t nof_rx_ant;

@ -62,8 +62,7 @@ void parse_args(all_args_t *args, int argc, char *argv[]) {
bpo::options_description common("Configuration options");
common.add_options()
("rf.dl_earfcn", bpo::value<uint32_t>(&args->rf.dl_earfcn)->default_value(3400), "Downlink EARFCN")
("rf.dl_freq", bpo::value<float>(&args->rf.dl_freq)->default_value(2680000000), "(optional) Downlink centre frequency")
("rf.ul_freq", bpo::value<float>(&args->rf.ul_freq)->default_value(2560000000), "(optional) Uplink centre frequency")
("rf.freq_offset", bpo::value<float>(&args->rf.freq_offset)->default_value(0), "(optional) Frequency offset")
("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")

@ -235,15 +235,19 @@ bool phch_recv::cell_search(int force_N_id_2) {
bzero(found_cells, 3 * sizeof(srslte_ue_cellsearch_result_t));
if (srate_mode != SRATE_FIND) {
printf("set rx rate\n");
srate_mode = SRATE_FIND;
radio_h->set_rx_srate(1.92e6);
}
printf("start rx\n");
radio_h->start_rx();
/* Find a cell in the given N_id_2 or go through the 3 of them to find the strongest */
uint32_t max_peak_cell = 0;
int ret = SRSLTE_ERROR;
Info("Searching for cell...\n");
if (force_N_id_2 >= 0 && force_N_id_2 < 3) {
ret = srslte_ue_cellsearch_scan_N_id_2(&cs, force_N_id_2, &found_cells[force_N_id_2]);
max_peak_cell = force_N_id_2;
@ -253,13 +257,14 @@ bool phch_recv::cell_search(int force_N_id_2) {
last_gain = srslte_agc_get_gain(&cs.ue_sync.agc);
printf("stop rx\n");
radio_h->stop_rx();
if (ret < 0) {
Error("Error decoding MIB: Error searching PSS\n");
return false;
} else if (ret == 0) {
Error("Error decoding MIB: Could not find any PSS in this frequency\n");
Info("Could not find any cell in this frequency\n");
return false;
}
@ -404,6 +409,7 @@ bool phch_recv::stop_sync() {
void phch_recv::cell_search_inc()
{
printf("cell search inc\n");
cur_earfcn_index++;
Info("SYNC: Cell Search idx %d/%d\n", cur_earfcn_index, earfcn.size());
if (cur_earfcn_index >= 0) {
@ -494,8 +500,9 @@ bool phch_recv::set_frequency()
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);
radio_h->set_rx_freq(dl_freq-4000);
radio_h->set_tx_freq(ul_freq-4000);
printf("set frequency\n");
radio_h->set_rx_freq(dl_freq);
radio_h->set_tx_freq(ul_freq);
ul_dl_factor = ul_freq / dl_freq;
srslte_ue_sync_reset(&ue_sync);
@ -549,6 +556,7 @@ void phch_recv::run_thread() {
Info("SYNC: Cell found. Synchronizing...\n");
} else {
printf("no trobat in progress=%d\n", cell_search_in_progress);
if (cell_search_in_progress) {
cell_search_inc();
}

@ -32,7 +32,6 @@
#include <string>
#include <algorithm>
#include <iterator>
#include <ue.h>
using namespace srslte;
@ -157,6 +156,7 @@ bool ue::init(all_args_t *args_)
}
radio.register_error_handler(rf_msg);
radio.set_freq_offset(args->rf.freq_offset);
mac.init(&phy, &rlc, &rrc, &mac_log);
rlc.init(&pdcp, &rrc, this, &rlc_log, &mac, 0 /* RB_ID_SRB0 */);

@ -3,8 +3,8 @@
#####################################################################
# RF configuration
#
# dl_freq: Downlink centre frequency (Hz).
# ul_freq: Uplink centre frequency (Hz).
# dl_earfcn: Downlink EARFCN code.
# freq_offset: Uplink and Downlink optional frequency offset (in Hz)
# tx_gain: Transmit gain (dB).
# rx_gain: Optional receive gain (dB). If disabled, AGC if enabled
#
@ -21,8 +21,8 @@
# Default "auto". B210 USRP: 400 us, bladeRF: 0 us.
#####################################################################
[rf]
dl_freq = 2685000000
ul_freq = 2565000000
dl_earfcn = 3400
freq_offset = 0
tx_gain = 80
rx_gain = 60

Loading…
Cancel
Save