Commit ec422f70 authored by cig's avatar cig Committed by Thomas Schlichter

Introduced a delay after a completed sync before starting msg1 generation:

- this was necessary because as soon as the gNB starts, it tries detecting
  the prach preambles and it mesaures the background noise. However, there is
  a delay of several dozens of frames before it considers the preables as
  detected.
- the solution at the UE consists in avoiding sending preamble as soon as the
  UE syncs by introducing an offset, this keeps the power measurements low at
  gNB side as long as the preamble detection counter is under threshold
parent 19530c5a
......@@ -35,6 +35,7 @@
void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
PHY_VARS_NR_UE *ue,
module_id_t gNB_id,
uint8_t frame,
uint8_t subframe,
unsigned char clear,
short coef)
......@@ -104,6 +105,8 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
//mac_resynch();
//dl_phy_sync_success(ue->Mod_id,ue->proc.proc_rxtx[0].frame_rx,0,1);//ue->common_vars.eNb_id);
ue->UE_mode[0] = PRACH;
ue->prach_resources[gNB_id]->sync_frame = frame;
ue->prach_resources[gNB_id]->init_msg1 = 0;
}
else {
ue->UE_mode[0] = PUSCH;
......
......@@ -75,6 +75,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
PHY_VARS_NR_UE *ue,
module_id_t eNB_id,
uint8_t frame,
uint8_t subframe,
unsigned char clear,
short coef);
......
......@@ -221,8 +221,12 @@ typedef struct {
uint16_t ra_RNTI;
/// Pointer to Msg3 payload for UL-grant
uint8_t *Msg3;
/// Flag for the Msg1 generation
/// Flag for the Msg1 generation: it is enabled every time it is nr prach slot
uint8_t generate_nr_prach;
/// Frame of last completed synch
uint8_t sync_frame;
/// Flag to indicate that prach is ready to start: it is enabled with an initial delay after the sync
uint8_t init_msg1;
} NR_PRACH_RESOURCES_t;
typedef struct NR_DL_FRAME_PARMS NR_DL_FRAME_PARMS;
......
......@@ -2482,8 +2482,11 @@ void nr_ue_pbch_procedures(uint8_t gNB_id,
ue->pbch_vars[gNB_id]->pdu_errors_conseq = 0;
// Switch to PRACH state if it is first PBCH after initial synch and no timing correction is performed
if (ue->UE_mode[gNB_id] == NOT_SYNCHED && ue->no_timing_correction == 1)
if (ue->UE_mode[gNB_id] == NOT_SYNCHED && ue->no_timing_correction == 1){
ue->UE_mode[gNB_id] = PRACH;
ue->prach_resources[gNB_id]->sync_frame = frame_rx;
ue->prach_resources[gNB_id]->init_msg1 = 0;
}
#ifdef DEBUG_PHY_PROC
uint16_t frame_tx;
......@@ -4079,6 +4082,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
nr_adjust_synch_ue(fp,
ue,
eNB_id,
frame_rx,
nr_tti_rx,
0,
16384);
......@@ -4523,7 +4527,10 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t
}
}
if (ue->prach_resources[gNB_id] != NULL && prach_resources->generate_nr_prach == 1) {
if (!prach_resources->init_msg1 && (frame_tx > ue->prach_resources[gNB_id]->sync_frame + 150))
prach_resources->init_msg1 = 1;
if (ue->prach_resources[gNB_id] != NULL && prach_resources->generate_nr_prach == 1 && prach_resources->init_msg1) {
ue->prach_cnt = 0;
pathloss = get_nr_PL(mod_id, ue->CC_id, gNB_id);
......
......@@ -501,6 +501,7 @@ int main(int argc, char **argv){
printf("raPreamble %d\n",preamble_tx);
UE->prach_resources[0]->ra_PreambleIndex = preamble_tx;
UE->prach_resources[0]->init_msg1 = 1;
// Configure channel
bw = N_RB_UL*(180e3)*(1 << frame_parms->numerology_index);
......
......@@ -353,7 +353,7 @@ void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
AssertFatal(CC_id == 0,"Transmission on secondary CCs is not supported yet\n");
if (UE_mode == PRACH) {
if (UE_mode == PRACH && prach_resources->init_msg1) {
LOG_D(MAC, "nr_ue_get_rach, RA_active value: %d", mac->RA_active);
......
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