Commit ce338ed5 authored by magounak's avatar magounak

added "missed_synch_events" functionality

parent 45965287
......@@ -123,8 +123,8 @@ int lte_est_timing_advance_pusch(PHY_VARS_eNB *eNB,module_id_t UE_id)
LTE_DL_FRAME_PARMS *frame_parms = (eNB==NULL) ? &ru->frame_parms : &eNB->frame_parms;
LTE_eNB_PUSCH *eNB_pusch_vars = eNB->pusch_vars[UE_id];
RU_CALIBRATION *calibration = &ru->calibration;
int32_t **ul_ch_estimates_time = (eNB==NULL) ? calibration->drs_ch_estimates_time : eNB_pusch_vars->drs_ch_estimates_time;
//int32_t **ul_ch_estimates_time = calibration->drs_ch_estimates_time;
//int32_t **ul_ch_estimates_time = (eNB==NULL) ? calibration->drs_ch_estimates_time : eNB_pusch_vars->drs_ch_estimates_time;
int32_t **ul_ch_estimates_time = calibration->drs_ch_estimates_time;
uint8_t cyclic_shift = 0;
int sync_pos = (frame_parms->ofdm_symbol_size-cyclic_shift*frame_parms->ofdm_symbol_size/12)%(frame_parms->ofdm_symbol_size);
......
......@@ -160,7 +160,8 @@ void remove_7_5_kHz(RU_t *ru,uint8_t slot)
}
// undo 7.5 kHz offset for symbol 10 in case RU is master (for OTA synchronization)
if (ru->is_slave == 0 && slot == 3){
/* if (slot == 3){
memcpy((void*)&rxdata_7_5kHz[aa][(3*frame_parms->ofdm_symbol_size)+
(2*frame_parms->nb_prefix_samples)+
frame_parms->nb_prefix_samples0],
......@@ -169,9 +170,9 @@ void remove_7_5_kHz(RU_t *ru,uint8_t slot)
(2*frame_parms->nb_prefix_samples)+
frame_parms->nb_prefix_samples0],
(frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples)*sizeof(int32_t));
}
}*/
/* if (ru->is_slave == 0 && slot == 3){
if (slot == 3){
memcpy((void*)&rxdata_7_5kHz[aa][(10*frame_parms->ofdm_symbol_size)+
(8*frame_parms->nb_prefix_samples)+
2*frame_parms->nb_prefix_samples0],
......@@ -180,7 +181,7 @@ void remove_7_5_kHz(RU_t *ru,uint8_t slot)
(2*frame_parms->nb_prefix_samples)+
frame_parms->nb_prefix_samples0],
(frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples)*sizeof(int32_t));
}*/
}
}
}
......
......@@ -353,6 +353,8 @@ typedef struct RU_t_s{
int wait_cnt;
/// counter to delay start of slave RUs until stable synchronization
int wait_check;
/// counter to count missed synch events during synchronization of RU
int missed_synch_events;
/// Total gain of receive chain
uint32_t rx_total_gain_dB;
/// number of bands that this device can support
......
......@@ -673,7 +673,7 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
proc = &eNB->proc.L1_proc;
/* TODO: check that following line is correct - in the meantime it is disabled */
//if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)==SF_UL)) return;
if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)==SF_UL)) return;
ul_subframe = pdcch_alloc2ul_subframe(fp,subframe);
ul_frame = pdcch_alloc2ul_frame(fp,frame,subframe);
......
......@@ -138,7 +138,7 @@ void prach_procedures(PHY_VARS_eNB *eNB
*/
if (eNB->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[0]==1){
if ((eNB->prach_energy_counter == 100) &&
(max_preamble_energy[0] > eNB->measurements.prach_I0 + 100)) {
(max_preamble_energy[0] > eNB->measurements.prach_I0 + 200)) {
eNB->UL_INFO.rach_ind_br.rach_indication_body.number_of_preambles++;
eNB->preamble_list_br[ind].preamble_rel8.timing_advance = max_preamble_delay[ind];//
......
......@@ -81,7 +81,7 @@ void feptx0(RU_t *ru,int slot) {
slot_offset = subframe*fp->samples_per_tti + (slot*(fp->samples_per_tti>>1));
//LOG_D(PHY,"SFN/SF:RU:TX:%d/%d Generating slot %d\n",ru->proc.frame_tx, ru->proc.subframe_tx,slot);
LOG_D(PHY,"SFN/SF:RU:TX:%d/%d Generating slot %d\n",ru->proc.frame_tx, ru->proc.subframe_tx,slot);
for (aa=0; aa<ru->nb_tx; aa++) {
if (fp->Ncp == EXTENDED) PHY_ofdm_mod(&ru->common.txdataF_BF[aa][slot*slot_sizeF],
......@@ -96,7 +96,7 @@ void feptx0(RU_t *ru,int slot) {
fp->frame_type,ru->is_slave);
*/
// generate_drs_pusch() generates dmrs for both slots (symbols 3,10)
if (ru->generate_dmrs_sync == 1 && slot == 0 && subframe == 1 && aa==0) {
if (ru->generate_dmrs_sync == 1 /*&& slot == 0*/ && subframe == 1 && aa==0) {
generate_drs_pusch((PHY_VARS_UE *)NULL,
(UE_rxtx_proc_t*)NULL,
fp,
......@@ -218,7 +218,7 @@ void feptx_ofdm_2thread(RU_t *ru) {
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 1 );
// The 2nd check is to force the slave RRUs to send DMRS at symbol 10-subframe 1-slot 1
if (subframe_select(fp,subframe)==SF_DL || ((subframe_select(fp,subframe)==SF_DL || subframe==1) && ru->is_slave==1)) {
if (subframe_select(fp,subframe)==SF_DL || ((subframe_select(fp,subframe)==SF_DL || subframe==1) /*&& ru->is_slave==1*/)) {
// if (subframe_select(fp,subframe)==SF_DL) {
// If this is not an S-subframe
if (pthread_mutex_timedlock(&proc->mutex_feptx,&wait) != 0) {
......@@ -532,8 +532,7 @@ void fep0(RU_t *ru,int slot) {
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms;
int l;
//printf("fep0: slot %d\n",slot);
LOG_D(PHY,"fep0: slot %d, subframe %d\n",slot,proc->subframe_rx);
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX+slot, 1);
remove_7_5_kHz(ru,(slot&1)+(proc->subframe_rx<<1));
for (l=0; l<fp->symbols_per_tti/2; l++) {
......@@ -703,6 +702,7 @@ void ru_fep_full_2thread(RU_t *ru) {
printf("delay in fep wait on condition in frame_rx: %d subframe_rx: %d \n",proc->frame_rx,proc->subframe_rx);
}
/* if (proc->subframe_rx==1 && ru->is_slave==0) {
// LOG_I(PHY,"******************** Master receives DMRS from slave\n");
ru->wait_check++;
......@@ -802,10 +802,26 @@ void ru_fep_full_2thread(RU_t *ru) {
ru->idx);
if (ru->state == RU_CHECK_SYNC) {
if ((check_sync_pos >= 0 && check_sync_pos<8) || (check_sync_pos < 0 && check_sync_pos>-8)) {
LOG_I(PHY,"~~~~~~~~~~~ check_sync_pos %d, frame %d, cnt %d\n",check_sync_pos,proc->frame_rx,ru->wait_check);
LOG_I(PHY,"~~~~~~~~~~~ check_sync_pos %d, frame %d, cnt %d, missed %d\n",check_sync_pos,proc->frame_rx,ru->wait_check,ru->missed_synch_events);
ru->wait_check++;
}
else {
ru->missed_synch_events++;
LOG_I(PHY,"!!!!!!!!!!!! check_sync_pos %d, frame %d, cnt %d, missed %d\n",check_sync_pos,proc->frame_rx,ru->wait_check,ru->missed_synch_events);
}
if (ru->missed_synch_events > 2) {
ru->in_synch = 0;
if (ru->stop_rf) {
ru->stop_rf(ru);
ru->state = RU_SYNC;
ru->cmd = EMPTY;
LOG_I(PHY,"RU %d rf device stopped\n",ru->idx);
LOG_M("rxdata.m","rxdata",&ru->common.rxdata[0][0], fp->samples_per_tti*2,1,1);
exit(-1);
} else AssertFatal(1==0,"ru->stop_rf doesn't exist\n");
}
if (ru->wait_check==20) {
ru->state = RU_RUN;
ru->wait_check = 0;
......@@ -815,19 +831,22 @@ void ru_fep_full_2thread(RU_t *ru) {
LOG_I(PHY,"Sending RRU_sync_ok to RAU\n");
AssertFatal((ru->ifdevice.trx_ctlsend_func(&ru->ifdevice,&rru_config_msg,rru_config_msg.len)!=-1),"Failed to send msg to RAU %d\n",ru->idx);
//LOG_I(PHY,"~~~~~~~~~ RU_RUN\n");
/*LOG_M("dmrs_time.m","dmrstime",calibration->drs_ch_estimates_time[0], (fp->ofdm_symbol_size),1,1);
LOG_M("rxdataF_ext.m","rxdataFext",&calibration->rxdataF_ext[0][36*fp->N_RB_DL], 12*(fp->N_RB_DL),1,1);
LOG_M("drs_seq0.m","drsseq0",ul_ref_sigs_rx[0][0][23],600,1,1);
LOG_M("rxdata.m","rxdata",&ru->common.rxdata[0][0], fp->samples_per_tti*2,1,1);
exit(-1);*/
//LOG_M("dmrs_time.m","dmrstime",calibration->drs_ch_estimates_time[0], (fp->ofdm_symbol_size),1,1);
//LOG_M("rxdataF_ext.m","rxdataFext",&calibration->rxdataF_ext[0][36*fp->N_RB_DL], 12*(fp->N_RB_DL),1,1);
//LOG_M("drs_seq0.m","drsseq0",ul_ref_sigs_rx[0][0][23],600,1,1);
//LOG_M("rxdata.m","rxdata",&ru->common.rxdata[0][0], fp->samples_per_tti*2,1,1);
//exit(-1);
}
}
else if (ru->state == RU_RUN) {
// check for synchronization error
if (check_sync_pos >= 8 || check_sync_pos<=-8) {
LOG_E(PHY,"~~~~~~~~~~~~~~ check_sync_pos %d, frame %d ---> LOST SYNC-EXIT\n", check_sync_pos, proc->frame_rx);
//LOG_M("rxdata.m","rxdata",&ru->common.rxdata[0][0], fp->samples_per_tti*2,1,1);
/*
LOG_M("dmrs_time.m","dmrstime",calibration->drs_ch_estimates_time[0], (fp->ofdm_symbol_size),1,1);
LOG_M("rxdata.m","rxdata",&ru->common.rxdata[0][0], fp->samples_per_tti*2,1,1);
exit(-1);
*/
}
}
......
This diff is collapsed.
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