diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 76c4534384..e3fb68020b 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -464,14 +464,16 @@ int computeSamplesShift(PHY_VARS_NR_UE *UE) { if ( UE->rx_offset < UE->frame_parms.samples_per_frame/2 && UE->rx_offset > 0 ) { //LOG_I(PHY,"!!!adjusting -1 samples!!!\n"); - UE->rx_offset = 0; // reset so that it is not applied falsely in case of SSB being only in every second frame + UE->rx_offset = 0; // reset so that it is not applied falsely in case of SSB being only in every second frame + UE->max_pos_fil = 0; // reset IIR filter when sample shift is applied return -1 ; } if ( UE->rx_offset > UE->frame_parms.samples_per_frame/2 && UE->rx_offset < UE->frame_parms.samples_per_frame ) { //LOG_I(PHY,"!!!adjusting +1 samples!!!\n"); - UE->rx_offset = 0; // reset so that it is not applied falsely in case of SSB being only in every second frame + UE->rx_offset = 0; // reset so that it is not applied falsely in case of SSB being only in every second frame + UE->max_pos_fil = 0; // reset IIR filter when sample shift is applied return 1; } diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c b/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c index e89280058a..19d4bf5079 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c @@ -42,7 +42,6 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms, short coef) { - static int max_pos_fil = 0; static int count_max_pos_ok = 0; static int first_time = 1; int max_val = 0, max_pos = 0; @@ -74,14 +73,14 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms, // filter position to reduce jitter if (clear == 1) - max_pos_fil = max_pos; + ue->max_pos_fil = max_pos; else - max_pos_fil = ((max_pos_fil * coef) + (max_pos * ncoef)) >> 15; + ue->max_pos_fil = ((ue->max_pos_fil * coef) + (max_pos * ncoef)) >> 15; // do not filter to have proactive timing adjustment - //max_pos_fil = max_pos; + //ue->max_pos_fil = max_pos; - int diff = max_pos_fil - sync_pos; + int diff = ue->max_pos_fil - sync_pos; if (frame_parms->freq_range==nr_FR2) sync_offset = 2; @@ -129,7 +128,7 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms, ue->rx_offset, clear, max_pos, - max_pos_fil, + ue->max_pos_fil, max_val, sync_pos); #endif //DEBUG_PHY diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 8ce18aa667..2290e9ede4 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -921,9 +921,10 @@ typedef struct { uint8_t init_sync_frame; /// temporary offset during cell search prior to MIB decoding int ssb_offset; - uint16_t symbol_offset; // offset in terms of symbols for detected ssb in sync - int rx_offset; /// Timing offset + uint16_t symbol_offset; /// offset in terms of symbols for detected ssb in sync + int rx_offset; /// Timing offset int rx_offset_diff; /// Timing adjustment for ofdm symbol0 on HW USRP + int max_pos_fil; /// Timing offset IIR filter int time_sync_cell; /// Timing Advance updates variables