From c3420b0198a923a9c455e9c1015d1ea41c632447 Mon Sep 17 00:00:00 2001 From: Hongzhi Wang Date: Wed, 25 Jul 2018 14:50:56 +0200 Subject: [PATCH] ue update symbol num synchro --- openair1/PHY/MODULATION/slot_fep.c | 2 +- openair1/PHY/NR_REFSIG/nr_dmrs_rx.c | 7 +---- openair1/PHY/NR_REFSIG/ss_pbch_nr.h | 8 +++--- .../PHY/NR_UE_TRANSPORT/nr_initial_sync.c | 28 +++++++++++-------- openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c | 4 +-- 5 files changed, 25 insertions(+), 24 deletions(-) diff --git a/openair1/PHY/MODULATION/slot_fep.c b/openair1/PHY/MODULATION/slot_fep.c index b655426d0b..b1291695b4 100644 --- a/openair1/PHY/MODULATION/slot_fep.c +++ b/openair1/PHY/MODULATION/slot_fep.c @@ -191,7 +191,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, switch(channel){ case NR_PBCH_EST: - if ((l>0) && (l<4)) { + if ((l>4) && (l<8)) { for (aa=0; aanb_antenna_ports_eNB; aa++) { #ifdef DEBUG_FEP diff --git a/openair1/PHY/NR_REFSIG/nr_dmrs_rx.c b/openair1/PHY/NR_REFSIG/nr_dmrs_rx.c index 66aa656c73..941853388f 100644 --- a/openair1/PHY/NR_REFSIG/nr_dmrs_rx.c +++ b/openair1/PHY/NR_REFSIG/nr_dmrs_rx.c @@ -51,12 +51,7 @@ int wf2[12][2] = {{1,1},{1,-1},{1,1},{1,-1},{1,1},{1,-1},{1,1},{1,1},{1,1},{1,-1 int wt2[12][2] = {{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,-1},{1,-1},{1,-1},{1,-1},{1,-1},{1,-1}}; -//short nr_mod_table[14] = {0,0,-23170,-23170,23170,23170,-23170,-23170,-23170,23170,23170,-23170,23170,23170}; - short nr_rx_mod_table[NR_MOD_TABLE_SIZE_SHORT] = {0,0,23170,-23170,-23170,23170,23170,-23170,23170,23170,-23170,-23170,-23170,23170}; -//short nr_mod_table[14] = {0,0,23170,23170,-23170,-23170,23170,23170,23170,-23170,-23170,23170,-23170,-23170}; -//extern short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT]; - -short nr_mod_table[14] = {0,0,23170,-23170,-23170,23170,23170,-23170,23170,23170,-23170,-23170,-23170,23170}; +short nr_rx_mod_table[NR_MOD_TABLE_SIZE_SHORT] = {0,0,23170,-23170,-23170,23170,23170,-23170,23170,23170,-23170,-23170,-23170,23170}; int nr_pdcch_dmrs_rx(PHY_VARS_NR_UE *ue, uint8_t eNB_offset, diff --git a/openair1/PHY/NR_REFSIG/ss_pbch_nr.h b/openair1/PHY/NR_REFSIG/ss_pbch_nr.h index e230d8035b..5cd58ea5b6 100644 --- a/openair1/PHY/NR_REFSIG/ss_pbch_nr.h +++ b/openair1/PHY/NR_REFSIG/ss_pbch_nr.h @@ -51,10 +51,10 @@ #define PSS_SC_START_NR (52) /* see from TS 38.211 table 7.4.3.1-1: Resources within an SS/PBCH block for PSS... */ /* define ofdm symbol offset in the SS/PBCH block of NR synchronisation */ -#define PSS_SYMBOL_NB (0) /* symbol numbers for each element */ -#define PBCH_SYMBOL_NB (1) -#define SSS_SYMBOL_NB (2) -#define PBCH_LAST_SYMBOL_NB (3) +#define PSS_SYMBOL_NB (4) /* symbol numbers for each element */ +#define PBCH_SYMBOL_NB (5) +#define SSS_SYMBOL_NB (6) +#define PBCH_LAST_SYMBOL_NB (7) /* SS/PBCH parameters */ #define N_RB_SS_PBCH_BLOCK (20) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c index c02261d76f..42aaa10e25 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c @@ -58,6 +58,7 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode) uint8_t l,pbch_decoded,frame_mod4,pbch_tx_ant,dummy; NR_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; char phich_resource[6]; + int ret =-1; #ifdef DEBUG_INITIAL_SYNCH LOG_I(PHY,"[UE%d] Initial sync: starting PBCH detection (rx_offset %d)\n",ue->Mod_id, @@ -101,7 +102,7 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode) printf("pbch_detection nid_cell %d\n",frame_parms->Nid_cell); //for (frame_mod4=0; frame_mod4<4; frame_mod4++) { - pbch_tx_ant = nr_rx_pbch(ue, + ret = nr_rx_pbch(ue, &ue->proc.proc_rxtx[0], ue->pbch_vars[0], frame_parms, @@ -115,9 +116,9 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode) //} - if (pbch_decoded) { + if (ret==0) { - frame_parms->nb_antenna_ports_eNB = pbch_tx_ant; + frame_parms->nb_antenna_ports_eNB = 1; //pbch_tx_ant; // set initial transmission mode to 1 or 2 depending on number of detected TX antennas //frame_parms->mode1_flag = (pbch_tx_ant==1); @@ -131,13 +132,7 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode) for(int i=0; iproc.proc_rxtx[i].frame_rx = (((ue->pbch_vars[0]->decoded_output[2]&3)<<6) + (ue->pbch_vars[0]->decoded_output[1]>>2))<<2; - ue->proc.proc_rxtx[i].frame_rx = (((ue->pbch_vars[0]->decoded_output[2]&3)<<6) + (ue->pbch_vars[0]->decoded_output[1]>>2))<<2; -#ifndef USER_MODE - // one frame delay - ue->proc.proc_rxtx[i].frame_rx ++; -#endif ue->proc.proc_rxtx[i].frame_tx = ue->proc.proc_rxtx[0].frame_rx; } #ifdef DEBUG_INITIAL_SYNCH @@ -160,7 +155,7 @@ char prefix_string[2][9] = {"NORMAL","EXTENDED"}; int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode) { - int32_t sync_pos, sync_pos2, k_ssb, N_ssb_crb; + int32_t sync_pos, sync_pos2, k_ssb, N_ssb_crb, sync_pos_slot; int32_t metric_fdd_ncp=0; uint8_t phase_fdd_ncp; @@ -203,8 +198,19 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode) /* process pss search on received buffer */ sync_pos = pss_synchro_nr(ue, NO_RATE_CHANGE); + sync_pos_slot = (frame_parms->samples_per_tti>>1) - 4*(frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples); + + if (sync_pos >= frame_parms->nb_prefix_samples) + sync_pos2 = sync_pos - frame_parms->nb_prefix_samples; + else + sync_pos2 = sync_pos + FRAME_LENGTH_COMPLEX_SAMPLES - frame_parms->nb_prefix_samples; + /* offset is used by sss serach as it is returned from pss search */ - ue->rx_offset = sync_pos; + if (sync_pos2 >= sync_pos_slot) + ue->rx_offset = sync_pos2 - sync_pos_slot; + else + ue->rx_offset = FRAME_LENGTH_COMPLEX_SAMPLES + sync_pos2 - sync_pos_slot; + // write_output("rxdata1.m","rxd1",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c index ad9e0262e4..d181c81fca 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c @@ -498,7 +498,7 @@ unsigned char sign(int8_t x) { uint8_t pbch_deinterleaving_pattern[32] = {28,0,31,30,1,29,25,27,22,2,24,3,4,5,6,7,18,21,20,8,9,10,11,19,26,12,13,14,15,16,23,17}; -uint16_t nr_rx_pbch( PHY_VARS_NR_UE *ue, +int nr_rx_pbch( PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, NR_UE_PBCH *nr_ue_pbch_vars, NR_DL_FRAME_PARMS *frame_parms, @@ -546,7 +546,7 @@ uint16_t nr_rx_pbch( PHY_VARS_NR_UE *ue, // clear LLR buffer memset(nr_ue_pbch_vars->llr,0,NR_POLAR_PBCH_E); - for (symbol=1; symbol<4; symbol++) { + for (symbol=5; symbol<8; symbol++) { //printf("address dataf %p",nr_ue_common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe_rx]].rxdataF); //write_output("rxdataF0_pbch.m","rxF0pbch",nr_ue_common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe_rx]].rxdataF,frame_parms->ofdm_symbol_size*4,2,1);