[OAI-UE] TimingOffset tracking faster loop
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
*/
|
||||
|
||||
/*!\brief Timing drift hysterisis in samples*/
|
||||
#define SYNCH_HYST 1
|
||||
#define SYNCH_HYST 2
|
||||
|
||||
/*!
|
||||
\brief This function is used for time-frequency scanning prior to complete cell search. It scans
|
||||
|
||||
@@ -74,13 +74,14 @@ void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
else
|
||||
max_pos_fil = ((max_pos_fil * coef) + (max_pos * ncoef)) >> 15;
|
||||
|
||||
max_pos_fil = max_pos;
|
||||
|
||||
diff = max_pos_fil - frame_parms->nb_prefix_samples/8;
|
||||
|
||||
if ( diff > SYNCH_HYST )
|
||||
ue->rx_offset++;
|
||||
else if (diff < -SYNCH_HYST)
|
||||
ue->rx_offset--;
|
||||
if ( abs(diff) < SYNCH_HYST )
|
||||
ue->rx_offset = 0;
|
||||
else
|
||||
ue->rx_offset = diff;
|
||||
|
||||
if ( ue->rx_offset < 0 )
|
||||
ue->rx_offset += FRAME_LENGTH_COMPLEX_SAMPLES;
|
||||
|
||||
@@ -693,6 +693,46 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
|
||||
multadd_complex_vector_real_scalar(dl_ch_prev,21845,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)<<1),1,ue->frame_parms.ofdm_symbol_size);
|
||||
multadd_complex_vector_real_scalar(dl_ch,10923,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),0,ue->frame_parms.ofdm_symbol_size);
|
||||
} // pilot spacing 3 symbols (1/3,2/3 combination)
|
||||
#if 0
|
||||
//LOG_E(PHY,"Interpolate s7--s11 s12 s13 pilot 3 Ns %d l %d symbol %d \n", Ns, l, symbol);
|
||||
int16_t *dlChEst_ofdm11 = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][pilot3*(ue->frame_parms.ofdm_symbol_size)];
|
||||
int16_t *dlChEst_ofdm7 = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][pilot2*(ue->frame_parms.ofdm_symbol_size)];
|
||||
|
||||
// interpolate ofdm s12: 4/5*ofdms11 + 1/5*ofdms7 4/5 q1.15 26214 1/5 q1.15 6554
|
||||
int16_t *dlChEst_ofdm12 = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][12*ue->frame_parms.ofdm_symbol_size];
|
||||
for(int i=0; i<(2*ue->frame_parms.ofdm_symbol_size); i++)
|
||||
{
|
||||
int32_t tmp_mult = 0;
|
||||
tmp_mult = ((int32_t)dlChEst_ofdm11[i] * 26214 + (int32_t)dlChEst_ofdm7[i] * 6554);
|
||||
|
||||
tmp_mult = tmp_mult >> 15;
|
||||
dlChEst_ofdm12[i] = tmp_mult;
|
||||
/*
|
||||
if((i==0))
|
||||
{
|
||||
LOG_I(PHY,"interpolate dlchest11_0 using: dlchest11 %d+%di dlchest7 %d+%di\n",dlChEst_ofdm11[0],dlChEst_ofdm11[1],dlChEst_ofdm7[0],dlChEst_ofdm7[1]);
|
||||
LOG_I(PHY,"interpolate dlchest11_1 using: dlchest11 %d+%di dlchest7 %d+%di\n",dlChEst_ofdm11[2],dlChEst_ofdm11[3],dlChEst_ofdm7[2],dlChEst_ofdm7[3]);
|
||||
LOG_I(PHY,"interpolate dlchest11_2 using: dlchest11 %d+%di dlchest7 %d+%di\n",dlChEst_ofdm11[4],dlChEst_ofdm11[5],dlChEst_ofdm7[4],dlChEst_ofdm7[5]);
|
||||
}*/
|
||||
}
|
||||
|
||||
// interpolate ofdm s13: 2/3*ofdms11 + 1/3*ofdms7 2/3 q1.15 21845 1/3 q1.15 10923
|
||||
int16_t *dlChEst_ofdm13 = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][13*ue->frame_parms.ofdm_symbol_size];
|
||||
for(int i=0; i<(2*ue->frame_parms.ofdm_symbol_size); i++)
|
||||
{
|
||||
int32_t tmp_mult = 0;
|
||||
tmp_mult = ((int32_t)dlChEst_ofdm11[i] * 21845 + (int32_t)dlChEst_ofdm7[i] * 10923);
|
||||
|
||||
tmp_mult = tmp_mult >> 15;
|
||||
dlChEst_ofdm13[i] = tmp_mult;
|
||||
/*if((i==0))
|
||||
{
|
||||
LOG_I(PHY,"interpolate dlchest11_0 using: dlchest11 %d+%di dlchest7 %d+%di\n",dlChEst_ofdm11[0],dlChEst_ofdm11[1],dlChEst_ofdm7[0],dlChEst_ofdm7[1]);
|
||||
LOG_I(PHY,"interpolate dlchest11_1 using: dlchest11 %d+%di dlchest7 %d+%di\n",dlChEst_ofdm11[2],dlChEst_ofdm11[3],dlChEst_ofdm7[2],dlChEst_ofdm7[3]);
|
||||
LOG_I(PHY,"interpolate dlchest11_2 using: dlchest11 %d+%di dlchest7 %d+%di\n",dlChEst_ofdm11[4],dlChEst_ofdm11[5],dlChEst_ofdm7[4],dlChEst_ofdm7[5]);
|
||||
}*/
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1752,9 +1752,9 @@ int32_t rx_pdcch(LTE_UE_COMMON *common_vars,
|
||||
avgs = cmax(avgs,avgP[(aarx<<1)+aatx]);
|
||||
|
||||
log2_maxh = (log2_approx(avgs)/2) + 5; //+frame_parms->nb_antennas_rx;
|
||||
#ifdef DEBUG_PHY
|
||||
//#ifdef DEBUG_PHY
|
||||
LOG_I(PHY,"subframe %d: pdcch log2_maxh = %d (%d,%d)\n",subframe,log2_maxh,avgP[0],avgs);
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
#if T_TRACER
|
||||
T(T_UE_PHY_PDCCH_ENERGY, T_INT(eNB_id), T_INT(0), T_INT(frame%1024), T_INT(subframe),
|
||||
|
||||
@@ -7202,8 +7202,8 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu,
|
||||
|
||||
// ulsch->n_DMRS2 = ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->cshift;
|
||||
|
||||
#ifdef DEBUG_DCI
|
||||
printf("Format 0 DCI : ulsch (ue): AbsSubframe %d.%d\n",proc->frame_rx,subframe);
|
||||
#ifdef DEBUG_DCI
|
||||
printf("Format 0 DCI : ulsch (ue): AbsSubframe %d.%d\n",proc->frame_rx%1024,subframe);
|
||||
printf("Format 0 DCI : ulsch (ue): NBRB %d\n",ulsch->harq_processes[harq_pid]->nb_rb);
|
||||
printf("Format 0 DCI :ulsch (ue): first_rb %d\n",ulsch->harq_processes[harq_pid]->first_rb);
|
||||
printf("Format 0 DCI :ulsch (ue): rballoc %d\n",rballoc);
|
||||
|
||||
@@ -1395,7 +1395,7 @@ void rx_phich(PHY_VARS_UE *ue,
|
||||
//#ifdef DEBUG_PHICH
|
||||
LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d PHICH, received NAK (%d) nseq %d, ngroup %d (Mlimit %d)\n",
|
||||
ue->Mod_id,harq_pid,
|
||||
proc->frame_rx,
|
||||
proc->frame_rx%1024,
|
||||
subframe,
|
||||
HI16,
|
||||
nseq_PHICH,
|
||||
@@ -1450,7 +1450,7 @@ void rx_phich(PHY_VARS_UE *ue,
|
||||
//#ifdef PHICH_DEBUG
|
||||
LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d PHICH, received ACK (%d) nseq %d, ngroup %d\n\n",
|
||||
ue->Mod_id,harq_pid,
|
||||
proc->frame_rx,
|
||||
proc->frame_rx%1024,
|
||||
subframe, HI16,
|
||||
nseq_PHICH,ngroup_PHICH);
|
||||
//#endif
|
||||
|
||||
@@ -124,6 +124,7 @@ static inline void* malloc16_clear( size_t size )
|
||||
#include "PHY/TOOLS/defs.h"
|
||||
#include "platform_types.h"
|
||||
|
||||
//#define OPENAIR_LTE
|
||||
#ifdef OPENAIR_LTE
|
||||
|
||||
#include "PHY/LTE_TRANSPORT/defs.h"
|
||||
@@ -798,6 +799,7 @@ typedef struct {
|
||||
uint8_t prach_PreambleIndex;
|
||||
// uint8_t prach_timer;
|
||||
int rx_offset; /// Timing offset
|
||||
int rx_offset_diff; /// Timing adjustment for ofdm symbol0 on HW USRP
|
||||
int timing_advance; ///timing advance signalled from eNB
|
||||
int hw_timing_advance;
|
||||
int N_TA_offset; ///timing offset used in TDD
|
||||
|
||||
@@ -1359,7 +1359,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
|
||||
}
|
||||
|
||||
if (isBad) {
|
||||
LOG_D(PHY,"Skip PUSCH generation!\n");
|
||||
LOG_I(PHY,"Skip PUSCH generation!\n");
|
||||
ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 0;
|
||||
}
|
||||
}
|
||||
@@ -1369,7 +1369,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
|
||||
|
||||
// deactivate service request
|
||||
// ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 0;
|
||||
LOG_D(PHY,"Generating PUSCH (Abssubframe: %d.%d): harq-Id: %d, round: %d, MaxReTrans: %d \n",frame_tx,subframe_tx,harq_pid,ue->ulsch[eNB_id]->harq_processes[harq_pid]->round,ue->ulsch[eNB_id]->Mlimit);
|
||||
LOG_I(PHY,"Generating PUSCH (Abssubframe: %d.%d): harq-Id: %d, round: %d, MaxReTrans: %d \n",frame_tx%1024,subframe_tx,harq_pid,ue->ulsch[eNB_id]->harq_processes[harq_pid]->round,ue->ulsch[eNB_id]->Mlimit);
|
||||
if (ue->ulsch[eNB_id]->harq_processes[harq_pid]->round >= (ue->ulsch[eNB_id]->Mlimit - 1))
|
||||
{
|
||||
LOG_D(PHY,"PUSCH MAX Retransmission achieved ==> send last pusch\n");
|
||||
@@ -1689,7 +1689,7 @@ int16_t get_pucch2_ri(PHY_VARS_UE *ue,int eNB_id) {
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
int count0=0;
|
||||
void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag) {
|
||||
|
||||
|
||||
@@ -1815,7 +1815,7 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
|
||||
T_INT(tx_amp),T_INT(ue->dlsch[eNB_id][0]->g_pucch),T_INT(get_PL(ue->Mod_id,ue->CC_id,eNB_id)));
|
||||
#endif
|
||||
if (SR_payload>0) {
|
||||
LOG_D(PHY,"[UE %d][SR %x] Frame %d subframe %d Generating PUCCH %s payload %d,%d (with SR for PUSCH), an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, Po_PUCCH %d, amp %d\n",
|
||||
LOG_I(PHY,"[UE %d][SR %x] AbsSubFrame %d.%d Generating PUCCH %s payload %d,%d (with SR for PUSCH), an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, Po_PUCCH %d, amp %d\n",
|
||||
Mod_id,
|
||||
ue->dlsch[eNB_id][0]->rnti,
|
||||
frame_tx % 1024, subframe_tx,
|
||||
@@ -1828,10 +1828,10 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
|
||||
Po_PUCCH,
|
||||
tx_amp);
|
||||
} else {
|
||||
LOG_D(PHY,"[UE %d][PDSCH %x] Frame %d subframe %d Generating PUCCH %s, an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, b[0]=%d,b[1]=%d (SR_Payload %d), Po_PUCCH %d, amp %d\n",
|
||||
LOG_I(PHY,"[UE %d][PDSCH %x] AbsSubFrame %d.%d rx_offset_diff: %d, Generating PUCCH %s, an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, b[0]=%d,b[1]=%d (SR_Payload %d), Po_PUCCH %d, amp %d\n",
|
||||
Mod_id,
|
||||
ue->dlsch[eNB_id][0]->rnti,
|
||||
frame_tx, subframe_tx,
|
||||
frame_tx, subframe_tx,ue->rx_offset_diff,
|
||||
(format == pucch_format1a? "1a": (
|
||||
format == pucch_format1b? "1b" : "??")),
|
||||
frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission,
|
||||
@@ -1855,7 +1855,32 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
|
||||
T_INT(ue->dlsch[eNB_id][0]->current_harq_pid));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if 1
|
||||
if ((pucch_ack_payload[0] == 0) && (proc->subframe_tx==4) && (ue->rx_offset_diff != 0))
|
||||
count0++;
|
||||
if(count0 > 5)
|
||||
{
|
||||
LOG_E(PHY,"Signal drop !!! ==> dump received signal AbsSubframe %d.%d rx_offset %d \n",proc->frame_rx,proc->subframe_rx, ue->rx_offset);
|
||||
|
||||
write_output("rxData.m","rxData",&ue->common_vars.rxdata[0][0],(10*frame_parms->samples_per_tti)+2048,1,1);
|
||||
|
||||
//write_output("rxDataF.m","rxDataF",&ue->common_vars.rxdataF[0][0],frame_parms->ofdm_symbol_size * 14,1,1);
|
||||
if(proc->subframe_rx & 0x1)
|
||||
{
|
||||
write_output("dlChEstOdd.m","dlChEst",&ue->common_vars.dl_ch_estimates[0][0][0],frame_parms->symbols_per_tti * (frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH),1,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
write_output("dlChEstEven.m","dlChEst",&ue->common_vars.dl_ch_estimates[0][0][0],frame_parms->symbols_per_tti * (frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH),1,1);
|
||||
}
|
||||
//write_output("rxdataF_ext.m","rxdataF_ext",&ue->pdsch_vars[eNB_id]->rxdataF_ext[0][0],frame_parms->N_RB_DL*12*14,1,1);
|
||||
//write_output("dlChEst_ext.m","dlChEst_ext",&ue->pdsch_vars[eNB_id]->dl_ch_estimates_ext[0][0],frame_parms->N_RB_DL*12*14,1,1);
|
||||
|
||||
|
||||
AssertFatal(0," ");
|
||||
}
|
||||
#endif
|
||||
if (abstraction_flag == 0) {
|
||||
|
||||
generate_pucch1x(ue->common_vars.txdataF,
|
||||
@@ -2278,7 +2303,7 @@ void ue_measurement_procedures(
|
||||
|
||||
}
|
||||
|
||||
if ((subframe_rx==0) && (l==(4-frame_parms->Ncp))) {
|
||||
if ((subframe_rx==0) && (slot == 0) && (l==(4-frame_parms->Ncp))) {
|
||||
|
||||
// AGC
|
||||
|
||||
|
||||
+34
-10
@@ -1152,18 +1152,37 @@ void *UE_thread(void *arg) {
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ_SF9, 1 );
|
||||
// read in first symbol of next frame and adjust for timing drift
|
||||
for (i=0; i<UE->frame_parms.nb_antennas_rx; i++)
|
||||
{
|
||||
rxp[i] = (void*)&UE->common_vars.rxdata[i][0];
|
||||
}
|
||||
|
||||
rxs = UE->rfdevice.trx_read_func(&UE->rfdevice,
|
||||
×tamp1,
|
||||
(void**)UE->common_vars.rxdata,
|
||||
UE->frame_parms.ofdm_symbol_size + UE->frame_parms.nb_prefix_samples0 - rx_off_diff,
|
||||
rxp,
|
||||
UE->frame_parms.nb_prefix_samples0 - rx_off_diff,
|
||||
UE->frame_parms.nb_antennas_rx);
|
||||
|
||||
for (i=0; i<UE->frame_parms.nb_antennas_rx; i++)
|
||||
{
|
||||
rxp[i] = (void*)&UE->common_vars.rxdata[i][UE->frame_parms.nb_prefix_samples0];
|
||||
}
|
||||
|
||||
rxs = UE->rfdevice.trx_read_func(&UE->rfdevice,
|
||||
×tamp1,
|
||||
rxp,
|
||||
UE->frame_parms.ofdm_symbol_size,
|
||||
UE->frame_parms.nb_antennas_rx);
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ_SF9, 0 );
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_READ_NS, rxs );
|
||||
if (rxs != (UE->frame_parms.ofdm_symbol_size + UE->frame_parms.nb_prefix_samples0 - rx_off_diff)) {
|
||||
if (rxs != (UE->frame_parms.ofdm_symbol_size)) {
|
||||
LOG_E(PHY, "problem in rx 7! expect #samples=%d but got only %d! rx_off_diff=%d\n", UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0 - rx_off_diff, rxs, rx_off_diff);
|
||||
exit_fun("problem in rx 7!");
|
||||
return &UE_thread_retval;
|
||||
}
|
||||
UE->rx_offset_diff = rx_off_diff;
|
||||
LOG_E(PHY,"SET rx_off_diff to %d\n",UE->rx_offset_diff);
|
||||
rx_off_diff = 0;
|
||||
}
|
||||
}
|
||||
@@ -1232,21 +1251,26 @@ void *UE_thread(void *arg) {
|
||||
getchar();
|
||||
}
|
||||
}// for sf=0..10
|
||||
|
||||
uint8_t proc_select = 9&1;
|
||||
UE_rxtx_proc_t *proc = &UE->proc.proc_rxtx[proc_select];
|
||||
|
||||
if ((UE->rx_offset<(5*UE->frame_parms.samples_per_tti)) &&
|
||||
(UE->rx_offset > RX_OFF_MIN) &&
|
||||
(UE->rx_offset > 0) &&
|
||||
(rx_correction_timer == 0)) {
|
||||
rx_off_diff = -UE->rx_offset + RX_OFF_MIN;
|
||||
LOG_D(PHY,"UE->rx_offset %d > %d, diff %d\n",UE->rx_offset,RX_OFF_MIN,rx_off_diff);
|
||||
rx_off_diff = -1 ;
|
||||
LOG_I(PHY,"AbsSubframe %d.%d UE->rx_offset %d > %d, diff %d\n",proc->frame_rx,proc->subframe_rx,UE->rx_offset,0,rx_off_diff);
|
||||
rx_correction_timer = 5;
|
||||
} else if ((UE->rx_offset>(5*UE->frame_parms.samples_per_tti)) &&
|
||||
(UE->rx_offset < ((10*UE->frame_parms.samples_per_tti)-RX_OFF_MIN)) &&
|
||||
(UE->rx_offset < ((10*UE->frame_parms.samples_per_tti))) &&
|
||||
(rx_correction_timer == 0)) { // moving to the left so drop rx_off_diff samples
|
||||
rx_off_diff = 10*UE->frame_parms.samples_per_tti - RX_OFF_MIN - UE->rx_offset;
|
||||
LOG_D(PHY,"UE->rx_offset %d < %d, diff %d\n",UE->rx_offset,10*UE->frame_parms.samples_per_tti-RX_OFF_MIN,rx_off_diff);
|
||||
rx_off_diff = 1;
|
||||
LOG_I(PHY,"AbsSubframe %d.%d UE->rx_offset %d < %d, diff %d\n",proc->frame_rx,proc->subframe_rx,UE->rx_offset,10*UE->frame_parms.samples_per_tti,rx_off_diff);
|
||||
|
||||
rx_correction_timer = 5;
|
||||
}
|
||||
|
||||
//rx_off_diff = 0;
|
||||
|
||||
if (rx_correction_timer>0)
|
||||
rx_correction_timer--;
|
||||
} // start_rx_stream==1
|
||||
|
||||
Reference in New Issue
Block a user