From d2039b4c73a0dd22b02e8350b0ecda55e734953a Mon Sep 17 00:00:00 2001 From: hongzhi wang Date: Thu, 26 Jul 2018 11:54:12 +0200 Subject: [PATCH] nr ue update rx sample offset --- openair1/PHY/MODULATION/slot_fep.c | 12 +++++----- .../PHY/NR_UE_TRANSPORT/nr_initial_sync.c | 20 ++++++++-------- openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c | 23 +++++++++++-------- targets/RT/USER/nr-ue.c | 2 +- 4 files changed, 32 insertions(+), 25 deletions(-) diff --git a/openair1/PHY/MODULATION/slot_fep.c b/openair1/PHY/MODULATION/slot_fep.c index b1291695b4..3b405966cf 100644 --- a/openair1/PHY/MODULATION/slot_fep.c +++ b/openair1/PHY/MODULATION/slot_fep.c @@ -101,10 +101,10 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, slot_offset = (frame_parms->samples_per_tti>>1) * (Ns%2); } - if (l<0 || l>=7-frame_parms->Ncp) { + /*if (l<0 || l>=7-frame_parms->Ncp) { printf("slot_fep: l must be between 0 and %d\n",7-frame_parms->Ncp); return(-1); - } + }*/ if (Ns<0 || Ns>=20) { printf("slot_fep: Ns must be between 0 and 19\n"); @@ -191,12 +191,12 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, switch(channel){ case NR_PBCH_EST: - if ((l>4) && (l<8)) { + //if ((l>4) && (l<8)) { for (aa=0; aanb_antenna_ports_eNB; aa++) { -#ifdef DEBUG_FEP +//#ifdef DEBUG_FEP printf("Channel estimation eNB %d, aatx %d, slot %d, symbol %d\n",eNB_id,aa,Ns,l); -#endif +//#endif #if UE_TIMING_TRACE start_meas(&ue->dlsch_channel_estimation_stats); #endif @@ -205,7 +205,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, aa, l, symbol); - } + //} #if UE_TIMING_TRACE stop_meas(&ue->dlsch_channel_estimation_stats); #endif diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c index 42aaa10e25..25a4dde6f2 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c @@ -70,7 +70,7 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode) //symbol 1 nr_slot_fep(ue, - 1, + 5, 0, ue->rx_offset, 0, @@ -79,7 +79,7 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode) //symbol 2 nr_slot_fep(ue, - 2, + 6, 0, ue->rx_offset, 0, @@ -88,7 +88,7 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode) //symbol 3 nr_slot_fep(ue, - 3, + 7, 0, ue->rx_offset, 0, @@ -198,7 +198,7 @@ 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); + sync_pos_slot = (frame_parms->samples_per_tti>>1) - 3*(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; @@ -211,6 +211,8 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode) else ue->rx_offset = FRAME_LENGTH_COMPLEX_SAMPLES + sync_pos2 - sync_pos_slot; + printf("sync_pos %d sync_pos_slot %d rx_offset\n",sync_pos,sync_pos_slot, ue->rx_offset); + // write_output("rxdata1.m","rxd1",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1); @@ -385,9 +387,9 @@ LOG_I(PHY,"[UE %d] AUTOTEST Cell Sync : frame = %d, rx_offset %d, freq_offset % rx_power = 0; // 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], - frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples); + //for (aarx=0; aarxnb_antennas_rx; aarx++) + // rx_power += signal_energy(&ue->common_vars.rxdata[aarx][sync_pos2], + // frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples); /* // do a measurement on the full frame @@ -409,7 +411,7 @@ LOG_I(PHY,"[UE %d] AUTOTEST Cell Sync : frame = %d, rx_offset %d, freq_offset % #ifndef OAI_BLADERF #ifndef OAI_LMSSDR #ifndef OAI_ADRV9371_ZC706 - phy_adjust_gain(ue,ue->measurements.rx_power_avg_dB[0],0); + //phy_adjust_gain(ue,ue->measurements.rx_power_avg_dB[0],0); #endif #endif #endif @@ -422,7 +424,7 @@ LOG_I(PHY,"[UE %d] AUTOTEST Cell Sync : frame = %d, rx_offset %d, freq_offset % #ifndef OAI_BLADERF #ifndef OAI_LMSSDR #ifndef OAI_ADRV9371_ZC706 - phy_adjust_gain(ue,dB_fixed(ue->measurements.rssi),0); + //phy_adjust_gain(ue,dB_fixed(ue->measurements.rssi),0); #endif #endif #endif diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c index d181c81fca..c20546aff9 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c @@ -83,7 +83,7 @@ uint16_t nr_pbch_extract(int **rxdataF, } j=0; - if ((symbol==1) || (symbol==3)) { + if ((symbol==5) || (symbol==7)) { for (i=0; i<12; i++) { if ((i!=nushiftmod4) && (i!=(nushiftmod4+4)) && @@ -126,14 +126,14 @@ uint16_t nr_pbch_extract(int **rxdataF, for (rb=0; rb<20; rb++) { j=0; - if ((symbol==1) || (symbol==3)) { + if ((symbol==5) || (symbol==7)) { for (i=0; i<12; i++) { if ((i!=nushiftmod4) && (i!=(nushiftmod4+4)) && (i!=(nushiftmod4+8))) { dl_ch0_ext[j]=dl_ch0[i]; - //if ((rb==0) && (i<2)) - //printf("dl ch0 ext[%d] = %d dl_ch0 [%d]= %d\n",j,dl_ch0_ext[j],i,dl_ch0[i]); + if ((rb==0) && (i<2)) + printf("dl ch0 ext[%d] = %d dl_ch0 [%d]= %d\n",j,dl_ch0_ext[j],i,dl_ch0[i]); j++; } } @@ -141,7 +141,7 @@ uint16_t nr_pbch_extract(int **rxdataF, dl_ch0+=12; dl_ch0_ext+=9; } - else { //symbol 2 + else { if ((rb < 4) || (rb >15)){ for (i=0; i<12; i++) { if ((i!=nushiftmod4) && @@ -401,7 +401,7 @@ void nr_pbch_unscrambling(NR_UE_PBCH *pbch, uint32_t *pbch_a_interleaved = (uint32_t*)pbch->pbch_a_interleaved; uint32_t unscrambling_mask = 0x100006D; - //printf("unscramb nid_cell %d\n",frame_parms->Nid_cell); + printf("unscramb nid_cell %d\n",Nid); reset = 1; // x1 is set in first call to lte_gold_generic @@ -431,6 +431,10 @@ void nr_pbch_unscrambling(NR_UE_PBCH *pbch, else { if (((s>>((i+offset)&0x1f))&1)==1) demod_pbch_e[i] = -demod_pbch_e[i]; +#ifdef DEBUG_PBCH_ENCODING + if (i<8) + printf("s %d demod_pbch_e[i] %d\n", ((s>>((i+offset)&0x1f))&1), demod_pbch_e[i]); +#endif } } @@ -594,7 +598,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, return(-1); } - if (symbol==2) { + if (symbol==6) { nr_pbch_quantize(pbch_e_rx, (short*)&(nr_ue_pbch_vars->rxdataF_comp[0][symbol*240]), 144); @@ -619,7 +623,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, //#ifdef DEBUG_PBCH //pbch_e_rx = &nr_ue_pbch_vars->llr[0]; - short *p = (short *)&(nr_ue_pbch_vars->rxdataF_comp[0][1*20*12]); + short *p = (short *)&(nr_ue_pbch_vars->rxdataF_comp[0][5*20*12]); for (int cnt = 0; cnt < 8 ; cnt++) printf("pbch rx llr %d rxdata_comp %d addr %p\n",*(pbch_e_rx+cnt), p[cnt], &p[0]); //#endif @@ -642,12 +646,13 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, nr_pbch_unscrambling(nr_ue_pbch_vars,frame_parms->Nid_cell,nushift,M,NR_POLAR_PBCH_E,0); //#ifdef DEBUG_PBCH - if (i<16){ + for (i=0; i<16; i++){ printf("unscrambling demod_pbch_e[%d] r = %2.3f i = %2.3f\n", i<<1 , demod_pbch_e[i<<1], demod_pbch_e[(i<<1)+1]);} //#endif //polar decoding de-rate matching decoderState = polar_decoder(demod_pbch_e, pbch_a_b, &frame_parms->pbch_polar_params, decoderListSize, aPrioriArray, pathMetricAppr); + printf("polar decoder state %d\n", decoderState); if(decoderState == -1) return(decoderState); diff --git a/targets/RT/USER/nr-ue.c b/targets/RT/USER/nr-ue.c index 7ccbcac485..3624e59791 100644 --- a/targets/RT/USER/nr-ue.c +++ b/targets/RT/USER/nr-ue.c @@ -691,7 +691,7 @@ static void *UE_thread_rxn_txnp4(void *arg) { #endif // Prepare the future Tx data -#if 1 +#if 0 if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_UL) || (UE->frame_parms.frame_type == FDD) ) if (UE->mode != loop_through_memory)