From 84a60da1468916c30abd24d259fb99ea5492dad2 Mon Sep 17 00:00:00 2001 From: Francisco Date: Tue, 16 Nov 2021 15:23:17 +0000 Subject: [PATCH] nr,gnb,rrc: fix sib1 offsetToPointA derivation --- srsgnb/src/stack/rrc/cell_asn1_config.cc | 11 +++++++---- srsgnb/src/stack/rrc/test/rrc_nr_test.cc | 7 ++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/srsgnb/src/stack/rrc/cell_asn1_config.cc b/srsgnb/src/stack/rrc/cell_asn1_config.cc index b6e47412f..d0362f2e6 100644 --- a/srsgnb/src/stack/rrc/cell_asn1_config.cc +++ b/srsgnb/src/stack/rrc/cell_asn1_config.cc @@ -959,14 +959,17 @@ void fill_init_dl_bwp(const rrc_cell_cfg_nr_t& cell_cfg, bwp_dl_common_s& cfg) void fill_dl_cfg_common_sib(const rrc_cell_cfg_nr_t& cell_cfg, dl_cfg_common_sib_s& cfg) { + uint32_t scs_hz = SRSRAN_SUBC_SPACING_NR(cell_cfg.phy_cell.carrier.scs); + uint32_t prb_bw = scs_hz * SRSRAN_NRE; + srsran::srsran_band_helper band_helper; cfg.freq_info_dl.freq_band_list.resize(1); cfg.freq_info_dl.freq_band_list[0].freq_band_ind_nr_present = true; cfg.freq_info_dl.freq_band_list[0].freq_band_ind_nr = cell_cfg.band; - uint32_t offset_point_a_hz = - cell_cfg.phy_cell.dl_freq_hz - band_helper.nr_arfcn_to_freq(cell_cfg.dl_absolute_freq_point_a); - uint32_t offset_point_a_rbs = offset_point_a_hz / SRSRAN_SUBC_SPACING_NR(cell_cfg.phy_cell.carrier.scs) / SRSRAN_NRE; - cfg.freq_info_dl.offset_to_point_a = offset_point_a_rbs; + double ssb_freq_start = cell_cfg.ssb_cfg.ssb_freq_hz - SRSRAN_SSB_BW_SUBC * scs_hz / 2; + double offset_point_a_hz = ssb_freq_start - band_helper.nr_arfcn_to_freq(cell_cfg.dl_absolute_freq_point_a); + uint32_t offset_point_a_prbs = offset_point_a_hz / prb_bw; + cfg.freq_info_dl.offset_to_point_a = offset_point_a_prbs; cfg.freq_info_dl.scs_specific_carrier_list.resize(1); cfg.freq_info_dl.scs_specific_carrier_list[0].offset_to_carrier = 0; cfg.freq_info_dl.scs_specific_carrier_list[0].subcarrier_spacing = diff --git a/srsgnb/src/stack/rrc/test/rrc_nr_test.cc b/srsgnb/src/stack/rrc/test/rrc_nr_test.cc index 7e4a05f93..8500996c2 100644 --- a/srsgnb/src/stack/rrc/test/rrc_nr_test.cc +++ b/srsgnb/src/stack/rrc/test/rrc_nr_test.cc @@ -56,8 +56,9 @@ void test_sib_generation() rrc_nr_cfg_t rrc_cfg_nr = {}; rrc_cfg_nr.cell_list.emplace_back(); rrc_cfg_nr.cell_list[0].phy_cell.carrier.pci = 500; - rrc_cfg_nr.cell_list[0].dl_arfcn = 634240; - rrc_cfg_nr.cell_list[0].band = 78; + rrc_cfg_nr.cell_list[0].dl_arfcn = 368500; + rrc_cfg_nr.cell_list[0].band = 3; + rrc_cfg_nr.cell_list[0].duplex_mode = SRSRAN_DUPLEX_MODE_FDD; rrc_cfg_nr.is_standalone = true; args.enb.n_prb = 50; enb_conf_sections::set_derived_args_nr(&args, &rrc_cfg_nr, &phy_cfg); @@ -179,8 +180,8 @@ int main(int argc, char** argv) } argparse::parse_args(argc, argv); - srsenb::test_sib_generation(); TESTASSERT(srsenb::test_rrc_setup() == SRSRAN_SUCCESS); + srsenb::test_sib_generation(); srsenb::test_rrc_sa_connection(); return SRSRAN_SUCCESS;