Commit c5b6195a authored by Jaroslava Fiedlerova's avatar Jaroslava Fiedlerova

Merge remote-tracking branch 'origin/fix-sleeping-ue-at-synchro' into integration_2024_w14

parents ad77def8 7106f3c1
......@@ -48,8 +48,6 @@
//static nfapi_nr_config_request_t config_t;
//static nfapi_nr_config_request_t* config =&config_t;
int cnt=0;
// #define DEBUG_INITIAL_SYNCH
#define DUMP_PBCH_CH_ESTIMATES 0
......@@ -137,12 +135,9 @@ static bool nr_pbch_detection(const UE_nr_rxtx_proc_t *proc,
nr_initial_sync_t nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, int n_frames, int sa)
{
int32_t sync_pos, sync_pos_frame; // k_ssb, N_ssb_crb, sync_pos2,
int32_t metric_tdd_ncp = 0;
uint8_t phase_tdd_ncp;
int frame_id;
NR_DL_FRAME_PARMS *fp = &ue->frame_parms;
nr_initial_sync_t ret = {true, 0};
nr_initial_sync_t ret = {.cell_detected = false};
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_INITIAL_UE_SYNC, VCD_FUNCTION_IN);
......@@ -163,13 +158,10 @@ nr_initial_sync_t nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, i
const uint32_t rxdataF_sz = ue->frame_parms.samples_per_slot_wCP;
__attribute__((aligned(32))) c16_t rxdataF[ue->frame_parms.nb_antennas_rx][rxdataF_sz];
cnt++;
if (1) { // (cnt>100)
cnt = 0;
// initial sync performed on two successive frames, if pbch passes on first frame, no need to process second frame
// only one frame is used for symulation tools
for (frame_id = 0; frame_id < n_frames; frame_id++) {
for (int frame_id = 0; frame_id < n_frames && !ret.cell_detected; frame_id++) {
/* process pss search on received buffer */
sync_pos = pss_synchro_nr(ue, frame_id, NO_RATE_CHANGE);
if (sync_pos < fp->nb_prefix_samples)
......@@ -181,9 +173,12 @@ nr_initial_sync_t nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, i
LOG_I(PHY, "[UE%d] Initial sync : Estimated PSS position %d, Nid2 %d\n", ue->Mod_id, sync_pos, ue->common_vars.nid2);
LOG_I(PHY, "sync_pos %d ssb_offset %d \n", sync_pos, ue->ssb_offset);
#endif
/* check that SSS/PBCH block is continuous inside the received buffer */
if (ue->ssb_offset + NR_N_SYMBOLS_SSB * (fp->ofdm_symbol_size + fp->nb_prefix_samples) < fp->samples_per_frame) {
if (ue->ssb_offset + NR_N_SYMBOLS_SSB * (fp->ofdm_symbol_size + fp->nb_prefix_samples) >= fp->samples_per_frame) {
LOG_I(PHY, "Can't try to decode SSS from PSS position, will retry (PSS circular buffer wrapping): sync_pos %d\n", sync_pos);
continue;
}
// digital compensation of FFO for SSB symbols
if (ue->UE_fo_compensation) {
double s_time = 1 / (1.0e3 * fp->samples_per_subframe); // sampling time
......@@ -219,10 +214,12 @@ nr_initial_sync_t nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, i
#endif
int freq_offset_sss = 0;
bool ret_sss = rx_sss_nr(ue, proc, &metric_tdd_ncp, &phase_tdd_ncp, &freq_offset_sss, rxdataF);
ret.cell_detected = ret_sss; // rx_sss_nr returns true if success
int32_t metric_tdd_ncp = 0;
uint8_t phase_tdd_ncp;
ret.cell_detected = rx_sss_nr(ue, proc, &metric_tdd_ncp, &phase_tdd_ncp, &freq_offset_sss, rxdataF);
// digital compensation of FFO for SSB symbols
if (ue->UE_fo_compensation) {
if (freq_offset_sss && ue->UE_fo_compensation) {
double s_time = 1 / (1.0e3 * fp->samples_per_subframe); // sampling time
double off_angle = -2 * M_PI * s_time * freq_offset_sss; // offset rotation angle compensation per sample
......@@ -236,7 +233,6 @@ nr_initial_sync_t nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, i
ue->common_vars.rxdata[ar][n].i = (short)(round(re * sin(n * off_angle) + im * cos(n * off_angle)));
}
}
ue->common_vars.freq_offset += freq_offset_sss;
}
......@@ -284,21 +280,6 @@ nr_initial_sync_t nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, i
ret.rx_offset = ue->ssb_offset - sync_pos_frame;
}
/*
int nb_prefix_samples0 = fp->nb_prefix_samples0;
fp->nb_prefix_samples0 = fp->nb_prefix_samples;
nr_slot_fep(ue, proc, 0, 0, ue->ssb_offset, 0, NR_PDCCH_EST);
nr_slot_fep(ue, proc, 1, 0, ue->ssb_offset, 0, NR_PDCCH_EST);
fp->nb_prefix_samples0 = nb_prefix_samples0;
LOG_I(PHY,"[UE %d] AUTOTEST Cell Sync : frame = %d, rx_offset %d, freq_offset %d \n",
ue->Mod_id,
ue->proc.proc_rxtx[0].frame_rx,
ue->rx_offset,
ue->common_vars.freq_offset );
*/
#ifdef DEBUG_INITIAL_SYNCH
LOG_I(PHY,
"TDD Normal prefix: CellId %d metric %d, phase %d, pbch detected %d, measured offset %d\n",
......@@ -308,17 +289,6 @@ nr_initial_sync_t nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, i
ret.cell_detected,
ret.rx_offset);
#endif
} else {
#ifdef DEBUG_INITIAL_SYNCH
LOG_I(PHY, "TDD Normal prefix: SSS error condition: sync_pos %d\n", sync_pos);
#endif
}
if (ret.cell_detected)
break;
}
} else {
ret.cell_detected = false;
}
/* Consider this is a false detection if the offset is > 1000 Hz
......
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