diff --git a/srsue/hdr/stack/rrc_nr/rrc_nr.h b/srsue/hdr/stack/rrc_nr/rrc_nr.h index c9d8e9655..8696b87fa 100644 --- a/srsue/hdr/stack/rrc_nr/rrc_nr.h +++ b/srsue/hdr/stack/rrc_nr/rrc_nr.h @@ -197,8 +197,10 @@ private: // Stores the state of the PHY configuration setting enum { PHY_CFG_STATE_NONE = 0, - PHY_CFG_STATE_APPLY_SP_CELL, - PHY_CFG_STATE_RA_COMPLETED, + PHY_CFG_STATE_SA_SIB_CFG, + PHY_CFG_STATE_SA_FULL_CFG, + PHY_CFG_STATE_NSA_APPLY_SP_CELL, + PHY_CFG_STATE_NSA_RA_COMPLETED, } phy_cfg_state; rrc_nr_args_t args = {}; diff --git a/srsue/src/stack/rrc_nr/rrc_nr.cc b/srsue/src/stack/rrc_nr/rrc_nr.cc index fc788a206..7bb35d5f4 100644 --- a/srsue/src/stack/rrc_nr/rrc_nr.cc +++ b/srsue/src/stack/rrc_nr/rrc_nr.cc @@ -472,6 +472,7 @@ void rrc_nr::handle_sib1(const sib1_s& sib1) // Apply SSB Config fill_phy_ssb_cfg(sib1.serving_cell_cfg_common, &phy_cfg.ssb); + phy_cfg_state = PHY_CFG_STATE_SA_SIB_CFG; if (not phy->set_config(phy_cfg)) { logger.warning("Could not set phy config."); return; @@ -582,7 +583,10 @@ void rrc_nr::send_ul_ccch_msg(const asn1::rrc_nr::ul_ccch_msg_s& msg) } asn1::bit_ref bref(pdu->msg, pdu->get_tailroom()); - msg.pack(bref); + if (msg.pack(bref) != SRSASN_SUCCESS) { + logger.error("Coulnd't pack UL-CCCH message."); + return; + } bref.align_bytes_zero(); pdu->N_bytes = (uint32_t)bref.distance_bytes(pdu->msg); pdu->set_timestamp(); @@ -1589,8 +1593,6 @@ bool rrc_nr::apply_sp_cell_cfg(const sp_cell_cfg_s& sp_cell_cfg) { update_sp_cell_cfg(sp_cell_cfg); - phy_cfg_state = PHY_CFG_STATE_APPLY_SP_CELL; - return true; } @@ -1768,9 +1770,11 @@ bool rrc_nr::update_sp_cell_cfg(const sp_cell_cfg_s& sp_cell_cfg) // defer CSI config until after RA complete srsran::phy_cfg_nr_t current_phycfg = phy_cfg; current_phycfg.csi = prev_csi; + phy_cfg_state = PHY_CFG_STATE_NSA_APPLY_SP_CELL; phy->set_config(current_phycfg); } else { // apply full config immediately + phy_cfg_state = PHY_CFG_STATE_SA_FULL_CFG; phy->set_config(phy_cfg); } @@ -1793,8 +1797,6 @@ bool rrc_nr::apply_cell_group_cfg(const cell_group_cfg_s& cell_group_cfg) { update_cell_group_cfg(cell_group_cfg); - phy_cfg_state = PHY_CFG_STATE_APPLY_SP_CELL; - return true; } @@ -2102,8 +2104,8 @@ void rrc_nr::ra_completed() logger.info("RA completed."); if (rrc_eutra) { logger.debug("Applying remaining CSI configuration."); + phy_cfg_state = PHY_CFG_STATE_NSA_RA_COMPLETED; phy->set_config(phy_cfg); - phy_cfg_state = PHY_CFG_STATE_RA_COMPLETED; } else { phy_cfg_state = PHY_CFG_STATE_NONE; } @@ -2146,12 +2148,18 @@ void rrc_nr::set_phy_config_complete(bool status) case PHY_CFG_STATE_NONE: logger.warning("PHY configuration completed without a clear state."); break; - case PHY_CFG_STATE_APPLY_SP_CELL: + case PHY_CFG_STATE_SA_SIB_CFG: + logger.info("PHY configuration with SIB parameters completed."); + break; + case PHY_CFG_STATE_SA_FULL_CFG: + logger.info("PHY configuration completed."); + break; + case PHY_CFG_STATE_NSA_APPLY_SP_CELL: // Start RA procedure logger.info("PHY configuration completed. Starting RA procedure."); mac->start_ra_procedure(); break; - case PHY_CFG_STATE_RA_COMPLETED: + case PHY_CFG_STATE_NSA_RA_COMPLETED: logger.info("Remaining CSI configuration completed."); break; } diff --git a/srsue/src/stack/rrc_nr/rrc_nr_procedures.cc b/srsue/src/stack/rrc_nr/rrc_nr_procedures.cc index 864eb5fe0..8b90b007f 100644 --- a/srsue/src/stack/rrc_nr/rrc_nr_procedures.cc +++ b/srsue/src/stack/rrc_nr/rrc_nr_procedures.cc @@ -220,9 +220,6 @@ proc_outcome_t rrc_nr::setup_request_proc::step() if (state == state_t::config_serving_cell) { // TODO: start serving cell config and start T300 - rrc_handle.phy_cfg_state = PHY_CFG_STATE_APPLY_SP_CELL; - rrc_handle.phy->set_config(rrc_handle.phy_cfg); - // start T300 rrc_handle.t300.run();