Commit f88a7906 authored by Marwan Hammouda's avatar Marwan Hammouda

fix updating TA value more frequenct

parent 7d86bb5f
......@@ -377,11 +377,13 @@ void configure_ta_command(PHY_VARS_NR_UE *ue, fapi_nr_ta_command_pdu *ta_command
int ta_slot_temp = ta_command_pdu->ta_slot + ul_tx_timing_adjustment + NTN_UE_slot_Rx_to_Tx;
ue->ta_slot = ta_slot_temp % slots_per_frame;
/*
if (ta_slot_temp > slots_per_frame)
ue->ta_frame = (ta_command_pdu->ta_frame + ta_slot_temp/slots_per_frame) % 1024;
else
ue->ta_frame = ta_command_pdu->ta_frame;
*/
ue->ta_frame = (ta_command_pdu->ta_frame + ta_slot_temp/slots_per_frame) % 1024;
ue->ta_command = ta_command_pdu->ta_command;
LOG_D(PHY,"TA command received in Frame.Slot %d.%d -- Starting UL time alignment procedures. TA update will be applied at frame %d slot %d\n",
ta_command_pdu->ta_frame, ta_command_pdu->ta_slot, ue->ta_frame, ue->ta_slot);
......
......@@ -233,16 +233,10 @@ int get_tx_amp_prach(int power_dBm, int power_max_dBm, int N_RB_UL){
// - Application of timing adjustment according to TS 38.213 p4.2
// todo:
// - handle RAR TA application as per ch 4.2 TS 38.213
static uint64_t idx = 0;
static int lastFrame;
void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx)
{
//if ( (frame_tx == ue->ta_frame && slot_tx == ue->ta_slot && idx == 0) ||
//(frame_tx == ue->ta_frame && slot_tx == ue->ta_slot && (frame_tx - lastFrame) == 100) ) {
if (frame_tx == ue->ta_frame && slot_tx == ue->ta_slot){
lastFrame = frame_tx;
idx = 1;
uint16_t ofdm_symbol_size = ue->frame_parms.ofdm_symbol_size;
......
......@@ -3685,25 +3685,31 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
const int ta = ((NR_MAC_CE_TA *)pduP)[1].TA_COMMAND;
const int tag = ((NR_MAC_CE_TA *)pduP)[1].TAGID;
NR_UL_TIME_ALIGNMENT_t *ul_time_alignment = &mac->ul_time_alignment;
ul_time_alignment->ta_total += ta - 31;
ul_time_alignment->tag_id = tag;
ul_time_alignment->ta_command = ta;
ul_time_alignment->frame = frameP;
ul_time_alignment->slot = slot;
LOG_D(NR_MAC, "ul_time_alignment->frame: %d, ul_time_alignment->slot: %d\n", ul_time_alignment->frame, ul_time_alignment->slot);
ul_time_alignment->ta_apply = true;
static int firstTime = 0;
if ((frameP == (ul_time_alignment->frame + 100)%1024) || firstTime == 0 )
{
firstTime = 1;
ul_time_alignment->ta_total += ta - 31;
ul_time_alignment->tag_id = tag;
ul_time_alignment->ta_command = ta;
ul_time_alignment->frame = frameP;
ul_time_alignment->slot = slot;
LOG_D(NR_MAC, "ul_time_alignment->frame: %d, ul_time_alignment->slot: %d\n", ul_time_alignment->frame, ul_time_alignment->slot);
ul_time_alignment->ta_apply = true;
/*
#ifdef DEBUG_HEADER_PARSING
LOG_D(MAC, "[UE] CE %d : UE Timing Advance : %d\n", i, pduP[1]);
#endif
*/
if (ta == 31)
LOG_D(NR_MAC, "[%d.%d] Received TA_COMMAND %u TAGID %u CC_id %d TA total %d\n", frameP, slot, ta, tag, CC_id, ul_time_alignment->ta_total);
else
LOG_I(NR_MAC, "[%d.%d] Received TA_COMMAND %u TAGID %u CC_id %d TA total %d\n", frameP, slot, ta, tag, CC_id, ul_time_alignment->ta_total);
if (ta == 31)
LOG_D(NR_MAC, "[%d.%d] Received TA_COMMAND %u TAGID %u CC_id %d TA total %d\n", frameP, slot, ta, tag, CC_id, ul_time_alignment->ta_total);
else
LOG_I(NR_MAC, "[%d.%d] Received TA_COMMAND %u TAGID %u CC_id %d TA total %d\n", frameP, slot, ta, tag, CC_id, ul_time_alignment->ta_total);
}
break;
case DL_SCH_LCID_CON_RES_ID:
// Clause 5.1.5 and 6.1.3.3 of 3GPP TS 38.321 version 16.2.1 Release 16
......
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