rrc/phy/nr: calculate tuning freq of NR carrier from RRC signaling params

skip initial tuning to hard-coded NR frequency and use RRC-provided
values to calculate center frequency
This commit is contained in:
Andre Puschmann 2021-04-21 15:56:52 +02:00
parent 6e79ae67aa
commit 4dd17aee45
14 changed files with 74 additions and 57 deletions

View File

@ -280,6 +280,7 @@ typedef struct SRSRAN_API {
uint32_t pci;
uint32_t absolute_frequency_ssb;
uint32_t absolute_frequency_point_a;
uint32_t offset_to_carrier; ///< Offset between point A and the lowest subcarrier of the lowest RB
srsran_subcarrier_spacing_t scs;
uint32_t nof_prb; ///< @brief See TS 38.101-1 Table 5.3.2-1 for more details
uint32_t start;

View File

@ -1182,14 +1182,12 @@ bool make_phy_carrier_cfg(const freq_info_dl_s& asn1_freq_info_dl, srsran_carrie
asn1::log_warning("Option absolute_freq_ssb not present");
return false;
}
uint32_t absolute_frequency_point_a = asn1_freq_info_dl.absolute_freq_point_a;
if (asn1_freq_info_dl.scs_specific_carrier_list.size() != 1) {
asn1::log_warning("Option absolute_freq_ssb not present");
return false;
}
uint32_t nof_prb = asn1_freq_info_dl.scs_specific_carrier_list[0].carrier_bw;
srsran_subcarrier_spacing_t scs = srsran_subcarrier_spacing_15kHz;
srsran_subcarrier_spacing_t scs = srsran_subcarrier_spacing_15kHz;
switch (asn1_freq_info_dl.scs_specific_carrier_list[0].subcarrier_spacing) {
case subcarrier_spacing_opts::options::khz15:
scs = srsran_subcarrier_spacing_15kHz;
@ -1211,8 +1209,9 @@ bool make_phy_carrier_cfg(const freq_info_dl_s& asn1_freq_info_dl, srsran_carrie
}
// As the carrier structure requires parameters from different objects, set fields separately
out_carrier_nr->absolute_frequency_ssb = absolute_frequency_ssb;
out_carrier_nr->absolute_frequency_point_a = absolute_frequency_point_a;
out_carrier_nr->nof_prb = nof_prb;
out_carrier_nr->absolute_frequency_point_a = asn1_freq_info_dl.absolute_freq_point_a;
out_carrier_nr->offset_to_carrier = asn1_freq_info_dl.scs_specific_carrier_list[0].offset_to_carrier;
out_carrier_nr->nof_prb = asn1_freq_info_dl.scs_specific_carrier_list[0].carrier_bw;
out_carrier_nr->scs = scs;
return true;
}

View File

@ -18,6 +18,8 @@ int bands_test_nr()
srsran::srsran_band_helper bands;
TESTASSERT(bands.nr_arfcn_to_freq(632628) == 3489.42e6);
TESTASSERT(bands.nr_arfcn_to_freq(633928) == 3508.92e6); // default refPointA
TESTASSERT(bands.nr_arfcn_to_freq(634240) == 3513.6e6); // default ARFCN with freq divisible by 11.52 MHz
const uint32_t max_valid_nr_arfcn = 3279165;

View File

@ -18,13 +18,14 @@
#include <stdlib.h>
static srsran_carrier_nr_t carrier = {
1, // pci
0, // absolute_frequency_ssb
0, // absolute_frequency_point_a
srsran_subcarrier_spacing_15kHz, // scs
50, // nof_prb
0, // start
1 // max_mimo_layers
1, // pci
0, // absolute_frequency_ssb
0, // absolute_frequency_point_a
0, // offset_to_carrier
srsran_subcarrier_spacing_15kHz, // scs
50, // nof_prb
0, // start
1 // max_mimo_layers
};
static float snr_dB = 20.0;

View File

@ -20,15 +20,15 @@
#include <strings.h>
#include <unistd.h>
static srsran_carrier_nr_t carrier = {
1, // pci
0, // absolute_frequency_ssb
0, // absolute_frequency_point_a
srsran_subcarrier_spacing_15kHz, // scs
50, // nof_prb
0, // start
1 // max_mimo_layers
1, // pci
0, // absolute_frequency_ssb
0, // absolute_frequency_point_a
0, // offset_to_carrier
srsran_subcarrier_spacing_15kHz, // scs
50, // nof_prb
0, // start
1 // max_mimo_layers
};
typedef struct {

View File

@ -19,6 +19,7 @@ static srsran_carrier_nr_t carrier = {
1, // pci
0, // absolute_frequency_ssb
0, // absolute_frequency_point_a
0, // offset_to_carrier
srsran_subcarrier_spacing_15kHz, // scs
50, // nof_prb
0, // start

View File

@ -21,16 +21,16 @@
#include <math.h>
static srsran_carrier_nr_t carrier = {
1, // pci
0, // absolute_frequency_ssb
0, // absolute_frequency_point_a
srsran_subcarrier_spacing_15kHz, // scs
SRSRAN_MAX_PRB_NR, // nof_prb
0, // start
1 // max_mimo_layers
1, // pci
0, // absolute_frequency_ssb
0, // absolute_frequency_point_a
0, // offset_to_carrier
srsran_subcarrier_spacing_15kHz, // scs
SRSRAN_MAX_PRB_NR, // nof_prb
0, // start
1 // max_mimo_layers
};
static uint32_t n_prb = 0; // Set to 0 for steering
static uint32_t mcs = 30; // Set to 30 for steering
static srsran_sch_cfg_nr_t pdsch_cfg = {};

View File

@ -26,6 +26,7 @@ static srsran_carrier_nr_t carrier = {
1, // pci
0, // absolute_frequency_ssb
0, // absolute_frequency_point_a
0, // offset_to_carrier
srsran_subcarrier_spacing_15kHz, // scs
6, // nof_prb
0, // start

View File

@ -20,13 +20,14 @@
#include <getopt.h>
static srsran_carrier_nr_t carrier = {
1, // pci
0, // absolute_frequency_ssb
0, // absolute_frequency_point_a
srsran_subcarrier_spacing_15kHz, // scs
SRSRAN_MAX_PRB_NR, // nof_prb
0, // start
1 // max_mimo_layers
1, // pci
0, // absolute_frequency_ssb
0, // absolute_frequency_point_a
0, // offset_to_carrier
srsran_subcarrier_spacing_15kHz, // scs
SRSRAN_MAX_PRB_NR, // nof_prb
0, // start
1 // max_mimo_layers
};
static uint32_t n_prb = 0; // Set to 0 for steering

View File

@ -19,13 +19,14 @@
#include <srsran/phy/utils/random.h>
static srsran_carrier_nr_t carrier = {
1, // pci
0, // absolute_frequency_ssb
0, // absolute_frequency_point_a
srsran_subcarrier_spacing_15kHz, // scs
SRSRAN_MAX_PRB_NR, // nof_prb
0, // start
1 // max_mimo_layers
1, // pci
0, // absolute_frequency_ssb
0, // absolute_frequency_point_a
0, // offset_to_carrier
srsran_subcarrier_spacing_15kHz, // scs
SRSRAN_MAX_PRB_NR, // nof_prb
0, // start
1 // max_mimo_layers
};
static uint32_t n_prb = 0; // Set to 0 for steering

View File

@ -20,13 +20,14 @@
#include <getopt.h>
static srsran_carrier_nr_t carrier = {
501, // pci
0, // absolute_frequency_ssb
0, // absolute_frequency_point_a
srsran_subcarrier_spacing_15kHz, // scs
52, // nof_prb
0, // start
1 // max_mimo_layers
501, // pci
0, // absolute_frequency_ssb
0, // absolute_frequency_point_a
0, // offset_to_carrier
srsran_subcarrier_spacing_15kHz, // scs
52, // nof_prb
0, // start
1 // max_mimo_layers
};
static uint32_t n_prb = 0; // Set to 0 for steering

View File

@ -13,6 +13,7 @@
#include <string>
#include <sys/mman.h>
#include "srsran/common/band_helper.h"
#include "srsran/common/standard_streams.h"
#include "srsran/srsran.h"
#include "srsue/hdr/phy/phy.h"
@ -634,6 +635,22 @@ void phy::set_earfcn(std::vector<uint32_t> earfcns)
bool phy::set_config(const srsran::phy_cfg_nr_t& cfg)
{
// Derive actual RF frequencies for NR carrier
double abs_freq_point_a_freq = srsran::srsran_band_helper().nr_arfcn_to_freq(cfg.carrier.absolute_frequency_point_a);
// for FR1 unit of resources blocks for freq calc is always 180kHz regardless for actual SCS of carrier
// TODO: add offset_to_carrier
double carrier_center_freq =
abs_freq_point_a_freq +
(cfg.carrier.nof_prb / 2 * SRSRAN_SUBC_SPACING_NR(srsran_subcarrier_spacing_t::srsran_subcarrier_spacing_15kHz) *
SRSRAN_NRE);
for (uint32_t i = 0; i < common.args->nof_nr_carriers; i++) {
logger_phy.info("Tuning channel %d to %.2f GHz", i + common.args->nof_lte_carriers, carrier_center_freq / 1e6);
radio->set_rx_freq(i + common.args->nof_lte_carriers, carrier_center_freq);
radio->set_tx_freq(i + common.args->nof_lte_carriers, carrier_center_freq);
}
return nr_workers.set_config(cfg);
}

View File

@ -861,11 +861,6 @@ bool sync::set_frequency()
radio_h->set_rx_freq(0, set_dl_freq);
radio_h->set_tx_freq(0, set_ul_freq);
for (uint32_t i = 0; i < worker_com->args->nof_nr_carriers; i++) {
radio_h->set_rx_freq(i + worker_com->args->nof_lte_carriers, worker_com->args->nr_freq_hz);
radio_h->set_tx_freq(i + worker_com->args->nof_lte_carriers, worker_com->args->nr_freq_hz);
}
ul_dl_factor = (float)(set_ul_freq / set_dl_freq);
srsran_ue_sync_reset(&ue_sync);

View File

@ -12,7 +12,6 @@
#include "srsue/hdr/ue.h"
#include "srsran/build_info.h"
#include "srsran/common/band_helper.h"
#include "srsran/common/string_helpers.h"
#include "srsran/radio/radio.h"
#include "srsran/radio/radio_null.h"
@ -251,8 +250,6 @@ int ue::parse_args(const all_args_t& args_)
}
}
srsran_band_helper bands_helper;
// populate NR DL ARFCNs
if (args.phy.nof_nr_carriers > 0) {
if (not args.stack.rrc_nr.supported_bands_nr_str.empty()) {