diff --git a/openair1/PHY/LTE_ESTIMATION/lte_est_freq_offset.c b/openair1/PHY/LTE_ESTIMATION/lte_est_freq_offset.c index 6ebd8948cf7108ddfd09791c19361d119107b22f..d713cc01635a2e8a68c7c599ef450d9b8ab38bed 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_est_freq_offset.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_est_freq_offset.c @@ -102,7 +102,7 @@ int lte_est_freq_offset(int **dl_ch_estimates, { int ch_offset, omega, dl_ch_shift; - struct complex16 *omega_cpx; + struct complex16 omega_cpx; double phase_offset; int freq_offset_est; unsigned char aa; @@ -142,9 +142,8 @@ int lte_est_freq_offset(int **dl_ch_estimates, // printf("Computing freq_offset\n"); omega = dot_product(dl_ch,dl_ch_prev,(frame_parms->N_RB_DL/2 - 1)*12,dl_ch_shift); //omega = dot_product(dl_ch,dl_ch_prev,frame_parms->ofdm_symbol_size,15); - omega_cpx = (struct complex16*) ω - - // printf("omega (%d,%d)\n",omega_cpx->r,omega_cpx->i); + omega_cpx.r = ((struct complex16*) &omega)->r; + omega_cpx.i = ((struct complex16*) &omega)->i; dl_ch = (int16_t *)&dl_ch_estimates[aa][(((frame_parms->N_RB_DL/2) + 1)*12) + ch_offset]; @@ -155,10 +154,12 @@ int lte_est_freq_offset(int **dl_ch_estimates, // calculate omega = angle(conj(dl_ch)*dl_ch_prev)) omega = dot_product(dl_ch,dl_ch_prev,((frame_parms->N_RB_DL/2) - 1)*12,dl_ch_shift); - omega_cpx->r += ((struct complex16*) &omega)->r; - omega_cpx->i += ((struct complex16*) &omega)->i; + + omega_cpx.r += ((struct complex16*) &omega)->r; + omega_cpx.i += ((struct complex16*) &omega)->i; + // phase_offset += atan2((double)omega_cpx->i,(double)omega_cpx->r); - phase_offset += atan2((double)omega_cpx->i,(double)omega_cpx->r); + phase_offset += atan2((double)omega_cpx.i,(double)omega_cpx.r); // LOG_I(PHY,"omega (%d,%d) -> %f\n",omega_cpx->r,omega_cpx->i,phase_offset); } diff --git a/openair1/PHY/LTE_TRANSPORT/initial_sync.c b/openair1/PHY/LTE_TRANSPORT/initial_sync.c index 661fe96be86a0add8a1488736f40d351d88bb704..91374078c0ebc9fea19b8060bb2df66830bb2daf 100644 --- a/openair1/PHY/LTE_TRANSPORT/initial_sync.c +++ b/openair1/PHY/LTE_TRANSPORT/initial_sync.c @@ -462,6 +462,13 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) } } + /* Consider this is a false detection if the offset is > 1000 Hz */ + if( (abs(ue->common_vars.freq_offset) > 1000) && (ret == 0) ) + { + ret=-1; + LOG_E(HW,"Ignore MIB with high freq offset [%d Hz] estimation \n",ue->common_vars.freq_offset); + } + if (ret==0) { // PBCH found so indicate sync to higher layers and configure frame parameters //#ifdef DEBUG_INITIAL_SYNCH