From 53777043c338e7a1a9e107078d2f2be4698c54ad Mon Sep 17 00:00:00 2001
From: "Wilson W.K. Thong" <wilsonthong@astri.org>
Date: Tue, 6 Dec 2016 21:10:30 +0800
Subject: [PATCH] fixed PRACH TA default value in TDD mode

see issue #43
---
 targets/RT/USER/lte-softmodem.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c
index 9f98aaada..e28f70a8c 100644
--- a/targets/RT/USER/lte-softmodem.c
+++ b/targets/RT/USER/lte-softmodem.c
@@ -1594,8 +1594,16 @@ int main( int argc, char **argv )
 
       UE[CC_id]->rx_total_gain_dB =  (int)rx_gain[CC_id][0] + rx_gain_off;
       UE[CC_id]->tx_power_max_dBm = tx_max_power[CC_id];
-      UE[CC_id]->N_TA_offset = 0;
-
+      if (UE[CC_id]->frame_parms.frame_type == TDD) {
+        if (UE[CC_id]->frame_parms.N_RB_DL == 100)
+          UE[CC_id]->N_TA_offset = 624;
+        else if (UE[CC_id]->frame_parms.N_RB_DL == 50)
+          UE[CC_id]->N_TA_offset = 624/2;
+        else if (UE[CC_id]->frame_parms.N_RB_DL == 25)
+          UE[CC_id]->N_TA_offset = 624/4;
+      } else {
+        UE[CC_id]->N_TA_offset = 0;
+      }
     }
 
     //  printf("tx_max_power = %d -> amp %d\n",tx_max_power,get_tx_amp(tx_max_poHwer,tx_max_power));
-- 
GitLab