From 9d4fd1c5ccba81ff850cfb907c38d597bb6cf0f6 Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Thu, 7 Oct 2021 11:23:17 +0200 Subject: [PATCH] Add NR SFN from SSB assertion and fix dummy SSB scheduling --- srsue/src/phy/nr/cc_worker.cc | 6 +++++- test/phy/dummy_gnb_stack.h | 12 +++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/srsue/src/phy/nr/cc_worker.cc b/srsue/src/phy/nr/cc_worker.cc index c55eb834a..ec887cceb 100644 --- a/srsue/src/phy/nr/cc_worker.cc +++ b/srsue/src/phy/nr/cc_worker.cc @@ -388,7 +388,11 @@ bool cc_worker::measure_csi() } // Check if the SFN matches - // ... + if (mib.sfn != dl_slot_cfg.idx / SRSRAN_NSLOTS_PER_FRAME_NR(phy.cfg.carrier.scs)) { + logger.error("PBCH-MIB: NR SFN (%d) does not match current SFN (%d)", + mib.sfn, + dl_slot_cfg.idx / SRSRAN_NSLOTS_PER_FRAME_NR(phy.cfg.carrier.scs)); + } // Log MIB information if (logger.debug.enabled()) { diff --git a/test/phy/dummy_gnb_stack.h b/test/phy/dummy_gnb_stack.h index 15b841d0b..5e2fab7e5 100644 --- a/test/phy/dummy_gnb_stack.h +++ b/test/phy/dummy_gnb_stack.h @@ -515,8 +515,18 @@ public: // Schedule SSB for (uint32_t ssb_idx = 0; ssb_idx < SRSRAN_SSB_NOF_CANDIDATES; ssb_idx++) { if (phy_cfg.ssb.position_in_burst[ssb_idx]) { + srsran_mib_nr_t mib = {}; + mib.ssb_idx = ssb_idx; + mib.sfn = slot_cfg.idx / SRSRAN_NSLOTS_PER_FRAME_NR(phy_cfg.carrier.scs); + mib.hrf = (slot_cfg.idx % SRSRAN_NSLOTS_PER_FRAME_NR(phy_cfg.carrier.scs)) >= + SRSRAN_NSLOTS_PER_FRAME_NR(phy_cfg.carrier.scs) / 2; + mac_interface_phy_nr::ssb_t ssb = {}; - ssb.pbch_msg.ssb_idx = (uint32_t)ssb_idx; + if (srsran_pbch_msg_nr_mib_pack(&mib, &ssb.pbch_msg) < SRSRAN_SUCCESS) { + logger.error("Error Packing MIB in slot %d", slot_cfg.idx); + continue; + } + ssb.pbch_msg.ssb_idx = (uint32_t)ssb_idx; dl_sched.ssb.push_back(ssb); } }