improved gain control when not synched
This commit is contained in:
@@ -38,23 +38,16 @@ extern int card;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
phy_adjust_gain (PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id)
|
phy_adjust_gain (PHY_VARS_UE *phy_vars_ue, uint32_t rx_power_fil_dB, uint8_t eNB_id)
|
||||||
{
|
{
|
||||||
|
|
||||||
uint16_t rx_power_fil_dB;
|
|
||||||
#ifdef EXMIMO
|
#ifdef EXMIMO
|
||||||
exmimo_config_t *p_exmimo_config = openair0_exmimo_pci[card].exmimo_config_ptr;
|
exmimo_config_t *p_exmimo_config = openair0_exmimo_pci[card].exmimo_config_ptr;
|
||||||
uint16_t i;
|
uint16_t i;
|
||||||
#endif
|
#endif
|
||||||
int rssi;
|
|
||||||
|
|
||||||
rssi = dB_fixed(phy_vars_ue->PHY_measurements.rssi);
|
LOG_I(PHY,"Gain control: rssi %d (%d,%d)\n",
|
||||||
|
rx_power_fil_dB,
|
||||||
if (rssi>0) rx_power_fil_dB = rssi;
|
|
||||||
else rx_power_fil_dB = phy_vars_ue->PHY_measurements.rx_power_avg_dB[eNB_id];
|
|
||||||
|
|
||||||
LOG_D(PHY,"Gain control: rssi %d (%d,%d)\n",
|
|
||||||
rssi,
|
|
||||||
phy_vars_ue->PHY_measurements.rssi,
|
phy_vars_ue->PHY_measurements.rssi,
|
||||||
phy_vars_ue->PHY_measurements.rx_power_avg_dB[eNB_id]
|
phy_vars_ue->PHY_measurements.rx_power_avg_dB[eNB_id]
|
||||||
);
|
);
|
||||||
@@ -87,7 +80,7 @@ phy_adjust_gain (PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id)
|
|||||||
phy_vars_ue->rx_total_gain_dB = MIN_RF_GAIN;
|
phy_vars_ue->rx_total_gain_dB = MIN_RF_GAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_D(PHY,"Gain control: rx_total_gain_dB = %d (max %d,rxpf %d)\n",phy_vars_ue->rx_total_gain_dB,MAX_RF_GAIN,rx_power_fil_dB);
|
LOG_I(PHY,"Gain control: rx_total_gain_dB = %d (max %d,rxpf %d)\n",phy_vars_ue->rx_total_gain_dB,MAX_RF_GAIN,rx_power_fil_dB);
|
||||||
|
|
||||||
#ifdef EXMIMO
|
#ifdef EXMIMO
|
||||||
|
|
||||||
|
|||||||
@@ -213,6 +213,7 @@ int8_t set_RSRQ_filtered(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,floa
|
|||||||
|
|
||||||
//! Automatic gain control
|
//! Automatic gain control
|
||||||
void phy_adjust_gain (PHY_VARS_UE *phy_vars_ue,
|
void phy_adjust_gain (PHY_VARS_UE *phy_vars_ue,
|
||||||
|
uint32_t rx_power_fil_dB,
|
||||||
unsigned char eNB_id);
|
unsigned char eNB_id);
|
||||||
|
|
||||||
int lte_ul_channel_estimation(PHY_VARS_eNB *phy_vars_eNB,
|
int lte_ul_channel_estimation(PHY_VARS_eNB *phy_vars_eNB,
|
||||||
|
|||||||
@@ -280,7 +280,6 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode)
|
|||||||
uint8_t flip_fdd_ncp,flip_fdd_ecp,flip_tdd_ncp,flip_tdd_ecp;
|
uint8_t flip_fdd_ncp,flip_fdd_ecp,flip_tdd_ncp,flip_tdd_ecp;
|
||||||
// uint16_t Nid_cell_fdd_ncp=0,Nid_cell_fdd_ecp=0,Nid_cell_tdd_ncp=0,Nid_cell_tdd_ecp=0;
|
// uint16_t Nid_cell_fdd_ncp=0,Nid_cell_fdd_ecp=0,Nid_cell_tdd_ncp=0,Nid_cell_tdd_ecp=0;
|
||||||
LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->lte_frame_parms;
|
LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->lte_frame_parms;
|
||||||
int i;
|
|
||||||
int ret=-1;
|
int ret=-1;
|
||||||
int aarx,rx_power=0;
|
int aarx,rx_power=0;
|
||||||
/*#ifdef OAI_USRP
|
/*#ifdef OAI_USRP
|
||||||
@@ -316,32 +315,6 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode)
|
|||||||
LOG_I(PHY,"[UE%d] Initial sync : Estimated PSS position %d, Nid2 %d\n",phy_vars_ue->Mod_id,sync_pos,phy_vars_ue->lte_ue_common_vars.eNb_id);
|
LOG_I(PHY,"[UE%d] Initial sync : Estimated PSS position %d, Nid2 %d\n",phy_vars_ue->Mod_id,sync_pos,phy_vars_ue->lte_ue_common_vars.eNb_id);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++)
|
|
||||||
rx_power += signal_energy(&phy_vars_ue->lte_ue_common_vars.rxdata[aarx][sync_pos2],
|
|
||||||
frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples);
|
|
||||||
|
|
||||||
phy_vars_ue->PHY_measurements.rx_power_avg_dB[0] = dB_fixed(rx_power/frame_parms->nb_antennas_rx);
|
|
||||||
|
|
||||||
#ifdef DEBUG_INITIAL_SYNCH
|
|
||||||
LOG_I(PHY,"[UE%d] Initial sync : Estimated power: %d dB\n",phy_vars_ue->Mod_id,phy_vars_ue->PHY_measurements.rx_power_avg_dB[0] );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef EXMIMO
|
|
||||||
|
|
||||||
if ((openair_daq_vars.rx_gain_mode == DAQ_AGC_ON) &&
|
|
||||||
(mode != rx_calib_ue) && (mode != rx_calib_ue_med) && (mode != rx_calib_ue_byp) )
|
|
||||||
//phy_adjust_gain(phy_vars_ue,0);
|
|
||||||
gain_control_all(phy_vars_ue->PHY_measurements.rx_power_avg_dB[0],0);
|
|
||||||
|
|
||||||
#else
|
|
||||||
#ifndef OAI_USRP
|
|
||||||
#ifndef OAI_BLADERF
|
|
||||||
phy_adjust_gain(phy_vars_ue,0);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// SSS detection
|
// SSS detection
|
||||||
|
|
||||||
// PSS is hypothesized in last symbol of first slot in Frame
|
// PSS is hypothesized in last symbol of first slot in Frame
|
||||||
@@ -597,6 +570,54 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// gain control
|
||||||
|
if (ret!=0) { //we are not synched, so do a measurement on the full frame
|
||||||
|
rx_power = 0;
|
||||||
|
|
||||||
|
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++)
|
||||||
|
rx_power += signal_energy(&phy_vars_ue->lte_ue_common_vars.rxdata[aarx][0],
|
||||||
|
frame_parms->samples_per_tti*10);
|
||||||
|
|
||||||
|
// we might add a low-pass filter here later
|
||||||
|
phy_vars_ue->PHY_measurements.rx_power_avg[0] = rx_power/frame_parms->nb_antennas_rx;
|
||||||
|
|
||||||
|
phy_vars_ue->PHY_measurements.rx_power_avg_dB[0] = dB_fixed(phy_vars_ue->PHY_measurements.rx_power_avg[0]);
|
||||||
|
|
||||||
|
#ifdef DEBUG_INITIAL_SYNCH
|
||||||
|
LOG_I(PHY,"[UE%d] Initial sync : Estimated power: %d dB\n",phy_vars_ue->Mod_id,phy_vars_ue->PHY_measurements.rx_power_avg_dB[0] );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef EXMIMO
|
||||||
|
if ((openair_daq_vars.rx_gain_mode == DAQ_AGC_ON) &&
|
||||||
|
(mode != rx_calib_ue) && (mode != rx_calib_ue_med) && (mode != rx_calib_ue_byp) )
|
||||||
|
//phy_adjust_gain(phy_vars_ue,0);
|
||||||
|
gain_control_all(phy_vars_ue->PHY_measurements.rx_power_avg_dB[0],0);
|
||||||
|
|
||||||
|
#else
|
||||||
|
#ifndef OAI_USRP
|
||||||
|
#ifndef OAI_BLADERF
|
||||||
|
phy_adjust_gain(phy_vars_ue,phy_vars_ue->PHY_measurements.rx_power_avg_dB[0],0);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
#ifdef EXMIMO
|
||||||
|
if ((openair_daq_vars.rx_gain_mode == DAQ_AGC_ON) &&
|
||||||
|
(mode != rx_calib_ue) && (mode != rx_calib_ue_med) && (mode != rx_calib_ue_byp) )
|
||||||
|
//phy_adjust_gain(phy_vars_ue,0);
|
||||||
|
gain_control_all(dB_fixed(phy_vars_ue->PHY_measurements.rssi),0);
|
||||||
|
|
||||||
|
#else
|
||||||
|
#ifndef OAI_USRP
|
||||||
|
#ifndef OAI_BLADERF
|
||||||
|
phy_adjust_gain(phy_vars_ue,dB_fixed(phy_vars_ue->PHY_measurements.rssi),0);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// exit_fun("debug exit");
|
// exit_fun("debug exit");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1549,12 +1549,12 @@ void lte_ue_measurement_procedures(uint16_t l, PHY_VARS_UE *phy_vars_ue,uint8_t
|
|||||||
if ((openair_daq_vars.rx_gain_mode == DAQ_AGC_ON) &&
|
if ((openair_daq_vars.rx_gain_mode == DAQ_AGC_ON) &&
|
||||||
(mode != rx_calib_ue) && (mode != rx_calib_ue_med) && (mode != rx_calib_ue_byp) )
|
(mode != rx_calib_ue) && (mode != rx_calib_ue_med) && (mode != rx_calib_ue_byp) )
|
||||||
if (phy_vars_ue->frame_rx%100==0)
|
if (phy_vars_ue->frame_rx%100==0)
|
||||||
gain_control_all(phy_vars_ue->PHY_measurements.rx_power_avg_dB[eNB_id],0);
|
gain_control_all(dB_fixed(phy_vars_ue->PHY_measurements.rssi),0);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#ifndef OAI_USRP
|
#ifndef OAI_USRP
|
||||||
#ifndef OAI_BLADERF
|
#ifndef OAI_BLADERF
|
||||||
phy_adjust_gain (phy_vars_ue,0);
|
phy_adjust_gain (phy_vars_ue,dB_fixed(phy_vars_ue->PHY_measurements.rssi),0);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user