Commit 799e5274 authored by luis_pereira87's avatar luis_pereira87

Adjust sync based on PSS improvements

parent 29268d0a
......@@ -642,9 +642,6 @@ void *UE_thread(void *arg) {
readBlockSize=get_readBlockSize(slot_nr, &UE->frame_parms);
writeBlockSize=UE->frame_parms.get_samples_per_slot((slot_nr + DURATION_RX_TO_TX - NR_RX_NB_TH) % nb_slot_frame, &UE->frame_parms);
} else {
//UE->rx_offset_diff = computeSamplesShift(UE);
readBlockSize=get_readBlockSize(slot_nr, &UE->frame_parms) -
UE->rx_offset_diff;
writeBlockSize=UE->frame_parms.get_samples_per_slot((slot_nr + DURATION_RX_TO_TX - NR_RX_NB_TH) % nb_slot_frame, &UE->frame_parms)- UE->rx_offset_diff;
......
......@@ -981,6 +981,7 @@ int nr_adjust_pss_synch(PHY_VARS_NR_UE *ue, int *f_off) {
int **rxdata = ue->common_vars.rxdata;
NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
uint8_t Nid2 = GET_NID2(frame_parms->Nid_cell);
int peak_position_ref = ((frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples)<<1) + frame_parms->nb_prefix_samples0;
int maxval=0;
for (int i=0;i<2*(frame_parms->ofdm_symbol_size);i++) {
......@@ -996,8 +997,8 @@ int nr_adjust_pss_synch(PHY_VARS_NR_UE *ue, int *f_off) {
int peak_position = 0;
int64_t result = 0;
int64_t avg=0;
int start = 2*(frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples) + frame_parms->nb_prefix_samples0 - 200;
int length = 2*frame_parms->ofdm_symbol_size + 200;
int start = peak_position_ref - (frame_parms->ofdm_symbol_size>>3);
int length = frame_parms->ofdm_symbol_size + (frame_parms->ofdm_symbol_size>>3);
memset(pss_corr_ue[Nid2],0,(start+length)*sizeof(int64_t));
for (int n=start; n < start+length; n+=4) { //
for (int ar=0; ar<frame_parms->nb_antennas_rx; ar++) {
......@@ -1019,7 +1020,15 @@ int nr_adjust_pss_synch(PHY_VARS_NR_UE *ue, int *f_off) {
return 0;
}
int peak_position_diff = peak_position - ( ((frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples)<<1) + frame_parms->nb_prefix_samples0);
int peak_position_diff = peak_position_ref - peak_position;
ue->rx_offset_diff = 0;
if(peak_position_diff != 0) {
ue->rx_offset_diff = peak_position_diff>>3;
if (ue->rx_offset_diff == 0) {
ue->rx_offset_diff = peak_position_diff > 0 ? 1 : -1;
}
}
// Fractional frequency offset computation according to Cross-correlation Synchronization Algorithm Using PSS
// Shoujun Huang, Yongtao Su, Ying He and Shan Tang, "Joint time and frequency offset estimation in LTE downlink,"
......
......@@ -1648,7 +1648,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
if ((ue->decode_MIB == 1) && slot_pbch) {
int peak_position_diff = nr_adjust_pss_synch(ue, (int *)&ue->common_vars.freq_offset);
nr_adjust_pss_synch(ue, (int *)&ue->common_vars.freq_offset);
LOG_D(PHY," ------ Decode MIB: frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx);
nr_ue_pbch_procedures(gNB_id, ue, proc, 0);
......@@ -1664,10 +1664,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
16384);
}*/
//ue->rx_offset = peak_position_diff;
ue->rx_offset_diff = -peak_position_diff;
LOG_D(PHY, "Doing N0 measurements in %s\n", __FUNCTION__);
nr_ue_rrc_measurements(ue, proc, nr_slot_rx);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PBCH, VCD_FUNCTION_OUT);
......
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