Commit cd8122d2 authored by Thomas Schlichter's avatar Thomas Schlichter

NR_UE: fix frequency offset estimation/compensation if SSB is in the second captured frame

parent f73fcd94
...@@ -251,17 +251,19 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, ...@@ -251,17 +251,19 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
/* process pss search on received buffer */ /* process pss search on received buffer */
sync_pos = pss_synchro_nr(ue, is, NO_RATE_CHANGE); sync_pos = pss_synchro_nr(ue, is, NO_RATE_CHANGE);
if (sync_pos < fp->nb_prefix_samples)
continue;
if (sync_pos >= fp->nb_prefix_samples)
ue->ssb_offset = sync_pos - fp->nb_prefix_samples; ue->ssb_offset = sync_pos - fp->nb_prefix_samples;
else
ue->ssb_offset = sync_pos + fp->samples_per_frame - fp->nb_prefix_samples;
#ifdef DEBUG_INITIAL_SYNCH #ifdef DEBUG_INITIAL_SYNCH
LOG_I(PHY,"[UE%d] Initial sync : Estimated PSS position %d, Nid2 %d\n", ue->Mod_id, sync_pos,ue->common_vars.eNb_id); LOG_I(PHY,"[UE%d] Initial sync : Estimated PSS position %d, Nid2 %d\n", ue->Mod_id, sync_pos,ue->common_vars.eNb_id);
LOG_I(PHY,"sync_pos %d ssb_offset %d \n",sync_pos,ue->ssb_offset); LOG_I(PHY,"sync_pos %d ssb_offset %d \n",sync_pos,ue->ssb_offset);
#endif #endif
/* check that SSS/PBCH block is continuous inside the received buffer */
if (ue->ssb_offset + NR_N_SYMBOLS_SSB * (fp->ofdm_symbol_size + fp->nb_prefix_samples) < fp->samples_per_frame) {
// digital compensation of FFO for SSB symbols // digital compensation of FFO for SSB symbols
if (ue->UE_fo_compensation){ if (ue->UE_fo_compensation){
double s_time = 1/(1.0e3*fp->samples_per_subframe); // sampling time double s_time = 1/(1.0e3*fp->samples_per_subframe); // sampling time
...@@ -271,10 +273,10 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, ...@@ -271,10 +273,10 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
// and we do not know yet in which slot it goes. // and we do not know yet in which slot it goes.
// start for offset correction // start for offset correction
int start = sa ? is*fp->samples_per_frame : is*fp->samples_per_frame + ue->ssb_offset; int start = is*fp->samples_per_frame;
// loop over samples // loop over samples
int end = sa ? n_frames*fp->samples_per_frame : start + NR_N_SYMBOLS_SSB*(fp->ofdm_symbol_size + fp->nb_prefix_samples); int end = start + fp->samples_per_frame;
for(int n=start; n<end; n++){ for(int n=start; n<end; n++){
for (int ar=0; ar<fp->nb_antennas_rx; ar++) { for (int ar=0; ar<fp->nb_antennas_rx; ar++) {
...@@ -286,9 +288,6 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, ...@@ -286,9 +288,6 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
} }
} }
/* check that SSS/PBCH block is continuous inside the received buffer */
if (is*fp->samples_per_frame + ue->ssb_offset + NR_N_SYMBOLS_SSB * (fp->ofdm_symbol_size + fp->nb_prefix_samples) < n_frames*fp->samples_per_frame) {
/* slop_fep function works for lte and takes into account begining of frame with prefix for subframe 0 */ /* slop_fep function works for lte and takes into account begining of frame with prefix for subframe 0 */
/* for NR this is not the case but slot_fep is still used for computing FFT of samples */ /* for NR this is not the case but slot_fep is still used for computing FFT of samples */
/* in order to achieve correct processing for NR prefix samples is forced to 0 and then restored after function call */ /* in order to achieve correct processing for NR prefix samples is forced to 0 and then restored after function call */
...@@ -322,10 +321,10 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, ...@@ -322,10 +321,10 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
// and we do not know yet in which slot it goes. // and we do not know yet in which slot it goes.
// start for offset correction // start for offset correction
int start = sa ? is*fp->samples_per_frame : is*fp->samples_per_frame + ue->ssb_offset; int start = is*fp->samples_per_frame;
// loop over samples // loop over samples
int end = sa ? n_frames*fp->samples_per_frame-1 : start + NR_N_SYMBOLS_SSB*(fp->ofdm_symbol_size + fp->nb_prefix_samples); int end = start + fp->samples_per_frame;
for(int n=start; n<end; n++){ for(int n=start; n<end; n++){
for (int ar=0; ar<fp->nb_antennas_rx; ar++) { for (int ar=0; ar<fp->nb_antennas_rx; ar++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment