Automatic update of USRP RX gain during initial search using --agc option

- if search fails, keeps increasing the rx gain (set by --ue-rxgain) by
  3 db until USRP max rx gain
- if initial sync is success, sets the rxgain to the value of
  (TARGET_RX_POWER (50) - pbch digital power in dB/RE)
This commit is contained in:
Raghavendra Dinavahi
2024-07-25 15:33:44 +02:00
committed by Robert Schmidt
parent 4c698bce2b
commit 95a8767383
10 changed files with 83 additions and 26 deletions
+10 -4
View File
@@ -115,6 +115,12 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue,
uint32_t pdsch_est_size,
int32_t dl_ch_estimates[][pdsch_est_size]);
int nr_ue_calculate_ssb_rsrp(const NR_DL_FRAME_PARMS *fp,
const UE_nr_rxtx_proc_t *proc,
const c16_t rxdataF[][fp->samples_per_slot_wCP],
int symbol_offset,
int ssb_start_subcarrier);
void nr_ue_ssb_rsrp_measurements(PHY_VARS_NR_UE *ue,
uint8_t gNB_index,
const UE_nr_rxtx_proc_t *proc,
@@ -146,9 +152,9 @@ void nr_pdsch_ptrs_processing(PHY_VARS_NR_UE *ue,
float_t get_nr_RSRP(module_id_t Mod_id,uint8_t CC_id,uint8_t gNB_index);
void nr_sl_psbch_rsrp_measurements(sl_nr_ue_phy_params_t *sl_phy_params,
NR_DL_FRAME_PARMS *fp,
c16_t rxdataF[][fp->samples_per_slot_wCP],
bool use_SSS);
int nr_sl_psbch_rsrp_measurements(sl_nr_ue_phy_params_t *sl_phy_params,
NR_DL_FRAME_PARMS *fp,
c16_t rxdataF[][fp->samples_per_slot_wCP],
bool use_SSS);
/** @}*/
#endif
@@ -291,6 +291,11 @@ void nr_scan_ssb(void *arg)
&ssbInfo->pbchResult,
nr_gold_pbch_ref,
rxdataF); // start pbch detection at first symbol after pss
if (ssbInfo->syncRes.cell_detected) {
int rsrp_db_per_re = nr_ue_calculate_ssb_rsrp(ssbInfo->fp, ssbInfo->proc, rxdataF, 0, ssbInfo->gscnInfo.ssbFirstSC);
ssbInfo->adjust_rxgain = TARGET_RX_POWER - rsrp_db_per_re;
LOG_I(PHY, "pbch rx ok. rsrp:%d dB/RE, adjust_rxgain:%d dB\n", rsrp_db_per_re, ssbInfo->adjust_rxgain);
}
}
}
}
@@ -370,6 +375,7 @@ nr_initial_sync_t nr_initial_sync(UE_nr_rxtx_proc_t *proc,
fp->ssb_index = res.ssbIndex;
ue->symbol_offset = res.symbolOffset;
ue->common_vars.freq_offset = res.freqOffset;
ue->adjust_rxgain = res.adjust_rxgain;
}
// In initial sync, we indicate PBCH to MAC after the scan is complete.
@@ -512,7 +512,7 @@ nr_initial_sync_t sl_nr_slss_search(PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc,
sync_params->DFN,
sync_params->slot_offset);
nr_sl_psbch_rsrp_measurements(sl_ue, frame_parms, rxdataF, false);
UE->adjust_rxgain = nr_sl_psbch_rsrp_measurements(sl_ue, frame_parms, rxdataF, false);
UE->init_sync_frame = sync_params->remaining_frames;
result.rx_offset = sync_params->rx_offset;
+4
View File
@@ -600,6 +600,9 @@ typedef struct PHY_VARS_NR_UE_s {
notifiedFIFO_t tx_resume_ind_fifo[NR_MAX_SLOTS_PER_FRAME];
// Gain change required for automation RX gain change
int adjust_rxgain;
// Sidelink parameters
sl_nr_sidelink_mode_t sl_mode;
sl_nr_ue_phy_params_t SL_UE_PHY_PARAMS;
@@ -645,6 +648,7 @@ typedef struct {
fapiPbch_t pbchResult;
int pssCorrPeakPower;
int pssCorrAvgPower;
int adjust_rxgain;
} nr_ue_ssb_scan_t;
typedef struct nr_phy_data_tx_s {
+3
View File
@@ -181,6 +181,9 @@
#define TARGET_RX_POWER_MAX 65 // Maximum digital power, such that signal does not saturate (value found by simulation)
#define TARGET_RX_POWER_MIN 35 // Minimum digital power, anything below will be discarded (value found by simulation)
// Increase USRP rx gain in steps of 3dB during Initial search
#define INCREASE_IN_RXGAIN 3
//the min and max gains have to match the calibrated gain table
//#define MAX_RF_GAIN 160
//#define MIN_RF_GAIN 96
@@ -223,7 +223,7 @@ int psbch_pscch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr
sym = (sym == 0) ? 5 : sym + 1;
}
nr_sl_psbch_rsrp_measurements(sl_phy_params, fp, rxdataF, false);
ue->adjust_rxgain = nr_sl_psbch_rsrp_measurements(sl_phy_params, fp, rxdataF, false);
LOG_D(NR_PHY, " ------ Decode SL-MIB: frame.slot %d.%d ------ \n", frame_rx % 1024, nr_slot_rx);