From c88774a3f4e4ca70a1dc895cdcf044b69c11abd8 Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Tue, 11 Jan 2022 19:48:21 +0100 Subject: [PATCH] Fix UE SYNC NR CFO feedback and periodicity --- lib/src/phy/ue/ue_sync_nr.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/src/phy/ue/ue_sync_nr.c b/lib/src/phy/ue/ue_sync_nr.c index 22520e55a..c0a66b433 100644 --- a/lib/src/phy/ue/ue_sync_nr.c +++ b/lib/src/phy/ue/ue_sync_nr.c @@ -167,8 +167,11 @@ static int ue_sync_nr_run_track(srsran_ue_sync_nr_t* q, cf_t* buffer) // Check if the SSB selected candidate index shall be received in this subframe bool is_ssb_opportunity = (q->sf_idx == srsran_ssb_candidate_sf_idx(&q->ssb, q->ssb_idx, half_frame > 0)); - // TODO: it assumes SSB opportunity is every 10 ms, use real SSB SF candidate - is_ssb_opportunity = (q->sf_idx % SRSRAN_NOF_SF_X_FRAME == 0); + // Use SSB periodicity + if (q->ssb.cfg.periodicity_ms >= 10) { + // SFN match with the periodicity + is_ssb_opportunity = is_ssb_opportunity && (half_frame == 0) && (q->sfn % q->ssb.cfg.periodicity_ms / 10 == 0); + } if (is_ssb_opportunity) { // Measure PSS/SSS and decode PBCH @@ -185,10 +188,10 @@ static int ue_sync_nr_run_track(srsran_ue_sync_nr_t* q, cf_t* buffer) // Otherwise feedback measurements and apply srsran_combine_csi_trs_measurements(&q->feedback, &measurements, &q->feedback); - } - // Apply accumulated feedback - ue_sync_nr_apply_feedback(q); + // Apply accumulated feedback + ue_sync_nr_apply_feedback(q); + } return SRSRAN_SUCCESS; } @@ -240,7 +243,7 @@ static int ue_sync_nr_recv(srsran_ue_sync_nr_t* q, cf_t** buffer, srsran_timesta // Compensate CFO for (uint32_t chan = 0; chan < q->nof_rx_channels; chan++) { if (buffer[chan] != 0 && !q->disable_cfo) { - srsran_vec_apply_cfo(buffer[chan], q->cfo_hz / q->srate_hz, buffer[chan], (int)q->sf_sz); + srsran_vec_apply_cfo(buffer[chan], -q->cfo_hz / q->srate_hz, buffer[chan], (int)q->sf_sz); } }