From 2feed73050d8a00252fac399b9c2739ba6f7dfb6 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Thu, 4 Apr 2019 18:36:31 +0200 Subject: [PATCH] fixing counter of trashed frames for two frames synchronization --- executables/nr-ue.c | 4 ++++ openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c | 5 ++++- openair1/PHY/defs_nr_UE.h | 4 +++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index bca68ed37d..c8ed8d45cf 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -592,6 +592,10 @@ void *UE_thread(void *arg) { // and we shifted above to the first slot of next frame // the synch thread proc context is hard linked to regular processing thread context, thread id = 0 UE_nr_rxtx_proc_t *proc=&(((processingData_t *)NotifiedFifoData(processingMsg[0]))->proc); + // synchronization is on two frame basis + // if it succeeds on the first frame the second one needs to be considered as trashed + if(!UE->is_synchronized_on_frame) + trashed_frames++; // shift the frame index with all the frames we trashed meanwhile we perform the synch search proc->decoded_frame_rx=(proc->decoded_frame_rx + trashed_frames) % MAX_FRAME_NUMBER; decoded_frame_rx=proc->decoded_frame_rx; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c index 78dbe83b80..4ba7c67339 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c @@ -208,6 +208,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, runmode_t mode) int32_t metric_tdd_ncp=0; uint8_t phase_tdd_ncp; double im, re; + int is; NR_DL_FRAME_PARMS *fp = &ue->frame_parms; int ret=-1; @@ -242,7 +243,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, runmode_t mode) cnt =0; // initial sync performed on two successive frames, if pbch passes on first frame, no need to process second frame - for(int is=0; is<2;is++) { + for(is=0; is<2;is++) { /* process pss search on received buffer */ sync_pos = pss_synchro_nr(ue, is, NO_RATE_CHANGE); @@ -372,6 +373,8 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, runmode_t mode) #endif //#endif + ue->is_synchronized_on_frame = is; // to notify on which of the two frames sync was successful + if (ue->UE_scan_carrier == 0) { #if UE_AUTOTEST_TRACE diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 9270a96d95..213ce98924 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -878,8 +878,10 @@ typedef struct { int UE_scan_carrier; /// \brief Indicator that UE should enable estimation and compensation of frequency offset int UE_fo_compensation; - /// \brief Indicator that UE is synchronized to an eNB + /// \brief Indicator that UE is synchronized to a gNB int is_synchronized; + /// \brief Indicates on which frame is synchronized in a two frame synchronization + int is_synchronized_on_frame; /// Data structure for UE process scheduling UE_nr_proc_t proc; /// Flag to indicate the UE shouldn't do timing correction at all