Commit c1dc2dfd authored by dukl's avatar dukl

fix sync bug

parent a898811b
...@@ -59,6 +59,8 @@ int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue, ...@@ -59,6 +59,8 @@ int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue,
unsigned char Ns, unsigned char Ns,
int sample_offset); int sample_offset);
uint cal_amp(int16_t *dataIn, int len);
int slot_fep_mbsfn(PHY_VARS_UE *phy_vars_ue, int slot_fep_mbsfn(PHY_VARS_UE *phy_vars_ue,
unsigned char l, unsigned char l,
int subframe, int subframe,
......
...@@ -646,6 +646,12 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, ...@@ -646,6 +646,12 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: LLR Computation %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: LLR Computation %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
// Please keep it: useful for debugging // Please keep it: useful for debugging
if ((pilots == 0) && (type == SI_PDSCH))
{
uint pdsch_amp;
pdsch_amp = cal_amp((int16_t *)&pdsch_vars[gNB_id]->rxdataF_ext[0][symbol *nb_rb_pdsch * 12 ], nb_rb_pdsch * 12);
LOG_I(PHY, "frame %d %d, SIB symbol %d pdsch_amp %d, rb %d\n", frame, nr_slot_rx, symbol, pdsch_amp, nb_rb_pdsch);
}
#ifdef DEBUG_PDSCH_RX #ifdef DEBUG_PDSCH_RX
char filename[40]; char filename[40];
uint8_t aa = 0; uint8_t aa = 0;
......
...@@ -236,6 +236,8 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, ...@@ -236,6 +236,8 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
/* process pss search on received buffer */ /* process pss search on received buffer */
sync_pos = pss_synchro_nr(ue, is, NO_RATE_CHANGE); sync_pos = pss_synchro_nr(ue, is, NO_RATE_CHANGE);
if (sync_pos < 0)
continue;
if (sync_pos >= fp->nb_prefix_samples) if (sync_pos >= fp->nb_prefix_samples)
ue->ssb_offset = sync_pos - fp->nb_prefix_samples; ue->ssb_offset = sync_pos - fp->nb_prefix_samples;
else else
......
...@@ -943,17 +943,20 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain ...@@ -943,17 +943,20 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain
} }
// computing absolute value of frequency offset // computing absolute value of frequency offset
*f_off = ffo_est*frame_parms->subcarrier_spacing;
for (int pss_index = 0; pss_index < NUMBER_PSS_SEQUENCE; pss_index++) avg[pss_index]/=(length/4); for (int pss_index = 0; pss_index < NUMBER_PSS_SEQUENCE; pss_index++) avg[pss_index]/=(length/4);
*eNB_id = pss_source; *eNB_id = pss_source;
LOG_I(PHY,"[UE] nr_synchro_time: Sync source = %d, Peak found at pos %d, val = %llu (%d dB) avg %d dB, ffo %lf\n", pss_source, peak_position, (unsigned long long)peak_value, dB_fixed64(peak_value),dB_fixed64(avg[pss_source]),ffo_est); //LOG_I(PHY,"[UE] nr_synchro_time: Sync source = %d, Peak found at pos %d, val = %llu (%d dB) avg %d dB, ffo %lf\n", pss_source, peak_position, (unsigned long long)peak_value, dB_fixed64(peak_value),dB_fixed64(avg[pss_source]),ffo_est);
if (peak_value < 5*avg[pss_source]) if (peak_value < 5*avg[pss_source])
{
LOG_I(PHY,"[UE] %d nr_synchro_time invalid: Sync source = %d, Peak found at pos %d, val = %llu (%d dB) avg %llu (%d dB), ffo %lf, %d hz\n", is, pss_source, peak_position, (unsigned long long)peak_value, dB_fixed64(peak_value), (unsigned long long)avg[pss_source], dB_fixed64(avg[pss_source]),ffo_est, *f_off);
return(-1); return(-1);
}
*f_off = ffo_est*frame_parms->subcarrier_spacing;
LOG_I(PHY,"[UE] %d nr_synchro_time valid: Sync source = %d, Peak found at pos %d, val = %llu (%d dB) avg %llu (%d dB), ffo %lf, %d hz\n", is, pss_source, peak_position, (unsigned long long)peak_value, dB_fixed64(peak_value), (unsigned long long)avg[pss_source], dB_fixed64(avg[pss_source]),ffo_est, *f_off);
#ifdef DBG_PSS_NR #ifdef DBG_PSS_NR
......
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