Commit e0a21550 authored by Francesco Mani's avatar Francesco Mani

fix on pbchsim for -I but still not working without initial sync

parent 0aab3025
...@@ -239,7 +239,7 @@ static void UE_synch(void *arg) { ...@@ -239,7 +239,7 @@ static void UE_synch(void *arg) {
case pbch: case pbch:
LOG_I(PHY, "[UE thread Synch] Running Initial Synch (mode %d)\n",UE->mode); LOG_I(PHY, "[UE thread Synch] Running Initial Synch (mode %d)\n",UE->mode);
if (nr_initial_sync( syncD->proc, UE, UE->mode ) == 0) { if (nr_initial_sync( syncD->proc, UE, UE->mode,2) == 0) {
freq_offset = UE->common_vars.freq_offset; // frequency offset computed with pss in initial sync freq_offset = UE->common_vars.freq_offset; // frequency offset computed with pss in initial sync
hw_slot_offset = (UE->rx_offset<<1) / UE->frame_parms.samples_per_slot; hw_slot_offset = (UE->rx_offset<<1) / UE->frame_parms.samples_per_slot;
LOG_I(PHY,"Got synch: hw_slot_offset %d, carrier off %d Hz, rxgain %d (DL %u, UL %u), UE_scan_carrier %d\n", LOG_I(PHY,"Got synch: hw_slot_offset %d, carrier off %d Hz, rxgain %d (DL %u, UL %u), UE_scan_carrier %d\n",
......
...@@ -133,8 +133,6 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -133,8 +133,6 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
return(-1); return(-1);
} }
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) { for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
memset(&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],0,frame_parms->ofdm_symbol_size*sizeof(int)); memset(&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],0,frame_parms->ofdm_symbol_size*sizeof(int));
......
...@@ -201,7 +201,7 @@ int nr_pbch_detection(UE_nr_rxtx_proc_t * proc, PHY_VARS_NR_UE *ue, int pbch_ini ...@@ -201,7 +201,7 @@ int nr_pbch_detection(UE_nr_rxtx_proc_t * proc, PHY_VARS_NR_UE *ue, int pbch_ini
char duplex_string[2][4] = {"FDD","TDD"}; char duplex_string[2][4] = {"FDD","TDD"};
char prefix_string[2][9] = {"NORMAL","EXTENDED"}; char prefix_string[2][9] = {"NORMAL","EXTENDED"};
int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, runmode_t mode) int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, runmode_t mode, int n_frames)
{ {
int32_t sync_pos, sync_pos_frame; // k_ssb, N_ssb_crb, sync_pos2, int32_t sync_pos, sync_pos_frame; // k_ssb, N_ssb_crb, sync_pos2,
...@@ -243,7 +243,8 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, runmode_t mode) ...@@ -243,7 +243,8 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, runmode_t mode)
cnt =0; cnt =0;
// initial sync performed on two successive frames, if pbch passes on first frame, no need to process second frame // initial sync performed on two successive frames, if pbch passes on first frame, no need to process second frame
for(is=0; is<2;is++) { // only one frame is used for symulation tools
for(is=0; is<n_frames;is++) {
/* 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);
...@@ -253,7 +254,6 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, runmode_t mode) ...@@ -253,7 +254,6 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, runmode_t mode)
else else
ue->ssb_offset = sync_pos + (fp->samples_per_subframe * 10) - fp->nb_prefix_samples; ue->ssb_offset = sync_pos + (fp->samples_per_subframe * 10) - fp->nb_prefix_samples;
#ifdef DEBUG_INITIAL_SYNCH #ifdef DEBUG_INITIAL_SYNCH
LOG_I(PHY,"[UE%d] Initial sync : Estimated PSS position %d, Nid2 %d\n", ue->Mod_id, sync_pos,ue->common_vars.eNb_id); LOG_I(PHY,"[UE%d] Initial sync : Estimated PSS position %d, Nid2 %d\n", ue->Mod_id, sync_pos,ue->common_vars.eNb_id);
LOG_I(PHY,"sync_pos %d ssb_offset %d \n",sync_pos,ue->ssb_offset); LOG_I(PHY,"sync_pos %d ssb_offset %d \n",sync_pos,ue->ssb_offset);
......
...@@ -1435,7 +1435,9 @@ void generate_RIV_tables(void); ...@@ -1435,7 +1435,9 @@ void generate_RIV_tables(void);
@param mode current running mode @param mode current running mode
*/ */
int nr_initial_sync(UE_nr_rxtx_proc_t *proc, int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
PHY_VARS_NR_UE *phy_vars_ue, runmode_t mode); PHY_VARS_NR_UE *phy_vars_ue,
runmode_t mode,
int n_frames);
/*! /*!
......
...@@ -685,7 +685,7 @@ int main(int argc, char **argv) ...@@ -685,7 +685,7 @@ int main(int argc, char **argv)
} }
if (UE->is_synchronized == 0) { if (UE->is_synchronized == 0) {
UE_nr_rxtx_proc_t proc={0}; UE_nr_rxtx_proc_t proc={0};
ret = nr_initial_sync(&proc, UE, normal_txrx); ret = nr_initial_sync(&proc, UE, normal_txrx,1);
printf("nr_initial_sync1 returns %d\n",ret); printf("nr_initial_sync1 returns %d\n",ret);
if (ret<0) n_errors++; if (ret<0) n_errors++;
} }
......
...@@ -478,8 +478,7 @@ int main(int argc, char **argv) ...@@ -478,8 +478,7 @@ int main(int argc, char **argv)
if(eps!=0.0) if(eps!=0.0)
UE->UE_fo_compensation = 1; // if a frequency offset is set then perform fo estimation and compensation UE->UE_fo_compensation = 1; // if a frequency offset is set then perform fo estimation and compensation
if (init_nr_ue_signal(UE, 1, 0) != 0) if (init_nr_ue_signal(UE, 1, 0) != 0) {
{
printf("Error at UE NR initialisation\n"); printf("Error at UE NR initialisation\n");
exit(-1); exit(-1);
} }
...@@ -588,39 +587,37 @@ int main(int argc, char **argv) ...@@ -588,39 +587,37 @@ int main(int argc, char **argv)
for (i=0; i<frame_length_complex_samples; i++) { for (i=0; i<frame_length_complex_samples; i++) {
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) { for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
((short*) UE->common_vars.rxdata[aa])[2*i] = (short) ((r_re[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0))); ((short*) UE->common_vars.rxdata_is[aa])[2*i] = (short) ((r_re[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
((short*) UE->common_vars.rxdata[aa])[2*i+1] = (short) ((r_im[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0))); ((short*) UE->common_vars.rxdata_is[aa])[2*i+1] = (short) ((r_im[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
} }
} }
if (n_trials==1) { if (n_trials==1) {
LOG_M("rxsig0.m","rxs0", UE->common_vars.rxdata[0],frame_parms->samples_per_frame,1,1); LOG_M("rxsig0.m","rxs0", UE->common_vars.rxdata_is[0],frame_parms->samples_per_frame,1,1);
if (gNB->frame_parms.nb_antennas_tx>1) if (gNB->frame_parms.nb_antennas_tx>1)
LOG_M("rxsig1.m","rxs1", UE->common_vars.rxdata[1],frame_parms->samples_per_frame,1,1); LOG_M("rxsig1.m","rxs1", UE->common_vars.rxdata_is[1],frame_parms->samples_per_frame,1,1);
} }
if (UE->is_synchronized == 0) { if (UE->is_synchronized == 0) {
UE_nr_rxtx_proc_t proc={0}; UE_nr_rxtx_proc_t proc={0};
ret = nr_initial_sync(&proc, UE, normal_txrx); ret = nr_initial_sync(&proc, UE, normal_txrx,1);
printf("nr_initial_sync1 returns %d\n",ret); printf("nr_initial_sync1 returns %d\n",ret);
if (ret<0) n_errors++; if (ret<0) n_errors++;
} }
else { else {
UE->rx_offset=0; UE->rx_offset=0;
uint8_t ssb_index = 0; uint8_t ssb_index = 0;
while (!((SSB_positions >> ssb_index) & 0x01)) ssb_index++; // to select the first transmitted ssb while (!((SSB_positions >> ssb_index) & 0x01)) ssb_index++; // to select the first transmitted ssb
UE->symbol_offset = nr_get_ssb_start_symbol(frame_parms, ssb_index, n_hf); UE->symbol_offset = nr_get_ssb_start_symbol(frame_parms, ssb_index, n_hf);
int ssb_slot = (ssb_index/2)+(n_hf*frame_parms->slots_per_frame);
for (int i=UE->symbol_offset+1; i<UE->symbol_offset+4; i++) { for (int i=UE->symbol_offset+1; i<UE->symbol_offset+4; i++) {
nr_slot_fep(UE, nr_slot_fep(UE,
i, i%frame_parms->symbols_per_slot,
0, ssb_slot,
0, 0,
0, 0,
NR_PBCH_EST); NR_PBCH_EST);
nr_pbch_channel_estimation(UE,0,ssb_slot,i%frame_parms->symbols_per_slot,i-(UE->symbol_offset+1),ssb_index%8,n_hf);
nr_pbch_channel_estimation(UE,0,0,i,i-(UE->symbol_offset+1),ssb_index%8,n_hf);
} }
UE_nr_rxtx_proc_t proc={0}; UE_nr_rxtx_proc_t proc={0};
......
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