From 385dcea7ebbd0e668e81de9131023c4d6b1a2851 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Wed, 3 Apr 2019 15:07:45 +0200 Subject: [PATCH] intial sync over two frames (not working, still need to debug) --- executables/nr-ue.c | 8 +- openair1/PHY/INIT/nr_init_ue.c | 5 +- openair1/PHY/MODULATION/slot_fep_nr.c | 19 +-- openair1/PHY/NR_REFSIG/pss_nr.h | 3 +- .../PHY/NR_UE_TRANSPORT/nr_initial_sync.c | 108 +++++++++--------- openair1/PHY/NR_UE_TRANSPORT/pss_nr.c | 65 ++++++----- openair1/PHY/defs_nr_UE.h | 5 + openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 2 +- .../CONF/gnb.band78.tm1.106PRB.usrpn300.conf | 2 +- 9 files changed, 118 insertions(+), 99 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index e22ed52f99..e7c71aede8 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -444,16 +444,16 @@ void UE_processing(void *arg) { #endif } -void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) { +void readFrames(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) { void *rxp[NB_ANTENNAS_RX]; void *dummy_tx[UE->frame_parms.nb_antennas_tx]; for (int i=0; iframe_parms.nb_antennas_tx; i++) dummy_tx[i]=malloc16_clear(UE->frame_parms.samples_per_subframe*4); - for(int x=0; x<10; x++) { + for(int x=0; x<20; x++) { // two frames for initial sync for (int i=0; iframe_parms.nb_antennas_rx; i++) - rxp[i] = ((void *)&UE->common_vars.rxdata[i][0]) + 4*x*UE->frame_parms.samples_per_subframe; + rxp[i] = ((void *)&UE->common_vars.rxdata_is[i][0]) + 4*x*UE->frame_parms.samples_per_subframe; AssertFatal( UE->frame_parms.samples_per_subframe == UE->rfdevice.trx_read_func(&UE->rfdevice, @@ -575,7 +575,7 @@ void *UE_thread(void *arg) { } else trashFrame(UE, ×tamp); } else { - readFrame(UE, ×tamp); + readFrames(UE, ×tamp); pushTpool(Tpool, syncMsg); syncRunning=true; } diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index 3a2ca5a172..226e89e489 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -710,14 +710,15 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, } // init RX buffers - + common_vars->rxdata_is= (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) ); common_vars->rxdata = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) ); for (th_id=0; th_idcommon_vars_rx_data_per_thread[th_id].rxdataF = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) ); } for (i=0; inb_antennas_rx; i++) { - common_vars->rxdata[i] = (int32_t*) malloc16_clear( (fp->samples_per_subframe*10+2048)*sizeof(int32_t) ); + common_vars->rxdata_is[i] = (int32_t*) malloc16_clear( (fp->samples_per_frame*2+2048)*sizeof(int32_t) ); + common_vars->rxdata[i] = (int32_t*) malloc16_clear( (fp->samples_per_frame+2048)*sizeof(int32_t) ); for (th_id=0; th_idcommon_vars_rx_data_per_thread[th_id].rxdataF[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(fp->ofdm_symbol_size*14) ); } diff --git a/openair1/PHY/MODULATION/slot_fep_nr.c b/openair1/PHY/MODULATION/slot_fep_nr.c index 717633c1f5..86ca29d902 100644 --- a/openair1/PHY/MODULATION/slot_fep_nr.c +++ b/openair1/PHY/MODULATION/slot_fep_nr.c @@ -46,11 +46,14 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, unsigned char aa; unsigned int nb_prefix_samples; unsigned int nb_prefix_samples0; + int **rxdata = NULL; if (ue->is_synchronized) { + rxdata = common_vars->rxdata; nb_prefix_samples = (no_prefix ? 0 : frame_parms->nb_prefix_samples); nb_prefix_samples0 = (no_prefix ? 0 : frame_parms->nb_prefix_samples0); } else { + rxdata = common_vars->rxdata_is; nb_prefix_samples = (no_prefix ? 0 : frame_parms->nb_prefix_samples); nb_prefix_samples0 = (no_prefix ? 0 : frame_parms->nb_prefix_samples); } @@ -148,13 +151,13 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, if (symbol==0) { if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size)) - memcpy((short *)&common_vars->rxdata[aa][frame_length_samples], - (short *)&common_vars->rxdata[aa][0], + memcpy((short*) &(rxdata[aa][frame_length_samples]), + (short*) &(rxdata[aa][0]), frame_parms->ofdm_symbol_size*sizeof(int)); if ((rx_offset&7)!=0) { // if input to dft is not 256-bit aligned, issue for size 6,15 and 25 PRBs memcpy((void *)tmp_dft_in, - (void *)&common_vars->rxdata[aa][rx_offset % frame_length_samples], + (void *) &(rxdata[aa][rx_offset % frame_length_samples]), frame_parms->ofdm_symbol_size*sizeof(int)); dft((int16_t *)tmp_dft_in, (int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1); @@ -163,7 +166,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, start_meas(&ue->rx_dft_stats); #endif - dft((int16_t *)&common_vars->rxdata[aa][(rx_offset) % frame_length_samples], + dft((int16_t *) &(rxdata[aa][(rx_offset) % frame_length_samples]), (int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1); #if UE_TIMING_TRACE stop_meas(&ue->rx_dft_stats); @@ -174,8 +177,8 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, // + (frame_parms->ofdm_symbol_size+nb_prefix_samples)*(l-1); if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size)) - memcpy((void *)&common_vars->rxdata[aa][frame_length_samples], - (void *)&common_vars->rxdata[aa][0], + memcpy((void *) &(rxdata[aa][frame_length_samples]), + (void *) &(rxdata[aa][0]), frame_parms->ofdm_symbol_size*sizeof(int)); #if UE_TIMING_TRACE start_meas(&ue->rx_dft_stats); @@ -183,13 +186,13 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, if ((rx_offset&7)!=0) { // if input to dft is not 128-bit aligned, issue for size 6 and 15 PRBs memcpy((void *)tmp_dft_in, - (void *)&common_vars->rxdata[aa][(rx_offset) % frame_length_samples], + (void *) &(rxdata[aa][(rx_offset) % frame_length_samples]), frame_parms->ofdm_symbol_size*sizeof(int)); dft((int16_t *)tmp_dft_in, (int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1); } else { // use dft input from RX buffer directly - dft((int16_t *)&common_vars->rxdata[aa][(rx_offset) % frame_length_samples], + dft((int16_t *) &(rxdata[aa][(rx_offset) % frame_length_samples]), (int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1); } #if UE_TIMING_TRACE diff --git a/openair1/PHY/NR_REFSIG/pss_nr.h b/openair1/PHY/NR_REFSIG/pss_nr.h index dc20ab24d7..5233acac15 100644 --- a/openair1/PHY/NR_REFSIG/pss_nr.h +++ b/openair1/PHY/NR_REFSIG/pss_nr.h @@ -134,10 +134,11 @@ void free_context_synchro_nr(void); void init_context_pss_nr(NR_DL_FRAME_PARMS *frame_parms_ue); void free_context_pss_nr(void); int set_pss_nr(int ofdm_symbol_size); -int pss_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int rate_change); +int pss_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int is, int rate_change); int pss_search_time_nr(int **rxdata, ///rx data in time domain NR_DL_FRAME_PARMS *frame_parms, int fo_flag, + int corr_samples, int *eNB_id, int *f_off); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c index 40cbb0d23e..e2e837398f 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c @@ -222,10 +222,7 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode) nr_init_frame_parms_ue(fp,NR_MU_1,NORMAL,fp->N_RB_DL,n_ssb_crb,0); LOG_D(PHY,"nr_initial sync ue RB_DL %d\n", fp->N_RB_DL); - /* - write_output("rxdata0.m","rxd0",ue->common_vars.rxdata[0],10*fp->samples_per_subframe,1,1); - exit(-1); - */ + /* Initial synchronisation * @@ -242,26 +239,27 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode) cnt++; if (1){ // (cnt>100) - cnt =0; + cnt =0; - /* process pss search on received buffer */ - sync_pos = pss_synchro_nr(ue, NO_RATE_CHANGE); + // 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++) { + + /* process pss search on received buffer */ + sync_pos = pss_synchro_nr(ue, is, NO_RATE_CHANGE); - if (sync_pos >= fp->nb_prefix_samples) - ue->ssb_offset = sync_pos - fp->nb_prefix_samples; - else - ue->ssb_offset = sync_pos + (fp->samples_per_subframe * 10) - fp->nb_prefix_samples; + if (sync_pos >= fp->nb_prefix_samples) + ue->ssb_offset = sync_pos - fp->nb_prefix_samples; + else + ue->ssb_offset = sync_pos + (fp->samples_per_subframe * 10) - fp->nb_prefix_samples; - //write_output("rxdata1.m","rxd1",ue->common_vars.rxdata[0],10*fp->samples_per_subframe,1,1); - #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,"sync_pos %d ssb_offset %d \n",sync_pos,ue->ssb_offset); + 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); #endif - // digital compensation of FFO for SSB symbols - if (ue->UE_fo_compensation){ + // digital compensation of FFO for SSB symbols + if (ue->UE_fo_compensation){ double s_time = 1/(1.0e3*fp->samples_per_subframe); // sampling time double off_angle = -2*M_PI*s_time*(ue->common_vars.freq_offset); // offset rotation angle compensation per sample @@ -270,17 +268,17 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode) for(int n=start; nnb_antennas_rx; ar++) { - re = ((double)(((short *)ue->common_vars.rxdata[ar]))[2*n]); - im = ((double)(((short *)ue->common_vars.rxdata[ar]))[2*n+1]); - ((short *)ue->common_vars.rxdata[ar])[2*n] = (short)(round(re*cos(n*off_angle) - im*sin(n*off_angle))); - ((short *)ue->common_vars.rxdata[ar])[2*n+1] = (short)(round(re*sin(n*off_angle) + im*cos(n*off_angle))); + re = ((double)(((short *)ue->common_vars.rxdata_is[ar]))[2*n]); + im = ((double)(((short *)ue->common_vars.rxdata_is[ar]))[2*n+1]); + ((short *)ue->common_vars.rxdata_is[ar])[2*n] = (short)(round(re*cos(n*off_angle) - im*sin(n*off_angle))); + ((short *)ue->common_vars.rxdata_is[ar])[2*n+1] = (short)(round(re*sin(n*off_angle) + im*cos(n*off_angle))); } } - } + } - /* check that SSS/PBCH block is continuous inside the received buffer */ - if (sync_pos < (NR_NUMBER_OF_SUBFRAMES_PER_FRAME*fp->samples_per_subframe - (NB_SYMBOLS_PBCH * fp->ofdm_symbol_size))) { + /* check that SSS/PBCH block is continuous inside the received buffer */ + if (sync_pos < (NR_NUMBER_OF_SUBFRAMES_PER_FRAME*fp->samples_per_subframe - (NB_SYMBOLS_PBCH * fp->ofdm_symbol_size))) { /* 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 */ @@ -288,37 +286,37 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode) /* symbol number are from beginning of SS/PBCH blocks as below: */ /* Signal PSS PBCH SSS PBCH */ /* symbol number 0 1 2 3 */ - /* time samples in buffer rxdata are used as input of FFT -> FFT results are stored in the frequency buffer rxdataF */ + /* time samples in buffer rxdata_is are used as input of FFT -> FFT results are stored in the frequency buffer rxdataF */ /* rxdataF stores SS/PBCH from beginning of buffers in the same symbol order as in time domain */ - for(int i=0; i<4;i++) - nr_slot_fep(ue, - i, - 0, - ue->ssb_offset, - 0, - NR_PBCH_EST); + for(int i=0; i<4;i++) + nr_slot_fep(ue, + i, + 0, + ue->ssb_offset, + 0, + NR_PBCH_EST); #ifdef DEBUG_INITIAL_SYNCH - LOG_I(PHY,"Calling sss detection (normal CP)\n"); + LOG_I(PHY,"Calling sss detection (normal CP)\n"); #endif - rx_sss_nr(ue,&metric_tdd_ncp,&phase_tdd_ncp); + rx_sss_nr(ue,&metric_tdd_ncp,&phase_tdd_ncp); - //FK: why do we need to do this again here? - //nr_init_frame_parms_ue(fp,NR_MU_1,NORMAL,n_ssb_crb,0); + //FK: why do we need to do this again here? + //nr_init_frame_parms_ue(fp,NR_MU_1,NORMAL,n_ssb_crb,0); - nr_gold_pbch(ue); - ret = nr_pbch_detection(ue,1,mode); // start pbch detection at first symbol after pss + nr_gold_pbch(ue); + ret = nr_pbch_detection(ue,1,mode); // start pbch detection at first symbol after pss - if (ret == 0) { - // sync at symbol ue->symbol_offset - // computing the offset wrt the beginning of the frame - sync_pos_frame = (fp->ofdm_symbol_size + fp->nb_prefix_samples0)+((ue->symbol_offset)-1)*(fp->ofdm_symbol_size + fp->nb_prefix_samples); - ue->rx_offset = ue->ssb_offset - sync_pos_frame; - } + if (ret == 0) { + // sync at symbol ue->symbol_offset + // computing the offset wrt the beginning of the frame + sync_pos_frame = (fp->ofdm_symbol_size + fp->nb_prefix_samples0)+((ue->symbol_offset)-1)*(fp->ofdm_symbol_size + fp->nb_prefix_samples); + ue->rx_offset = ue->ssb_offset - sync_pos_frame; + } - nr_gold_pdcch(ue,0, 2); + nr_gold_pdcch(ue,0, 2); /* int nb_prefix_samples0 = fp->nb_prefix_samples0; fp->nb_prefix_samples0 = fp->nb_prefix_samples; @@ -334,16 +332,20 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode) ue->common_vars.freq_offset ); */ + #ifdef DEBUG_INITIAL_SYNCH - LOG_I(PHY,"TDD Normal prefix: CellId %d metric %d, phase %d, pbch %d\n", - fp->Nid_cell,metric_tdd_ncp,phase_tdd_ncp,ret); + LOG_I(PHY,"TDD Normal prefix: CellId %d metric %d, phase %d, pbch %d\n", + fp->Nid_cell,metric_tdd_ncp,phase_tdd_ncp,ret); #endif - } - else { + + } + else { #ifdef DEBUG_INITIAL_SYNCH - LOG_I(PHY,"TDD Normal prefix: SSS error condition: sync_pos %d\n", sync_pos); + LOG_I(PHY,"TDD Normal prefix: SSS error condition: sync_pos %d\n", sync_pos); #endif - } + } + if (ret == 0) break; + } } else { ret = -1; @@ -432,13 +434,13 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode) // do a measurement on the best guess of the PSS //for (aarx=0; aarxnb_antennas_rx; aarx++) - // rx_power += signal_energy(&ue->common_vars.rxdata[aarx][sync_pos2], + // rx_power += signal_energy(&ue->common_vars.rxdata_is[aarx][sync_pos2], // frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples); /* // do a measurement on the full frame for (aarx=0; aarxnb_antennas_rx; aarx++) - rx_power += signal_energy(&ue->common_vars.rxdata[aarx][0], + rx_power += signal_energy(&ue->common_vars.rxdata_is[aarx][0], frame_parms->samples_per_subframe*10); */ diff --git a/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c b/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c index 40945bebef..1e43a26be6 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c @@ -608,10 +608,14 @@ void restore_frame_context_pss_nr(NR_DL_FRAME_PARMS *frame_parms_ue, int rate_ch * ********************************************************************/ -void decimation_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int rate_change, int **rxdata) +void decimation_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int rate_change, int is, int **rxdata) { + int samples_for_frame; NR_DL_FRAME_PARMS *frame_parms = &(PHY_vars_UE->frame_parms); - int samples_for_frame = NR_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti; + if (is==0) + samples_for_frame = frame_parms->samples_per_frame + frame_parms->ofdm_symbol_size; + else + samples_for_frame = frame_parms->samples_per_frame; AssertFatal(frame_parms->samples_per_tti > 3839,"Illegal samples_per_tti %d\n",frame_parms->samples_per_tti); @@ -626,11 +630,11 @@ void decimation_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int rate_change, int **r /* build with cic filter does not work properly. Performances are significantly deteriorated */ #ifdef CIC_DECIMATOR - cic_decimator((int16_t *)&(PHY_vars_UE->common_vars.rxdata[0][0]), (int16_t *)&(rxdata[0][0]), + cic_decimator((int16_t *)&(PHY_vars_UE->common_vars.rxdata[0][is*frame_parms->samples_per_frame]), (int16_t *)&(rxdata[0][0]), samples_for_frame, rate_change, CIC_FILTER_STAGE_NUMBER, 0, FIR_RATE_CHANGE); #else - fir_decimator((int16_t *)&(PHY_vars_UE->common_vars.rxdata[0][0]), (int16_t *)&(rxdata[0][0]), + fir_decimator((int16_t *)&(PHY_vars_UE->common_vars.rxdata[0][frame_parms->samples_per_frame]), (int16_t *)&(rxdata[0][0]), samples_for_frame, rate_change, 0); #endif @@ -658,37 +662,43 @@ void decimation_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int rate_change, int **r * *********************************************************************/ -int pss_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int rate_change) +int pss_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int is, int rate_change) { NR_DL_FRAME_PARMS *frame_parms = &(PHY_vars_UE->frame_parms); int synchro_position; - int **rxdata = NULL; + int **rxdata; int fo_flag = PHY_vars_UE->UE_fo_compensation; // flag to enable freq offset estimation and compensation + int samples_for_frame; + + // to take into account the possibility of PSS to be found between the two frames + // the analysis of the first of two frames is extended by one symbol (duration of PSS) + if (is==0) + samples_for_frame = frame_parms->samples_per_frame + frame_parms->ofdm_symbol_size; + else + samples_for_frame = frame_parms->samples_per_frame; #ifdef DBG_PSS_NR - - int samples_for_frame = frame_parms->samples_per_subframe*NR_NUMBER_OF_SUBFRAMES_PER_FRAME; - - LOG_M("rxdata0_rand.m","rxd0_rand", &PHY_vars_UE->common_vars.rxdata[0][0], samples_for_frame, 1, 1); - + LOG_M("rxdata0_rand.m","rxd0_rand", &PHY_vars_UE->common_vars.rxdata[0][0], 2*frame_parms->samples_per_frame, 1, 1); #endif + rxdata = (int32_t**)malloc16(frame_parms->nb_antennas_rx*sizeof(int32_t*)); + for (int aa=0; aa < frame_parms->nb_antennas_rx; aa++) + rxdata[aa] = (int32_t*) malloc16_clear( (samples_for_frame+8192)*sizeof(int32_t)); + if (rate_change != 1) { - rxdata = (int32_t**)malloc16(frame_parms->nb_antennas_rx*sizeof(int32_t*)); - - for (int aa=0; aa < frame_parms->nb_antennas_rx; aa++) { - rxdata[aa] = (int32_t*) malloc16_clear( (frame_parms->samples_per_subframe*10+8192)*sizeof(int32_t)); - } #ifdef SYNCHRO_DECIMAT - decimation_synchro_nr(PHY_vars_UE, rate_change, rxdata); + decimation_synchro_nr(PHY_vars_UE, rate_change, is, rxdata); #endif } else { + for (int aa=0; aa < frame_parms->nb_antennas_rx; aa++) + memcpy(&(rxdata[aa][0]), + &(PHY_vars_UE->common_vars.rxdata[aa][is*frame_parms->samples_per_frame]), + samples_for_frame*sizeof(int32_t)); - rxdata = PHY_vars_UE->common_vars.rxdata; } #ifdef DBG_PSS_NR @@ -708,6 +718,7 @@ int pss_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int rate_change) synchro_position = pss_search_time_nr(rxdata, frame_parms, fo_flag, + samples_for_frame, (int *)&PHY_vars_UE->common_vars.eNb_id, (int *)&PHY_vars_UE->common_vars.freq_offset); @@ -727,21 +738,16 @@ int pss_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int rate_change) #endif #ifdef SYNCHRO_DECIMAT + if (rate_change != 1) + restore_frame_context_pss_nr(frame_parms, rate_change); +#endif - if (rate_change != 1) { - - if (rxdata[0] != NULL) { - - for (int aa=0;aanb_antennas_rx;aa++) { + if (rxdata[0] != NULL) { + for (int aa=0;aanb_antennas_rx;aa++) free(rxdata[aa]); - } free(rxdata); - } - - restore_frame_context_pss_nr(frame_parms, rate_change); } -#endif return synchro_position; } @@ -820,6 +826,7 @@ static inline double angle64(int64_t x) int pss_search_time_nr(int **rxdata, ///rx data in time domain NR_DL_FRAME_PARMS *frame_parms, int fo_flag, + int corr_samples, int *eNB_id, int *f_off) { @@ -830,7 +837,7 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain double ffo_est=0; - unsigned int length = (NR_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_subframe); /* 1 frame for now, it should be 2 TODO_NR */ + unsigned int length = corr_samples; AssertFatal(length>0,"illegal length %d\n",length); for (int i = 0; i < NUMBER_PSS_SEQUENCE; i++) AssertFatal(pss_corr_ue[i] != NULL,"pss_corr_ue[%d] not yet allocated! Exiting.\n", i); diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 155b34a948..8b812caba1 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -409,6 +409,11 @@ typedef struct { /// - second index: sample [0..FRAME_LENGTH_COMPLEX_SAMPLES+2048[ int32_t **rxdata; + /// \brief Holds the received data in time domain for initial sync. + /// - first index: rx antenna [0..nb_antennas_rx[ + /// - second index: sample [0..2*FRAME_LENGTH_COMPLEX_SAMPLES+...[ + int32_t **rxdata_is; + NR_UE_COMMON_PER_THREAD common_vars_rx_data_per_thread[RX_NB_TH_MAX]; /// holds output of the sync correlator diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 3ca667616a..30870bf62e 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -4941,7 +4941,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eN NR_UE_PDCCH *pdcch_vars = ue->pdcch_vars[ue->current_thread_id[nr_tti_rx]][0]; uint16_t nb_symb_sch = 8; // to be updated by higher layer uint8_t nb_symb_pdcch = pdcch_vars->coreset[0].duration; - uint8_t ssb_periodicity = 10; //ue->ssb_periodicity; // initialized to 20ms in nr_init_ue and never changed for now + uint8_t ssb_periodicity = ue->ssb_periodicity; // initialized to 20ms in nr_init_ue and never changed for now uint8_t ssb_frame_periodicity; uint8_t dci_cnt = 0; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf index f22abf3112..4d0df95225 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf @@ -71,7 +71,7 @@ gNBs = UL_timeAlignmentTimerCommon = "infinity"; ServingCellConfigCommon_n_TimingAdvanceOffset = "n0" ServingCellConfigCommon_ssb_PositionsInBurst_PR = 0x01; - ServingCellConfigCommon_ssb_periodicityServingCell = 10; + ServingCellConfigCommon_ssb_periodicityServingCell = 20; ServingCellConfigCommon_dmrs_TypeA_Position = 2; NIA_SubcarrierSpacing = "kHz15"; ServingCellConfigCommon_ss_PBCH_BlockPower = -60;