From b073ca48c3639af235ec9be149560565b5441d4f Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Mon, 26 Apr 2021 17:25:54 +0200 Subject: [PATCH] gNB: improve TA accuracy The TA calculation takes the CIR peak position error and scales it according to 38.213 section 4.2. Till now it was simply an integer division "timing_advance_update = sync_pos / bw_scaling". E.g. in case of bandwidth_scaling == 16, the timing_advance_update was 0 for sync_pos between -15 and +15. With this change, this range (and thus the UL timing error) will be reduced to -8 and +8. --- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index d44c8641a6..03625f87cf 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -369,6 +369,11 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, // scale the 16 factor in N_TA calculation in 38.213 section 4.2 according to the used FFT size uint16_t bw_scaling = 16 * gNB->frame_parms.ofdm_symbol_size / 2048; + // do some integer rounding to improve TA accuracy + if (sync_pos > 0) + sync_pos += bw_scaling / 2 - 1; + else if(sync_pos < 0) + sync_pos -= bw_scaling / 2 - 1; timing_advance_update = sync_pos / bw_scaling; // put timing advance command in 0..63 range