diff --git a/openair1/PHY/NR_REFSIG/pss_nr.h b/openair1/PHY/NR_REFSIG/pss_nr.h index b5bc62d63e..cf705a7ee6 100644 --- a/openair1/PHY/NR_REFSIG/pss_nr.h +++ b/openair1/PHY/NR_REFSIG/pss_nr.h @@ -83,7 +83,9 @@ int pss_synchro_nr(const c16_t **rxdata, bool fo_flag, int target_Nid_cell, int *nid2, - int *f_off); + int *f_off, + int *pssPeak, + int *pssAvg); void generate_pss_nr_time(const NR_DL_FRAME_PARMS *fp, const int N_ID_2, int ssbFirstSCS, c16_t pssTime[fp->ofdm_symbol_size]); int16_t *get_primary_synchro_nr2(const int nid2); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c index 40cc29d52a..353db588d6 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c @@ -213,7 +213,9 @@ void nr_scan_ssb(void *arg) ssbInfo->foFlag, ssbInfo->targetNidCell, &nid2, - &freq_offset_pss); + &freq_offset_pss, + &ssbInfo->pssCorrPeakPower, + &ssbInfo->pssCorrAvgPower); if (sync_pos < fp->nb_prefix_samples) continue; @@ -225,7 +227,7 @@ void nr_scan_ssb(void *arg) #endif /* check that SSS/PBCH block is continuous inside the received buffer */ if (ssbInfo->ssbOffset + NR_N_SYMBOLS_SSB * (fp->ofdm_symbol_size + fp->nb_prefix_samples) >= fp->samples_per_frame) { - LOG_I(PHY, "Can't try to decode SSS from PSS position, will retry (PSS circular buffer wrapping): sync_pos %d\n", sync_pos); + LOG_D(PHY, "Can't try to decode SSS from PSS position, will retry (PSS circular buffer wrapping): sync_pos %d\n", sync_pos); continue; } @@ -337,10 +339,12 @@ nr_initial_sync_t nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, i nr_ue_ssb_scan_t *ssbInfo = (nr_ue_ssb_scan_t *)NotifiedFifoData(req); if (ssbInfo->syncRes.cell_detected) { LOG_A(NR_PHY, - "Cell Detected with GSCN: %d, SSB SC offset: %d, SSB Ref: %lf\n", + "Cell Detected with GSCN: %d, SSB SC offset: %d, SSB Ref: %lf, PSS Corr peak: %d dB, PSS Corr Average: %d\n", ssbInfo->gscnInfo.gscn, ssbInfo->gscnInfo.ssbFirstSC, - ssbInfo->gscnInfo.ssRef); + ssbInfo->gscnInfo.ssRef, + ssbInfo->pssCorrPeakPower, + ssbInfo->pssCorrAvgPower); if (!res.syncRes.cell_detected) { // take the first cell detected res = *ssbInfo; } diff --git a/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c b/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c index ae64c53f88..6d9aaf7f9a 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c @@ -57,7 +57,9 @@ static int pss_search_time_nr(const c16_t **rxdata, int is, int target_Nid_cell, int *nid2, - int *f_off); + int *f_off, + int *pssPeak, + int *pssAvg); static int16_t primary_synchro_nr2[NUMBER_PSS_SEQUENCE][LENGTH_PSS_NR] = {0}; static c16_t primary_synchro[NUMBER_PSS_SEQUENCE][LENGTH_PSS_NR] = {0}; @@ -390,7 +392,9 @@ int pss_synchro_nr(const c16_t **rxdata, bool fo_flag, int target_Nid_cell, int *nid2, - int *f_off) + int *f_off, + int *pssPeak, + int *pssAvg) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PSS_SYNCHRO_NR, VCD_FUNCTION_IN); #ifdef DBG_PSS_NR @@ -415,7 +419,8 @@ int pss_synchro_nr(const c16_t **rxdata, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PSS_SEARCH_TIME_NR, VCD_FUNCTION_IN); - int synchro_position = pss_search_time_nr(rxdata, frame_parms, pssTime, fo_flag, is, target_Nid_cell, nid2, f_off); + int synchro_position = + pss_search_time_nr(rxdata, frame_parms, pssTime, fo_flag, is, target_Nid_cell, nid2, f_off, pssPeak, pssAvg); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PSS_SEARCH_TIME_NR, VCD_FUNCTION_OUT); @@ -427,7 +432,7 @@ int pss_synchro_nr(const c16_t **rxdata, #ifndef NR_UNIT_TEST - LOG_I(PHY,"PSS execution duration %4d microseconds \n", duration_ms); + LOG_D(PHY,"PSS execution duration %4d microseconds \n", duration_ms); #endif @@ -511,7 +516,9 @@ static int pss_search_time_nr(const c16_t **rxdata, int is, int target_Nid_cell, int *nid2, - int *f_off) + int *f_off, + int *pssPeak, + int *pssAvg) { unsigned int n, ar, peak_position, pss_source; int64_t peak_value; @@ -620,8 +627,10 @@ static int pss_search_time_nr(const c16_t **rxdata, avg[pss_index] /= (length / 4); *nid2 = pss_source; + *pssPeak = dB_fixed64(peak_value); + *pssAvg = dB_fixed64(avg[pss_source]); - LOG_I(PHY, + LOG_D(PHY, "[UE] nr_synchro_time: Sync source (nid2) = %d, Peak found at pos %d, val = %ld (%d dB power over signal avg %d dB), ffo " "%lf\n", pss_source, diff --git a/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c b/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c index 05fdb33903..0a13462d8c 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c @@ -500,7 +500,7 @@ bool rx_sss_nr(const NR_DL_FRAME_PARMS *frame_parms, int re = 0; int im = 0; if (Nid1 == N_ID_1_NUMBER) { - LOG_W(PHY, + LOG_D(PHY, "Failed to detect SSS after PSS, metric of SSS %d, threshold to consider SSS valid %d, detected PCI: %d\n", *tot_metric, SSS_METRIC_FLOOR_NR, @@ -516,7 +516,7 @@ bool rx_sss_nr(const NR_DL_FRAME_PARMS *frame_parms, *freq_offset_sss = (int)(ffo_sss*frame_parms->subcarrier_spacing); double ffo_pss = ((double)freq_offset_pss) / frame_parms->subcarrier_spacing; - LOG_W(NR_PHY, + LOG_D(NR_PHY, "SSS detected, PCI: %d, ffo_pss %f (%i Hz), ffo_sss %f (%i Hz), ffo_pss+ffo_sss %f (%i Hz), nid1: %d, nid2: %d\n", *Nid_cell, ffo_pss, diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index fa4dc3bfa1..3f40beeccd 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -642,6 +642,8 @@ typedef struct { int freqOffset; nr_initial_sync_t syncRes; fapiPbch_t pbchResult; + int pssCorrPeakPower; + int pssCorrAvgPower; } nr_ue_ssb_scan_t; typedef struct nr_phy_data_tx_s {