Commit 7155c4b3 authored by Marwan Hammouda's avatar Marwan Hammouda

UE: resetting timing advance for Msg1

parent ce3a64a9
......@@ -908,13 +908,12 @@ void *UE_thread(void *arg)
if (tshift)
{
int diff = 0; // drift in one frame
if (TO_IScaling != 0)
UE->TO_I_Ctrl = round(TO_init_rate/TO_IScaling);
UE->rx_offset_TO = (TO_PScaling*diff) + (UE->TO_I_Ctrl*TO_IScaling); //PI controller
UE->rx_offset_slot = 1;
UE->rx_offset += (UE->init_sync_frame + trashed_frames)*TO_init_rate;
int ta_shift = (UE->init_sync_frame + trashed_frames)*2*TO_init_rate;
UE->rx_offset_comp = 0;
UE->timing_advance += ta_shift;
}
// Still unknown why need to reset timing_advance in RFsim to avoid:
// Received RAR preamble (38) doesn't match the intended RAPID (37)
......@@ -1060,6 +1059,8 @@ void *UE_thread(void *arg)
}
UE->timing_advance += UL_TO_Tx_ofs;
if(mac->ra.ra_state == GENERATE_PREAMBLE)
UE->timing_advance = get_nrUE_params()->timing_advance;
extern uint64_t RFsim_PropDelay;
LOG_D(PHY, "RFsim_PropDelay: %lu, TA: %d, diff: %d, PI_Out: %d, offset_slot: %d, offset_UL: %d, acc_UL_To_TX: %d\n",
......
......@@ -786,7 +786,7 @@ uint8_t nr_ue_get_rach(module_id_t mod_id,
} else if (ra->RA_window_cnt > 0) {
LOG_I(MAC, "[UE %d][%d.%d]: RAR not received yet (RA window count %d) \n", mod_id, frame, nr_slot_tx, ra->RA_window_cnt);
LOG_D(MAC, "[UE %d][%d.%d]: RAR not received yet (RA window count %d) \n", mod_id, frame, nr_slot_tx, ra->RA_window_cnt);
// Fill in preamble and PRACH resources
ra->RA_window_cnt--;
......
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