diff --git a/srsue/src/phy/phch_recv.cc b/srsue/src/phy/phch_recv.cc index ca6a35772..be483b0e4 100644 --- a/srsue/src/phy/phch_recv.cc +++ b/srsue/src/phy/phch_recv.cc @@ -717,8 +717,10 @@ void phch_recv::in_sync() { // Out of sync called by worker or phch_recv every 1 or 5 ms void phch_recv::out_of_sync() { // Send RRC out-of-sync signal after 200 ms consecutive subframes + Info("Out-of-sync %d/%d\n", out_of_sync_cnt, NOF_OUT_OF_SYNC_SF); out_of_sync_cnt++; if (out_of_sync_cnt >= NOF_OUT_OF_SYNC_SF) { + Info("Sending to RRC\n"); rrc->out_of_sync(); out_of_sync_cnt = 0; in_sync_cnt = 0; diff --git a/srsue/src/upper/rrc.cc b/srsue/src/upper/rrc.cc index 935d24435..a08297da6 100644 --- a/srsue/src/upper/rrc.cc +++ b/srsue/src/upper/rrc.cc @@ -452,8 +452,12 @@ void rrc::plmn_select_rrc(LIBLTE_RRC_PLMN_IDENTITY_STRUCT plmn_id) { selected_plmn_id = plmn_id; if (serving_cell->plmn_equals(selected_plmn_id) && serving_cell->in_sync) { - rrc_log->info("PLMN Id=%s selected, Selecting serving cell earfcn=%d, pci=%d\n", - plmn_id_to_string(plmn_id).c_str(), serving_cell->get_earfcn(), serving_cell->phy_cell.id); + rrc_log->info("PLMN Id=%s selected, Selecting serving cell earfcn=%d, pci=%d, status=%d\n", + plmn_id_to_string(plmn_id).c_str(), serving_cell->get_earfcn(), serving_cell->phy_cell.id, + phy->sync_status()); + if (!phy->sync_status()) { + phy->cell_select(serving_cell->get_earfcn(), serving_cell->phy_cell); + } } else { bool found = false; for (uint32_t i=0;iinfo("Received out-of-sync state %s. n310=%d, t311=%s, t310=%s\n", + rrc_state_text[state], n310_cnt, + mac_timers->timer_get(t311)->is_running()?"running":"stop", + mac_timers->timer_get(t310)->is_running()?"running":"stop"); if (state == RRC_STATE_CONNECTED) { if (!mac_timers->timer_get(t311)->is_running() && !mac_timers->timer_get(t310)->is_running()) { n310_cnt++; @@ -1168,14 +1176,15 @@ bool rrc::ho_prepare() { mac->set_ho_rnti(mob_reconf.mob_ctrl_info.new_ue_id, mob_reconf.mob_ctrl_info.target_pci); apply_rr_config_common_dl(&mob_reconf.mob_ctrl_info.rr_cnfg_common); - ho_target_pci = neighbour_cells[target_cell_idx]->phy_cell.id; - ho_syncing = true; - rrc_log->info("Selecting new cell pci=%d\n", neighbour_cells[target_cell_idx]->get_pci()); if (!phy->cell_handover(neighbour_cells[target_cell_idx]->phy_cell)) { - rrc_log->error("Could not synchronize with target cell pci=%d\n", neighbour_cells[target_cell_idx]->get_pci()); + rrc_log->error("Could not synchronize with target cell pci=%d. Trying to return to source PCI\n", + neighbour_cells[target_cell_idx]->get_pci()); + ho_failed(); return false; } + ho_target_pci = neighbour_cells[target_cell_idx]->phy_cell.id; + ho_syncing = true; } return true; }